Equalizer  2.0.0
Parallel Rendering Framework
config.h
1 
2 /* Copyright (c) 2005-2016, 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 <eq/fabric/config.h> // base class
27 #include <co/objectHandler.h> // base class
28 
29 namespace eq
30 {
31 namespace detail { class Config; }
32 
55 class Config : public fabric::Config< Server, Config, Observer, Layout, Canvas,
56  Node, ConfigVisitor >,
57  public co::ObjectHandler
58 {
59 public:
62 
64  EQ_API explicit Config( ServerPtr parent );
65 
67  EQ_API virtual ~Config();
68 
72  EQ_API ClientPtr getClient();
73 
75  EQ_API ConstClientPtr getClient() const;
76 
81  EQ_API co::NodePtr getApplicationNode();
82 
83  EQ_API co::CommandQueue* getMainThreadQueue();
84  EQ_API co::CommandQueue* getCommandThreadQueue();
85 
87  EQ_API uint32_t getCurrentFrame() const;
88 
90  EQ_API uint32_t getFinishedFrame() const;
91 
93  EQ_API GLStats::Data getStatistics() const;
94 
100  EQ_API bool isRunning() const;
101 
103  EQ_API void stopRunning();
104 
115  EQ_API int64_t getTime() const;
116 
118  EQ_API MessagePump* getMessagePump();
119 
121  const Channel* findChannel( const std::string& name ) const
122  { return find< Channel >( name ); }
124 
150  EQ_API virtual bool init( const uint128_t& initID );
151 
166  EQ_API virtual bool exit();
167 
187  EQ_API bool update();
188 
190  EQ_API void setLatency( const uint32_t latency ) override;
192 
202  EQ_API bool registerObject( co::Object* object ) override;
203 
213  EQ_API void deregisterObject( co::Object* object ) override;
214 
222  EQ_API virtual bool mapObject( co::Object* object, const uint128_t& id,
223  const uint128_t& version = co::VERSION_OLDEST );
224 
225 
227  EQ_API virtual uint32_t mapObjectNB( co::Object* object, const uint128_t& id,
228  const uint128_t& version = co::VERSION_OLDEST );
229 
231  EQ_API uint32_t mapObjectNB( co::Object* object,
232  const uint128_t& id,
233  const uint128_t& version,
234  co::NodePtr master ) override;
235 
237  EQ_API bool mapObjectSync( const uint32_t requestID ) override;
238 
246  EQ_API void unmapObject( co::Object* object ) override;
247 
254  EQ_API f_bool_t syncObject( co::Object* object, const uint128_t& id,
255  co::NodePtr master,
256  const uint32_t instanceID = CO_INSTANCE_ALL)
257  override;
259 
278  EQ_API virtual uint32_t startFrame( const uint128_t& frameID );
279 
295  EQ_API virtual uint32_t finishFrame();
296 
306  EQ_API virtual uint32_t finishAllFrames();
307 
319  EQ_API void releaseFrameLocal( const uint32_t frameNumber );
320 
330  EQ_API void stopFrames();
331 
333 
347  EQ_API EventOCommand sendEvent( const uint32_t type );
348 
356  EQ_API EventOCommand sendError( const uint32_t type, const Error& error );
357 
361  EQ_API Errors getErrors();
362 
376  EQ_API EventICommand getNextEvent( const uint32_t timeout =
377  LB_TIMEOUT_INDEFINITE ) const;
378 
386  EQ_API virtual bool handleEvent( EventICommand command );
387  EQ_API virtual bool handleEvent( EventType type, const Event& event );
388  EQ_API virtual bool handleEvent( EventType type, const SizeEvent& event );
389  EQ_API virtual bool handleEvent( EventType type, const PointerEvent& event);
390  EQ_API virtual bool handleEvent( EventType type, const KeyEvent& event );
391  EQ_API virtual bool handleEvent( EventType type, const AxisEvent& event );
392  EQ_API virtual bool handleEvent( EventType type, const ButtonEvent& event );
393 
395  EQ_API bool checkEvent() const;
396 
406  EQ_API virtual void handleEvents();
407 
414  EQ_API virtual void addStatistic( const Statistic& stat );
416 
422  void setupMessagePump( Pipe* pipe );
423 
425  void setupServerConnections( const std::string& connectionData );
426 
427 protected:
429  EQ_API void attach( const uint128_t& id,
430  const uint32_t instanceID ) override;
431 
432  EQ_API void notifyAttached() override;
433  EQ_API void notifyDetach() override;
434 
435  EQ_API void changeLatency( const uint32_t latency ) override;
436  EQ_API bool mapViewObjects() const override;
437 
438 private:
439  detail::Config* const _impl;
440 
441  void _frameStart();
442  friend class Node;
443 
444  bool _needsLocalSync() const;
445 
447  void _updateStatistics();
448 
451  void _releaseObjects();
452 
454  void _exitMessagePump();
455 
457  bool _cmdSyncClock( co::ICommand& command );
458  bool _cmdCreateNode( co::ICommand& command );
459  bool _cmdDestroyNode( co::ICommand& command );
460  bool _cmdInitReply( co::ICommand& command );
461  bool _cmdExitReply( co::ICommand& command );
462  bool _cmdUpdateVersion( co::ICommand& command );
463  bool _cmdUpdateReply( co::ICommand& command );
464  bool _cmdReleaseFrameLocal( co::ICommand& command );
465  bool _cmdFrameFinish( co::ICommand& command );
466  bool _cmdSwapObject( co::ICommand& command );
467 };
468 }
469 
470 #endif // EQ_CONFIG_H
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:42
A configuration is a visualization session driven by an application.
Definition: config.h:55
Proxy object for the connection to an Equalizer server.
Definition: server.h:40
A canvas represents a logical 2D projection surface.
Definition: canvas.h:50
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:49
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: eq/types.h:215
A command specialization for config events.
Definition: eventICommand.h:38
An interface to process system messages or events.
Definition: messagePump.h:27
lunchbox::RefPtr< Client > ClientPtr
A reference-counted pointer to an eq::Client.
Definition: eq/types.h:211
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
A layout groups one or more View, logically belonging together.
Definition: layout.h:46
An Observer looks at one or more views from a certain position (head matrix) with a given eye separat...
Definition: observer.h:37
Base data class for a configuration.
Definition: fabric/config.h:34
fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor > Super
base class
Definition: config.h:61
EQ_API bool exit()
De-initialize the Equalizer client library.
lunchbox::RefPtr< const Client > ConstClientPtr
A reference-counted pointer to a const eq::Client.
Definition: eq/types.h:213