LCOV - code coverage report
Current view: top level - eq/server - pipe.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 5 6 83.3 %
Date: 2017-12-16 05:07:20 Functions: 5 6 83.3 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2005-2015, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *                          Cedric Stalder <cedric.stalder@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 EQSERVER_PIPE_H
      20             : #define EQSERVER_PIPE_H
      21             : 
      22             : #include "state.h" // enum
      23             : #include "types.h"
      24             : #include "visitorResult.h" // enum
      25             : #include <eq/server/api.h>
      26             : 
      27             : #include <eq/fabric/iAttribute.h>    // eq::OFF enum
      28             : #include <eq/fabric/pipe.h>          // parent
      29             : #include <eq/fabric/pixelViewport.h> // member
      30             : #include <lunchbox/monitor.h>        // member
      31             : 
      32             : #include <ostream>
      33             : #include <vector>
      34             : 
      35             : namespace eq
      36             : {
      37             : namespace server
      38             : {
      39             : /** The pipe. */
      40             : class Pipe : public fabric::Pipe<Node, Pipe, Window, PipeVisitor>
      41             : {
      42             : public:
      43             :     /** Construct a new Pipe. */
      44             :     EQSERVER_API explicit Pipe(Node* parent);
      45             : 
      46             :     virtual ~Pipe();
      47             : 
      48             :     ServerPtr getServer();
      49             :     ConstServerPtr getServer() const;
      50             : 
      51             :     Config* getConfig();
      52             :     const Config* getConfig() const;
      53             : 
      54             :     co::CommandQueue* getMainThreadQueue();
      55             :     co::CommandQueue* getCommandThreadQueue();
      56             : 
      57             :     Channel* getChannel(const ChannelPath& path);
      58             : 
      59             :     /** @return the state of this pipe. */
      60          32 :     State getState() const { return _state.get(); }
      61             :     /** @internal */
      62           0 :     void setState(const State state) { _state = state; }
      63             :     /** Increase pipe activition count. */
      64             :     void activate();
      65             : 
      66             :     /** Decrease pipe activition count. */
      67             :     void deactivate();
      68             : 
      69             :     /** @return if this pipe is actively used for rendering. */
      70          16 :     bool isActive() const { return (_active != 0); }
      71             :     /** @return if this pipe is running. */
      72           6 :     bool isRunning() const { return _state == STATE_RUNNING; }
      73             :     /**
      74             :      * Add additional tasks this pipe, and all its parents, might
      75             :      * potentially execute.
      76             :      */
      77             :     void addTasks(const uint32_t tasks);
      78             : 
      79             :     /**
      80             :      * @name Data Access
      81             :      */
      82             :     //@{
      83             :     /** The last drawing compound for this entity. @internal */
      84           8 :     void setLastDrawWindow(const Window* window) { _lastDrawWindow = window; }
      85           4 :     const Window* getLastDrawWindow() const { return _lastDrawWindow; }
      86             :     //@}
      87             : 
      88             :     /**
      89             :      * @name Operations
      90             :      */
      91             :     //@{
      92             :     /** Start initializing this entity. */
      93             :     void configInit(const uint128_t& initID, const uint32_t frameNumber);
      94             : 
      95             :     /** Sync initialization of this entity. */
      96             :     bool syncConfigInit();
      97             : 
      98             :     /** Start exiting this entity. */
      99             :     void configExit();
     100             : 
     101             :     /** Sync exit of this entity. */
     102             :     bool syncConfigExit();
     103             : 
     104             :     /**
     105             :      * Trigger the rendering of a new frame.
     106             :      *
     107             :      * @param frameID a per-frame identifier passed to all rendering
     108             :      *                methods.
     109             :      * @param frameNumber the number of the frame.
     110             :      */
     111             :     void update(const uint128_t& frameID, const uint32_t frameNumber);
     112             :     //@}
     113             : 
     114             :     co::ObjectOCommand send(const uint32_t cmd);
     115             :     void output(std::ostream&) const; //!< @internal
     116             : 
     117             : protected:
     118             :     /** @sa co::Object::attachToSession. */
     119             :     virtual void attach(const uint128_t& id, const uint32_t instanceID);
     120             : 
     121             :     /** @internal Execute the slave remove request. */
     122             :     virtual void removeChild(const uint128_t& id);
     123             : 
     124             : private:
     125             :     /** Number of activations for this pipe. */
     126             :     uint32_t _active;
     127             : 
     128             :     friend class Node;
     129             : 
     130             :     /** The current state for state change synchronization. */
     131             :     lunchbox::Monitor<State> _state;
     132             : 
     133             :     /** The last draw window for this entity. */
     134             :     const Window* _lastDrawWindow;
     135             : 
     136             :     struct Private;
     137             :     Private* _private; // placeholder for binary-compatible changes
     138             : 
     139             :     /* command handler functions. */
     140             :     bool _cmdConfigInitReply(co::ICommand& command);
     141             :     bool _cmdConfigExitReply(co::ICommand& command);
     142             : };
     143             : }
     144             : }
     145             : #endif // EQSERVER_PIPE_H

Generated by: LCOV version 1.11