LCOV - code coverage report
Current view: top level - seq - application.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 3 3 100.0 %
Date: 2017-12-16 05:07:20 Functions: 3 3 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2017, Stefan Eilemann <eile@eyescale.ch>
       3             :  *                          Petros Kataras <petroskataras@gmail.com>
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #ifndef EQSEQUEL_APPLICATION_H
      20             : #define EQSEQUEL_APPLICATION_H
      21             : 
      22             : #include <co/objectFactory.h> // interface
      23             : #include <eq/client.h>        // base class
      24             : #include <seq/types.h>
      25             : 
      26             : namespace seq
      27             : {
      28             : /** The main application object. */
      29             : class Application : public eq::Client, public co::ObjectFactory
      30             : {
      31             : public:
      32             :     /** Construct a new application instance. @version 1.0 */
      33             :     SEQ_API Application();
      34             : 
      35             :     /** @name Data Access */
      36             :     //@{
      37             :     /** @return the node running the main instance. @version 1.3.1 */
      38             :     SEQ_API co::NodePtr getMasterNode();
      39             : 
      40             :     /** @return help on all parsed command line arguments. @version 2.1 */
      41             :     SEQ_API static std::string getHelp();
      42             :     //@}
      43             : 
      44             :     /** @name Operations */
      45             :     //@{
      46             :     /**
      47             :      * Initialize the application instance.
      48             :      *
      49             :      * The initData object is registered and is passed to all initialization
      50             :      * callbacks on all processes. The object may be 0, if the application does
      51             :      * not want to use an object during initialization.
      52             :      *
      53             :      * @param argc the command line argument count.
      54             :      * @param argv the command line arguments.
      55             :      * @param initData a distributable object for initialization data.
      56             :      * @return true on success, false otherwise.
      57             :      * @version 1.0
      58             :      */
      59             :     SEQ_API virtual bool init(int argc, char** argv, co::Object* initData);
      60             : 
      61             :     /**
      62             :      * Run the application main loop.
      63             :      *
      64             :      * The frameData object is registered and is passed to all rendering
      65             :      * callbacks on all processes. It is automatically committed at the
      66             :      * beginning of each frame. The instance passed to the render callbacks is
      67             :      * automatically synchronized to the version belonging to the frame
      68             :      * rendered. The object may be 0, if the application does not want to use a
      69             :      * per-frame object.
      70             :      *
      71             :      * @return true on success, false otherwise.
      72             :      * @param frameData a distributed object holding frame-specific data.
      73             :      * @version 1.0
      74             :      */
      75             :     SEQ_API virtual bool run(co::Object* frameData);
      76             : 
      77             :     /**
      78             :      * Exit this application instance.
      79             :      *
      80             :      * @return true on success, false otherwise.
      81             :      * @version 1.0
      82             :      */
      83             :     SEQ_API virtual bool exit();
      84             : 
      85             :     /** Request that the application leaves its run loop. @version 1.1.6 */
      86             :     SEQ_API void stopRunning();
      87             :     //@}
      88             : 
      89             :     /** @name Callbacks */
      90             :     //@{
      91             :     /**
      92             :      * Initialize a render client.
      93             :      *
      94             :      * Also called on the master application node if it contributes to the
      95             :      * rendering.
      96             :      *
      97             :      * @param initData A slave instance of the object passed to init().
      98             :      * @return true on success, false on error.
      99             :      * @version 1.0
     100             :      */
     101           1 :     virtual bool clientInit(co::Object* initData LB_UNUSED) { return true; }
     102             :     /** Exit a render client. @version 1.0 */
     103           1 :     virtual bool clientExit() { return true; }
     104             :     /**
     105             :      * Create a new renderer instance.
     106             :      *
     107             :      * Called once per rendering thread, potentially in parallel, during
     108             :      * initialization.
     109             :      *
     110             :      * @return the new renderer
     111             :      * @version 1.0
     112             :      */
     113             :     virtual Renderer* createRenderer() = 0;
     114             : 
     115             :     /** Delete the given renderer. @version 1.0 */
     116             :     SEQ_API virtual void destroyRenderer(Renderer* renderer);
     117             : 
     118             :     /**
     119             :      * Create a new per-view data instance.
     120             :      *
     121             :      * Called once for each view in the current configuration. Creates the view
     122             :      * data objects used by the application to set parameters for the renderers.
     123             :      *
     124             :      * @param view the view requesting the view data
     125             :      * @return the new view data
     126             :      * @version 1.11
     127             :      */
     128             :     SEQ_API virtual ViewData* createViewData(View& view);
     129             : 
     130             :     /** Delete the given view data. @version 1.0 */
     131             :     SEQ_API virtual void destroyViewData(ViewData* viewData);
     132             :     //@}
     133             : 
     134             :     /** @name Internal */
     135             :     //@{
     136             :     SEQ_API eq::Config* getConfig();                 //!< @internal
     137           4 :     detail::Application* getImpl() { return _impl; } //!< @internal
     138             :                                                      //@}
     139             : 
     140             :     /** @name Distributed Object API */
     141             :     //@{
     142             :     /**
     143             :      * Add and register a new object as master instance.
     144             :      *
     145             :      * @param object the new object to add and register
     146             :      * @param type unique object type to create object via slave factory
     147             :      * @return true on success, false otherwise.
     148             :      * @version 1.8
     149             :      * @sa co::ObjectMap::register_()
     150             :      */
     151             :     SEQ_API bool registerObject(co::Object* object, const uint32_t type);
     152             : 
     153             :     /**
     154             :      * Remove and deregister an object.
     155             :      *
     156             :      * @param object the object to remove and deregister
     157             :      * @return false if object was not registered, true otherwise
     158             :      * @version 1.8
     159             :      * @sa co::ObjectMap::deregister()
     160             :      */
     161             :     SEQ_API bool deregister(co::Object* object);
     162             :     //@}
     163             : 
     164             : protected:
     165             :     /** Destruct this application instance. @version 1.0 */
     166             :     SEQ_API virtual ~Application();
     167             : 
     168             : private:
     169             :     detail::Application* _impl;
     170             : };
     171             : }
     172             : #endif // EQSEQUEL_APPLICATION_H

Generated by: LCOV version 1.11