Equalizer  1.9.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
node.h
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 EQ_NODE_H
20 #define EQ_NODE_H
21 
22 #include <eq/api.h>
23 #include <eq/types.h>
24 #include <eq/visitorResult.h> // enum
25 #include <eq/fabric/node.h> // base class
26 
27 #include <co/types.h>
28 
29 namespace eq
30 {
31 namespace detail { class Node; }
32 
48 class Node : public fabric::Node< Config, Node, Pipe, NodeVisitor >
49 {
50 public:
52  EQ_API Node( Config* parent );
53 
55  EQ_API virtual ~Node();
56 
58  EQ_API ClientPtr getClient();
59 
61  EQ_API ServerPtr getServer();
62 
63  EQ_API co::CommandQueue* getMainThreadQueue();
64  EQ_API co::CommandQueue* getCommandThreadQueue();
65  co::CommandQueue* getTransmitterQueue();
66 
68  uint32_t getCurrentFrame() const;
69 
77  co::Barrier* getBarrier( const co::ObjectVersion& barrier );
78 
86  FrameDataPtr getFrameData( const co::ObjectVersion& frameDataVersion );
87 
89  void releaseFrameData( FrameDataPtr data );
90 
92  EQ_API void waitInitialized() const;
93 
98  EQ_API bool isRunning() const;
99 
104  EQ_API bool isStopped() const;
105 
116  EQ_API void waitFrameStarted( const uint32_t frameNumber ) const;
117 
119  uint32_t getFinishedFrame() const;
120 
127  EQ_API EventOCommand sendError( const uint32_t error );
128 
140  EQ_API virtual bool processEvent( const Event& event );
141 
143  EQ_API virtual void setDirty( const uint64_t bits );
144 
146  EQ_API void dirtyClientExit();
147 
148 protected:
150  EQ_API virtual void attach( const uint128_t& id, const uint32_t instanceID );
151 
160  EQ_API void startFrame( const uint32_t frameNumber );
161 
168  EQ_API void releaseFrame( const uint32_t frameNumber );
169 
176  EQ_API void releaseFrameLocal( const uint32_t frameNumber );
178 
186 
193  EQ_API virtual bool configInit( const uint128_t& initID );
194 
196  EQ_API virtual bool configExit();
197 
211  EQ_API virtual void frameStart( const uint128_t& frameID,
212  const uint32_t frameNumber );
213 
226  EQ_API virtual void frameFinish( const uint128_t& frameID,
227  const uint32_t frameNumber );
228 
241  EQ_API virtual void frameDrawFinish( const uint128_t& frameID,
242  const uint32_t frameNumber );
243 
259  EQ_API virtual void frameTasksFinish( const uint128_t& frameID,
260  const uint32_t frameNumber );
262 
263 private:
264  detail::Node* const _impl;
265 
266  void _setAffinity();
267 
268  void _finishFrame( const uint32_t frameNumber ) const;
269  void _frameFinish( const uint128_t& frameID,
270  const uint32_t frameNumber );
271 
272  void _flushObjects();
273 
275  bool _cmdCreatePipe( co::ICommand& command );
276  bool _cmdDestroyPipe( co::ICommand& command );
277  bool _cmdConfigInit( co::ICommand& command );
278  bool _cmdConfigExit( co::ICommand& command );
279  bool _cmdFrameStart( co::ICommand& command );
280  bool _cmdFrameFinish( co::ICommand& command );
281  bool _cmdFrameDrawFinish( co::ICommand& command );
282  bool _cmdFrameTasksFinish( co::ICommand& command );
283  bool _cmdFrameDataTransmit( co::ICommand& command );
284  bool _cmdFrameDataReady( co::ICommand& command );
285  bool _cmdSetAffinity( co::ICommand& command );
286 
287  LB_TS_VAR( _nodeThread );
288 };
289 }
290 
291 #endif // EQ_NODE_H
virtual EQ_API bool processEvent(const Event &event)
Process a received event.
Defines export visibility macros for Equalizer.
A configuration is a visualization session driven by an application.
Definition: config.h:55
virtual EQ_API void frameTasksFinish(const uint128_t &frameID, const uint32_t frameNumber)
Finish all rendering tasks.
EQ_API ServerPtr getServer()
EQ_API void releaseFrame(const uint32_t frameNumber)
Signal the completion of a frame to the parent.
A Node represents a single computer in the cluster.
Definition: node.h:48
virtual EQ_API bool configExit()
Exit this node.
virtual EQ_API bool configInit(const uint128_t &initID)
Initialize this node.
virtual EQ_API void frameStart(const uint128_t &frameID, const uint32_t frameNumber)
Start rendering a frame.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: types.h:210
EQ_API bool isRunning() const
virtual EQ_API void frameDrawFinish(const uint128_t &frameID, const uint32_t frameNumber)
Finish drawing.
EQ_API Node(Config *parent)
Construct a new node.
EQ_API void releaseFrameLocal(const uint32_t frameNumber)
Release the local synchronization of the parent for a frame.
EQ_API void waitFrameStarted(const uint32_t frameNumber) const
Wait for a frame to be started.
EQ_API ClientPtr getClient()
Base data transport class for nodes.
Definition: fabric/node.h:30
virtual EQ_API ~Node()
Destruct the node.
lunchbox::RefPtr< Client > ClientPtr
A reference-counted pointer to an eq::Client.
Definition: types.h:206
virtual EQ_API void frameFinish(const uint128_t &frameID, const uint32_t frameNumber)
Finish rendering a frame.
EQ_API void startFrame(const uint32_t frameNumber)
Start a frame by unlocking all child resources.
virtual EQ_API void setDirty(const uint64_t bits)
lunchbox::RefPtr< FrameData > FrameDataPtr
A reference-counted pointer to an eq::FrameData.
Definition: types.h:212
EQ_API bool isStopped() const
EQ_API EventOCommand sendError(const uint32_t error)
Send an error event to the application node.