Equalizer  2.1.0
Parallel Rendering Framework
config.h
1 
2 /* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
3  * Cedric Stalder <cedric Stalder@gmail.com>
4  * Daniel Nachbaur <danielnachbaur@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_CONFIG_H
21 #define EQ_CONFIG_H
22 
23 #include <eq/api.h>
24 #include <eq/types.h>
25 
26 #include <co/objectHandler.h> // base class
27 #include <eq/fabric/config.h> // base class
28 
29 namespace eq
30 {
31 namespace detail
32 {
33 class Config;
34 }
35 
58 class Config : public fabric::Config<Server, Config, Observer, Layout, Canvas,
59  Node, ConfigVisitor>,
60  public co::ObjectHandler
61 {
62 public:
66 
68  EQ_API explicit Config(ServerPtr parent);
69 
71  EQ_API virtual ~Config();
72 
76  EQ_API ClientPtr getClient();
77 
79  EQ_API ConstClientPtr getClient() const;
80 
85  EQ_API co::NodePtr getApplicationNode();
86 
87  EQ_API co::CommandQueue* getMainThreadQueue();
88  EQ_API co::CommandQueue* getCommandThreadQueue();
89 
91  EQ_API uint32_t getCurrentFrame() const;
92 
94  EQ_API uint32_t getFinishedFrame() const;
95 
97  EQ_API GLStats::Data getStatistics() const;
98 
104  EQ_API bool isRunning() const;
105 
107  EQ_API void stopRunning();
108 
119  EQ_API int64_t getTime() const;
120 
122  EQ_API MessagePump* getMessagePump();
123 
125  const Channel* findChannel(const std::string& name) const
126  {
127  return find<Channel>(name);
128  }
130 
156  EQ_API virtual bool init(const uint128_t& initID);
157 
172  EQ_API virtual bool exit();
173 
193  EQ_API bool update();
194 
196  EQ_API void setLatency(const uint32_t latency) override;
198 
208  EQ_API bool registerObject(co::Object* object) override;
209 
219  EQ_API void deregisterObject(co::Object* object) override;
220 
228  EQ_API virtual bool mapObject(
229  co::Object* object, const uint128_t& id,
230  const uint128_t& version = co::VERSION_OLDEST);
231 
233  EQ_API virtual uint32_t mapObjectNB(
234  co::Object* object, const uint128_t& id,
235  const uint128_t& version = co::VERSION_OLDEST);
236 
238  EQ_API uint32_t mapObjectNB(co::Object* object, const uint128_t& id,
239  const uint128_t& version,
240  co::NodePtr master) override;
241 
243  EQ_API bool mapObjectSync(const uint32_t requestID) override;
244 
252  EQ_API void unmapObject(co::Object* object) override;
253 
260  EQ_API f_bool_t
261  syncObject(co::Object* object, const uint128_t& id, co::NodePtr master,
262  const uint32_t instanceID = CO_INSTANCE_ALL) override;
264 
283  EQ_API virtual uint32_t startFrame(const uint128_t& frameID);
284 
300  EQ_API virtual uint32_t finishFrame();
301 
311  EQ_API virtual uint32_t finishAllFrames();
312 
324  EQ_API void releaseFrameLocal(const uint32_t frameNumber);
325 
335  EQ_API void stopFrames();
336 
338 
352  EQ_API EventOCommand sendEvent(const uint32_t type);
353 
361  EQ_API EventOCommand sendError(const uint32_t type, const Error& error);
362 
366  EQ_API Errors getErrors();
367 
381  EQ_API EventICommand
382  getNextEvent(const uint32_t timeout = LB_TIMEOUT_INDEFINITE) const;
383 
391  EQ_API virtual bool handleEvent(EventICommand command);
392  EQ_API virtual bool handleEvent(EventType type, const Event& event);
393  EQ_API virtual bool handleEvent(EventType type, const SizeEvent& event);
394  EQ_API virtual bool handleEvent(EventType type, const PointerEvent& event);
395  EQ_API virtual bool handleEvent(EventType type, const KeyEvent& event);
396  EQ_API virtual bool handleEvent(const AxisEvent& event);
397  EQ_API virtual bool handleEvent(const ButtonEvent& event);
398 
400  EQ_API bool checkEvent() const;
401 
411  EQ_API virtual void handleEvents();
412 
419  EQ_API virtual void addStatistic(const Statistic& stat);
421 
427  void setupMessagePump(Pipe* pipe);
428 
430  void setupServerConnections(const std::string& connectionData);
431 
432 protected:
434  EQ_API void attach(const uint128_t& id, const uint32_t instanceID) override;
435 
436  EQ_API void notifyAttached() override;
437  EQ_API void notifyDetach() override;
438 
439  EQ_API void changeLatency(const uint32_t latency) override;
440  EQ_API bool mapViewObjects() const override;
441 
442 private:
443  detail::Config* const _impl;
444 
445  void _frameStart();
446  friend class Node;
447 
448  bool _needsLocalSync() const;
449 
451  void _updateStatistics();
452 
455  void _releaseObjects();
456 
458  void _exitMessagePump();
459 
461  bool _cmdSyncClock(co::ICommand& command);
462  bool _cmdCreateNode(co::ICommand& command);
463  bool _cmdDestroyNode(co::ICommand& command);
464  bool _cmdInitReply(co::ICommand& command);
465  bool _cmdExitReply(co::ICommand& command);
466  bool _cmdUpdateVersion(co::ICommand& command);
467  bool _cmdUpdateReply(co::ICommand& command);
468  bool _cmdReleaseFrameLocal(co::ICommand& command);
469  bool _cmdFrameFinish(co::ICommand& command);
470  bool _cmdSwapObject(co::ICommand& command);
471 };
472 }
473 
474 #endif // EQ_CONFIG_H
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: eq/types.h:215
A visitor to traverse configs and all children.
Definition: configVisitor.h:36
A channel represents a two-dimensional viewport within a Window.
Definition: channel.h:46
A configuration is a visualization session driven by an application.
Definition: config.h:58
Proxy object for the connection to an Equalizer server.
Definition: server.h:43
A canvas represents a logical 2D projection surface.
Definition: canvas.h:53
A Pipe represents a graphics card (GPU) on a Node.
Definition: pipe.h:50
A Node represents a single computer in the cluster.
Definition: node.h:52
lunchbox::RefPtr< const Client > ConstClientPtr
A reference-counted pointer to a const eq::Client.
Definition: eq/types.h:213
A command specialization for config events.
Definition: eventICommand.h:41
An interface to process system messages or events.
Definition: messagePump.h:27
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: init.h:58
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
A layout groups one or more View, logically belonging together.
Definition: layout.h:49
fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor > Super
base class
Definition: config.h:65
An Observer looks at one or more views from a certain position (head matrix) with a given eye separat...
Definition: observer.h:40
Base data class for a configuration.
Definition: fabric/config.h:34
EQ_API bool exit()
De-initialize the Equalizer client library.