Equalizer  1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
client/config.h
1 
2 /* Copyright (c) 2005-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2010, Cedric Stalder <cedric Stalder@gmail.com>
4  * 2011-2012, 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/client/api.h>
24 #include <eq/client/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 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 
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 virtual void setLatency( const uint32_t latency );
192 
202  EQ_API virtual bool registerObject( co::Object* object );
203 
213  EQ_API virtual void deregisterObject( co::Object* object );
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 virtual uint32_t mapObjectNB( co::Object* object,
232  const uint128_t& id,
233  const uint128_t& version,
234  co::NodePtr master );
235 
237  EQ_API virtual bool mapObjectSync( const uint32_t requestID );
238 
246  EQ_API virtual void unmapObject( co::Object* object );
247 
254  EQ_API f_bool_t syncObject( co::Object* object, co::NodePtr master,
255  const uint128_t& id,
256  const uint32_t instanceID = CO_INSTANCE_ALL) override;
258 
277  EQ_API virtual uint32_t startFrame( const uint128_t& frameID );
278 
294  EQ_API virtual uint32_t finishFrame();
295 
305  EQ_API virtual uint32_t finishAllFrames();
306 
318  EQ_API void releaseFrameLocal( const uint32_t frameNumber );
319 
329  EQ_API void stopFrames();
330 
332 
335 #ifndef EQ_2_0_API
336 
348  EQ_API const ConfigEvent* nextEvent();
349 
361  EQ_API const ConfigEvent* tryNextEvent();
362 #endif
363 
373  EQ_API void sendEvent( ConfigEvent& event );
374 
386  EQ_API virtual bool handleEvent( const ConfigEvent* event );
387 
399  EQ_API EventOCommand sendEvent( const uint32_t type );
400 
409  EQ_API EventOCommand sendError( const uint32_t type,
410  const uint128_t& originator,
411  const uint32_t error );
425  EQ_API EventICommand getNextEvent( const uint32_t timeout =
426  LB_TIMEOUT_INDEFINITE ) const;
427 
435  EQ_API virtual bool handleEvent( EventICommand command );
436 
438  EQ_API bool checkEvent() const;
439 
449  EQ_API virtual void handleEvents();
450 
458  void addStatistic( const uint32_t originator, const Statistic& stat );
460 
466  void setupMessagePump( Pipe* pipe );
467 
469  void setupServerConnections( const std::string& connectionData );
470 
471 protected:
473  EQ_API virtual void attach( const uint128_t& id,
474  const uint32_t instanceID );
475 
476  EQ_API virtual void notifyAttached();
477  EQ_API virtual void notifyDetach();
478 
479  EQ_API virtual void changeLatency( const uint32_t latency );
480  EQ_API virtual bool mapViewObjects() const;
481 
482 private:
483  detail::Config* const _impl;
484 
485  void _frameStart();
486  friend class Node;
487 
488  bool _needsLocalSync() const;
489 
490  bool _handleNewEvent( EventICommand& command );
491  bool _handleEvent( const Event& event );
492  const ConfigEvent* _convertEvent( co::ObjectICommand command );
493 
495  void _updateStatistics();
496 
499  void _releaseObjects();
500 
502  void _exitMessagePump();
503 
505  bool _cmdSyncClock( co::ICommand& command );
506  bool _cmdCreateNode( co::ICommand& command );
507  bool _cmdDestroyNode( co::ICommand& command );
508  bool _cmdInitReply( co::ICommand& command );
509  bool _cmdExitReply( co::ICommand& command );
510  bool _cmdUpdateVersion( co::ICommand& command );
511  bool _cmdUpdateReply( co::ICommand& command );
512  bool _cmdReleaseFrameLocal( co::ICommand& command );
513  bool _cmdFrameFinish( co::ICommand& command );
514  bool _cmdSwapObject( co::ICommand& command );
515 };
516 }
517 
518 #endif // EQ_CONFIG_H
A statistics event.
Definition: statistic.h:36
virtual EQ_API bool mapObjectSync(const uint32_t requestID)
Finalize the mapping of a distributed object.
virtual EQ_API bool init(const uint128_t &initID)
Initialize this configuration.
A visitor to traverse configs and all children.
Definition: admin/types.h:30
A channel represents a two-dimensional viewport within a Window.
EQ_API bool isRunning() const
void addStatistic(const uint32_t originator, const Statistic &stat)
Add an statistic event to the statistics overlay.
A configuration is a visualization session driven by an application.
Definition: client/config.h:55
Proxy object for the connection to an Equalizer server.
Definition: client/server.h:40
A canvas represents a logical 2D projection surface.
Definition: client/canvas.h:50
EQ_API EventICommand getNextEvent(const uint32_t timeout=LB_TIMEOUT_INDEFINITE) const
Get the next event.
virtual EQ_API uint32_t finishFrame()
Finish the rendering of a frame.
EQ_API EventOCommand sendError(const uint32_t type, const uint128_t &originator, const uint32_t error)
Send an error event to the application node.
EQ_API uint32_t getCurrentFrame() const
EQ_API uint32_t getFinishedFrame() const
virtual EQ_API bool exit()
Exit this configuration.
EQ_API const ConfigEvent * nextEvent()
Get the next event.
A Pipe represents a graphics card (GPU) on a Node.
Definition: client/pipe.h:50
EQ_API bool update()
Update the configuration.
A Node represents a single computer in the cluster.
Definition: client/node.h:48
EQ_API void stopFrames()
Asynchronously signal all channels to interrupt their rendering.
virtual EQ_API uint32_t startFrame(const uint128_t &frameID)
Request a new frame of rendering.
virtual EQ_API uint32_t mapObjectNB(co::Object *object, const uint128_t &id, const uint128_t &version=co::VERSION_OLDEST)
Start mapping a distributed object.
virtual EQ_API uint32_t finishAllFrames()
Finish rendering all pending frames.
EQ_API int64_t getTime() const
Get the current time in milliseconds.
EQ_API void releaseFrameLocal(const uint32_t frameNumber)
Release the local synchronization of the config for a frame.
EQ_API void sendEvent(ConfigEvent &event)
Send an (old) event to the application node.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: client/types.h:214
A command specialization for config events.
Definition: eventICommand.h:38
MessagePump * getMessagePump()
An interface to process system messages or events.
Definition: messagePump.h:27
EQ_API bool checkEvent() const
virtual EQ_API ~Config()
Destruct a config.
virtual EQ_API bool mapObject(co::Object *object, const uint128_t &id, const uint128_t &version=co::VERSION_OLDEST)
Map a distributed object.
lunchbox::RefPtr< Client > ClientPtr
A reference-counted pointer to an eq::Client.
Definition: client/types.h:210
EQ_API Config(ServerPtr parent)
Construct a new config.
A layout groups one or more View, logically belonging together.
Definition: client/layout.h:46
EQ_API ClientPtr getClient()
EQ_API f_bool_t syncObject(co::Object *object, co::NodePtr master, const uint128_t &id, const uint32_t instanceID=CO_INSTANCE_ALL) override
Synchronize the local object with a remote object.
virtual EQ_API bool registerObject(co::Object *object)
Register a distributed object.
EQ_API co::NodePtr getApplicationNode()
An Observer looks at one or more views from a certain position (head matrix) with a given eye separat...
Base data class for a configuration.
Definition: fabric/config.h:33
virtual EQ_API void unmapObject(co::Object *object)
Unmap a mapped object.
Event structure to report window system and other events.
Definition: event.h:171
virtual EQ_API void setLatency(const uint32_t latency)
EQ_API void stopRunning()
Stop the config.
fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor > Super
base class
Definition: client/config.h:61
virtual EQ_API bool handleEvent(const ConfigEvent *event)
Handle one (old) config event.
virtual EQ_API void deregisterObject(co::Object *object)
Deregister a distributed object.
lunchbox::RefPtr< const Client > ConstClientPtr
A reference-counted pointer to a const eq::Client.
Definition: client/types.h:212
EQ_API const ConfigEvent * tryNextEvent()
Try to get the next event.
virtual EQ_API void handleEvents()
Handle all config events.