00001 00002 /* Copyright (c) 2005-2009, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 00004 * This library is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU Lesser General Public License version 2.1 as published 00006 * by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, but WITHOUT 00009 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00011 * details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this library; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 */ 00017 00018 #ifndef EQSERVER_SERVER_H 00019 #define EQSERVER_SERVER_H 00020 00021 #include "base.h" 00022 #include "types.h" 00023 #include "visitorResult.h" // enum 00024 00025 #include <eq/client/nodeType.h> // for TYPE_EQ_SERVER enum 00026 00027 #include <eq/net/command.h> // used in inline method 00028 #include <eq/net/commandQueue.h> // member 00029 #include <eq/net/node.h> // base class & eqsStartLocalServer declaration 00030 00031 namespace eq 00032 { 00041 namespace server 00042 { 00043 class ConstServerVisitor; 00044 class ServerVisitor; 00045 00049 class Server : public net::Node 00050 { 00051 public: 00055 EQSERVER_EXPORT Server(); 00056 00063 EQSERVER_EXPORT bool run(); 00064 00065 void registerConfig( Config* config ); 00066 00072 EQSERVER_EXPORT void addConfig( Config* config ); 00073 00081 bool removeConfig( Config* config ); 00082 00084 const ConfigVector& getConfigs() const { return _configs; } 00085 00087 net::CommandQueue* getServerThreadQueue() 00088 { return &_serverThreadQueue; } 00089 00096 EQSERVER_EXPORT VisitorResult accept( ServerVisitor& visitor ); 00097 EQSERVER_EXPORT VisitorResult accept( ConstServerVisitor& ) const; 00098 00099 protected: 00100 virtual ~Server(); 00101 00103 virtual bool dispatchCommand( net::Command& command ); 00104 00106 virtual net::CommandResult invokeCommand( net::Command& command ); 00107 00108 private: 00110 uint32_t _configID; 00111 00113 ConfigVector _configs; 00114 00115 typedef stde::hash_map< uint32_t, Config* > ConfigHash; 00117 ConfigHash _appConfigs; 00118 00120 net::CommandQueue _serverThreadQueue; 00121 00123 bool _running; 00124 00125 union // placeholder for binary-compatible changes 00126 { 00127 char dummy[64]; 00128 }; 00129 00131 virtual uint32_t getType() const { return eq::TYPE_EQ_SERVER; } 00132 00133 void _handleCommands(); 00134 00136 net::CommandResult _cmdChooseConfig( net::Command& command ); 00137 net::CommandResult _cmdUseConfig( net::Command& command ); 00138 net::CommandResult _cmdReleaseConfig( net::Command& command ); 00139 net::CommandResult _cmdShutdown( net::Command& command ); 00140 }; 00141 00142 EQSERVER_EXPORT std::ostream& operator << ( std::ostream&, const Server* ); 00143 } 00144 } 00145 #endif // EQSERVER_SERVER_H
0.9 by
1.5.8