Equalizer
1.4.1
|
00001 00002 /* Copyright (c) 2005-2012, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 2010, Cedric Stalder <cedric Stalder@gmail.com> 00004 * 00005 * This library is free software; you can redistribute it and/or modify it under 00006 * the terms of the GNU Lesser General Public License version 2.1 as published 00007 * by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this library; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00017 */ 00018 00019 #ifndef EQ_CONFIG_H 00020 #define EQ_CONFIG_H 00021 00022 #include <eq/client/api.h> 00023 #include <eq/client/types.h> 00024 00025 #include <eq/fabric/config.h> // base class 00026 #include <co/objectHandler.h> // base class 00027 00028 namespace eq 00029 { 00030 namespace detail { class Config; } 00031 00054 class Config : public fabric::Config< Server, Config, Observer, Layout, 00055 Canvas, Node, ConfigVisitor >, 00056 public co::ObjectHandler 00057 { 00058 public: 00059 typedef fabric::Config< Server, Config, Observer, Layout, Canvas, Node, 00060 ConfigVisitor > Super; 00061 00063 EQ_API Config( ServerPtr parent ); 00064 00066 EQ_API virtual ~Config(); 00067 00071 EQ_API ClientPtr getClient(); 00072 00074 EQ_API ConstClientPtr getClient() const; 00075 00080 EQ_API co::NodePtr getApplicationNode(); 00081 00082 EQ_API co::CommandQueue* getMainThreadQueue(); 00083 EQ_API co::CommandQueue* getCommandThreadQueue(); 00084 00086 EQ_API uint32_t getCurrentFrame() const; 00087 00089 EQ_API uint32_t getFinishedFrame() const; 00090 00092 EQ_API void getStatistics( std::vector< FrameStatistics >& stats ); 00093 00099 EQ_API bool isRunning() const; 00100 00102 EQ_API void stopRunning(); 00103 00115 EQ_API int64_t getTime() const; 00116 00118 MessagePump* getMessagePump(); 00119 00121 const Channel* findChannel( const std::string& name ) const 00122 { return find< Channel >( name ); } 00124 00150 EQ_API virtual bool init( const uint128_t& initID ); 00151 00168 EQ_API virtual bool exit(); 00169 00190 EQ_API bool update(); 00191 00193 EQ_API virtual void setLatency( const uint32_t latency ); 00195 00205 EQ_API virtual bool registerObject( co::Object* object ); 00206 00216 EQ_API virtual void deregisterObject( co::Object* object ); 00217 00225 EQ_API virtual bool mapObject( co::Object* object, const UUID& id, 00226 const uint128_t& version = co::VERSION_OLDEST ); 00227 00228 00230 EQ_API virtual uint32_t mapObjectNB( co::Object* object, const UUID& id, 00231 const uint128_t& version = co::VERSION_OLDEST ); 00232 00237 EQ_API virtual uint32_t mapObjectNB( co::Object* object, const UUID& id, 00238 const uint128_t& version, co::NodePtr master ); 00239 00241 EQ_API virtual bool mapObjectSync( const uint32_t requestID ); 00242 00250 EQ_API virtual void unmapObject( co::Object* object ); 00251 00253 EQ_API void releaseObject( co::Object* object ); 00255 00275 EQ_API virtual uint32_t startFrame( const uint128_t& frameID ); 00276 00292 EQ_API virtual uint32_t finishFrame(); 00293 00303 EQ_API virtual uint32_t finishAllFrames(); 00304 00317 EQ_API void releaseFrameLocal( const uint32_t frameNumber ); 00318 00328 EQ_API void stopFrames(); 00329 00331 00340 EQ_API void sendEvent( ConfigEvent& event ); 00341 00354 EQ_API const ConfigEvent* nextEvent(); 00355 00367 EQ_API const ConfigEvent* tryNextEvent(); 00368 00370 EQ_API bool checkEvent() const; 00371 00382 EQ_API virtual void handleEvents(); 00383 00391 EQ_API virtual bool handleEvent( const ConfigEvent* event ); 00393 00399 void setupMessagePump( Pipe* pipe ); 00400 00402 void setupServerConnections( const char* connectionData ); 00403 00404 protected: 00406 EQ_API virtual void attach( const UUID& id, 00407 const uint32_t instanceID ); 00408 00409 EQ_API virtual void notifyAttached(); 00410 EQ_API virtual void notifyDetach(); 00411 00412 EQ_API virtual void changeLatency( const uint32_t latency ); 00413 EQ_API virtual bool mapViewObjects() const; 00414 00415 private: 00416 detail::Config* const _impl; 00417 00418 void _frameStart(); 00419 friend class Node; 00420 00421 bool _needsLocalSync() const; 00422 00427 void _updateStatistics( const uint32_t finishedFrame ); 00428 00431 void _releaseObjects(); 00432 00434 void _exitMessagePump(); 00435 00437 bool _cmdSyncClock( co::Command& command ); 00438 bool _cmdCreateNode( co::Command& command ); 00439 bool _cmdDestroyNode( co::Command& command ); 00440 bool _cmdInitReply( co::Command& command ); 00441 bool _cmdExitReply( co::Command& command ); 00442 bool _cmdUpdateVersion( co::Command& command ); 00443 bool _cmdUpdateReply( co::Command& command ); 00444 bool _cmdReleaseFrameLocal( co::Command& command ); 00445 bool _cmdFrameFinish( co::Command& command ); 00446 bool _cmdSwapObject( co::Command& command ); 00447 }; 00448 } 00449 00450 #endif // EQ_CONFIG_H 00451