Equalizer  2.1.0
Parallel Rendering Framework
node.h
1 
2 /* Copyright (c) 2005-2017, 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/fabric/eventType.h> // EventType enum
24 #include <eq/fabric/node.h> // base class
25 #include <eq/types.h>
26 #include <eq/visitorResult.h> // enum
27 
28 #include <co/types.h>
29 
30 namespace eq
31 {
32 namespace detail
33 {
34 class Node;
35 }
36 
52 class Node : public fabric::Node<Config, Node, Pipe, NodeVisitor>
53 {
54 public:
56  EQ_API explicit Node(Config* parent);
57 
59  EQ_API virtual ~Node();
60 
62  EQ_API ClientPtr getClient();
63 
65  EQ_API ServerPtr getServer();
66 
67  EQ_API co::CommandQueue* getMainThreadQueue();
68  EQ_API co::CommandQueue* getCommandThreadQueue();
69  co::CommandQueue* getTransmitterQueue();
70 
72  uint32_t getCurrentFrame() const;
73 
81  co::Barrier* getBarrier(const co::ObjectVersion& barrier);
82 
90  FrameDataPtr getFrameData(const co::ObjectVersion& frameDataVersion);
91 
93  void releaseFrameData(FrameDataPtr data);
94 
96  EQ_API void waitInitialized() const;
97 
102  EQ_API bool isRunning() const;
103 
108  EQ_API bool isStopped() const;
109 
120  EQ_API void waitFrameStarted(const uint32_t frameNumber) const;
121 
123  uint32_t getFinishedFrame() const;
124 
131  EQ_API EventOCommand sendError(const uint32_t error);
132 
143  EQ_API virtual bool processEvent(AxisEvent& event);
144  EQ_API virtual bool processEvent(ButtonEvent& event);
145  EQ_API virtual bool processEvent(Statistic& event);
146 
148  EQ_API void setDirty(const uint64_t bits) override;
149 
151  EQ_API void dirtyClientExit();
152 
153 protected:
155  EQ_API
156  void attach(const uint128_t& id, const uint32_t instanceID) override;
157 
166  EQ_API void startFrame(const uint32_t frameNumber);
167 
174  EQ_API void releaseFrame(const uint32_t frameNumber);
175 
182  EQ_API void releaseFrameLocal(const uint32_t frameNumber);
184 
192 
199  EQ_API virtual bool configInit(const uint128_t& initID);
200 
202  EQ_API virtual bool configExit();
203 
217  EQ_API virtual void frameStart(const uint128_t& frameID,
218  const uint32_t frameNumber);
219 
232  EQ_API virtual void frameFinish(const uint128_t& frameID,
233  const uint32_t frameNumber);
234 
247  EQ_API virtual void frameDrawFinish(const uint128_t& frameID,
248  const uint32_t frameNumber);
249 
265  EQ_API virtual void frameTasksFinish(const uint128_t& frameID,
266  const uint32_t frameNumber);
268 
269 private:
270  detail::Node* const _impl;
271 
272  void _setAffinity();
273 
274  void _finishFrame(const uint32_t frameNumber) const;
275  void _frameFinish(const uint128_t& frameID, const uint32_t frameNumber);
276 
277  void _flushObjects();
278 
280  bool _cmdCreatePipe(co::ICommand& command);
281  bool _cmdDestroyPipe(co::ICommand& command);
282  bool _cmdConfigInit(co::ICommand& command);
283  bool _cmdConfigExit(co::ICommand& command);
284  bool _cmdFrameStart(co::ICommand& command);
285  bool _cmdFrameFinish(co::ICommand& command);
286  bool _cmdFrameDrawFinish(co::ICommand& command);
287  bool _cmdFrameTasksFinish(co::ICommand& command);
288  bool _cmdFrameDataTransmit(co::ICommand& command);
289  bool _cmdFrameDataReady(co::ICommand& command);
290  bool _cmdSetAffinity(co::ICommand& command);
291 
292  LB_TS_VAR(_nodeThread);
293 };
294 }
295 
296 #endif // EQ_NODE_H
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: eq/types.h:215
A configuration is a visualization session driven by an application.
Definition: config.h:58
A Node represents a single computer in the cluster.
Definition: node.h:52
Base data transport class for nodes.
Definition: fabric/node.h:32
The Equalizer client library.
Definition: eq/agl/types.h:23
lunchbox::RefPtr< Client > ClientPtr
A reference-counted pointer to an eq::Client.
Definition: eq/types.h:211
lunchbox::RefPtr< FrameData > FrameDataPtr
A reference-counted pointer to an eq::FrameData.
Definition: eq/types.h:217