Equalizer  2.0.0
Parallel Rendering Framework
node.h
1 
2 /* Copyright (c) 2005-2016, 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 #include <eq/fabric/eventType.h> // EventType enum
27 
28 #include <co/types.h>
29 
30 namespace eq
31 {
32 namespace detail { class Node; }
33 
49 class Node : public fabric::Node< Config, Node, Pipe, NodeVisitor >
50 {
51 public:
53  EQ_API explicit Node( Config* parent );
54 
56  EQ_API virtual ~Node();
57 
59  EQ_API ClientPtr getClient();
60 
62  EQ_API ServerPtr getServer();
63 
64  EQ_API co::CommandQueue* getMainThreadQueue();
65  EQ_API co::CommandQueue* getCommandThreadQueue();
66  co::CommandQueue* getTransmitterQueue();
67 
69  uint32_t getCurrentFrame() const;
70 
78  co::Barrier* getBarrier( const co::ObjectVersion& barrier );
79 
87  FrameDataPtr getFrameData( const co::ObjectVersion& frameDataVersion );
88 
90  void releaseFrameData( FrameDataPtr data );
91 
93  EQ_API void waitInitialized() const;
94 
99  EQ_API bool isRunning() const;
100 
105  EQ_API bool isStopped() const;
106 
117  EQ_API void waitFrameStarted( const uint32_t frameNumber ) const;
118 
120  uint32_t getFinishedFrame() const;
121 
128  EQ_API EventOCommand sendError( const uint32_t error );
129 
140  EQ_API virtual bool processEvent( EventType type, AxisEvent& event );
141  EQ_API virtual bool processEvent( EventType type, ButtonEvent& event );
142  EQ_API virtual bool processEvent( Statistic& event );
143 
145  EQ_API void setDirty( const uint64_t bits ) override;
146 
148  EQ_API void dirtyClientExit();
149 
150 protected:
152  EQ_API
153  void attach( const uint128_t& id, const uint32_t instanceID ) override;
154 
163  EQ_API void startFrame( const uint32_t frameNumber );
164 
171  EQ_API void releaseFrame( const uint32_t frameNumber );
172 
179  EQ_API void releaseFrameLocal( const uint32_t frameNumber );
181 
189 
196  EQ_API virtual bool configInit( const uint128_t& initID );
197 
199  EQ_API virtual bool configExit();
200 
214  EQ_API virtual void frameStart( const uint128_t& frameID,
215  const uint32_t frameNumber );
216 
229  EQ_API virtual void frameFinish( const uint128_t& frameID,
230  const uint32_t frameNumber );
231 
244  EQ_API virtual void frameDrawFinish( const uint128_t& frameID,
245  const uint32_t frameNumber );
246 
262  EQ_API virtual void frameTasksFinish( const uint128_t& frameID,
263  const uint32_t frameNumber );
265 
266 private:
267  detail::Node* const _impl;
268 
269  void _setAffinity();
270 
271  void _finishFrame( const uint32_t frameNumber ) const;
272  void _frameFinish( const uint128_t& frameID,
273  const uint32_t frameNumber );
274 
275  void _flushObjects();
276 
278  bool _cmdCreatePipe( co::ICommand& command );
279  bool _cmdDestroyPipe( co::ICommand& command );
280  bool _cmdConfigInit( co::ICommand& command );
281  bool _cmdConfigExit( co::ICommand& command );
282  bool _cmdFrameStart( co::ICommand& command );
283  bool _cmdFrameFinish( co::ICommand& command );
284  bool _cmdFrameDrawFinish( co::ICommand& command );
285  bool _cmdFrameTasksFinish( co::ICommand& command );
286  bool _cmdFrameDataTransmit( co::ICommand& command );
287  bool _cmdFrameDataReady( co::ICommand& command );
288  bool _cmdSetAffinity( co::ICommand& command );
289 
290  LB_TS_VAR( _nodeThread );
291 };
292 }
293 
294 #endif // EQ_NODE_H
A configuration is a visualization session driven by an application.
Definition: config.h:55
A Node represents a single computer in the cluster.
Definition: node.h:49
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: eq/types.h:215
Base data transport class for nodes.
Definition: fabric/node.h:31
lunchbox::RefPtr< Client > ClientPtr
A reference-counted pointer to an eq::Client.
Definition: eq/types.h:211
The Equalizer client library.
Definition: eq/agl/types.h:23
lunchbox::RefPtr< FrameData > FrameDataPtr
A reference-counted pointer to an eq::FrameData.
Definition: eq/types.h:217