lib/client/server.h

00001 
00002 /* Copyright (c) 2005-2008, 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 EQ_SERVER_H
00019 #define EQ_SERVER_H
00020 
00021 #include <eq/client/nodeType.h>  // for TYPE_EQ_SERVER enum
00022 #include <eq/client/types.h>     // basic typedefs
00023 
00024 #include <eq/net/node.h>         // base class
00025 
00026 namespace eq
00027 {
00028     class Client;
00029     class Config;
00030     class ConfigParams;
00031     class Node;
00032     struct ServerPacket;
00033 
00042     class Server : public net::Node
00043     {
00044     public:
00046         EQ_EXPORT Server();
00047 
00050         void setClient( ClientPtr client );
00051         ClientPtr getClient(){ return _client; }
00052 
00053         EQ_EXPORT net::CommandQueue* getNodeThreadQueue();
00054         EQ_EXPORT net::CommandQueue* getCommandThreadQueue();
00056 
00064         EQ_EXPORT Config* chooseConfig( const ConfigParams& parameters );
00065 
00067         EQ_EXPORT Config* useConfig( const ConfigParams& parameters, 
00068                                      const std::string& config );
00069 
00078         EQ_EXPORT void releaseConfig( Config* config );
00079 
00081         EQ_EXPORT bool shutdown();
00082 
00083     protected:
00087         EQ_EXPORT virtual ~Server();
00088 
00089     private:
00091         ClientPtr _client;
00092         friend class Client; // to call invokeCommand()
00093 
00095         bool _localServer;
00096 
00097         union // placeholder for binary-compatible changes
00098         {
00099             char dummy[64];
00100         };
00101 
00103         virtual uint32_t getType() const { return TYPE_EQ_SERVER; }
00104 
00105         /* The command handler functions. */
00106         net::CommandResult _cmdCreateConfig( net::Command& command );
00107         net::CommandResult _cmdDestroyConfig( net::Command& command );
00108         net::CommandResult _cmdChooseConfigReply( net::Command& command );
00109         net::CommandResult _cmdReleaseConfigReply( net::Command& command );
00110         net::CommandResult _cmdShutdownReply( net::Command& command );
00111     };
00112 
00113     inline std::ostream& operator << ( std::ostream& os, const Server* server )
00114     {
00115         if( !server )
00116         {
00117             os << "NULL server";
00118             return os;
00119         }
00120 
00121         os << "server " << (void*)server;
00122         return os;
00123     }
00124 }
00125 
00126 #endif // EQ_SERVER_H
00127 
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8