Equalizer 1.0

fabric/server.h

00001 
00002 /* Copyright (c) 2010, Stefan Eilemann <eile@eyescale.ch> 
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 EQFABRIC_SERVER_H
00019 #define EQFABRIC_SERVER_H
00020 
00021 #include <eq/fabric/api.h>
00022 #include <eq/fabric/types.h>     // basic typedefs
00023 #include <eq/fabric/nodeType.h>  // for NODETYPE_EQ_SERVER enum
00024 
00025 #include <co/types.h>
00026 
00027 namespace eq
00028 {
00029 namespace fabric
00030 {
00032     template< class CL, class S, class CFG, class NF, class N >
00033     class Server : public N
00034     {
00035     public:
00037         typedef co::base::RefPtr< CL > ClientPtr;
00039         typedef co::base::RefPtr< const CL > ConstClientPtr;
00041         typedef std::vector< CFG* > Configs;
00043         typedef NF NodeFactory;
00044 
00045         virtual void setClient( ClientPtr client ); 
00046 
00048         ClientPtr getClient() { return _client; }
00049 
00051         ConstClientPtr getClient() const { return _client; }
00052 
00054         const Configs& getConfigs() const { return _configs; }
00055 
00057         NF* getNodeFactory() { return _nodeFactory; }
00058 
00059     protected:
00061         Server( NF* nodeFactory );
00062 
00064         virtual ~Server();
00065 
00067         void _addConfig( CFG* config );
00068 
00070         bool _removeConfig( CFG* config );
00071 
00072     private:
00073         NF* const _nodeFactory; 
00074 
00076         ClientPtr _client;
00077 
00079         Configs _configs;
00080 
00081         struct Private;
00082         Private* _private; // placeholder for binary-compatible changes
00083 
00085         virtual uint32_t getType() const { return NODETYPE_EQ_SERVER; }
00086 
00087         template< class, class, class, class, class, class, class >
00088         friend class Config;
00089 
00090         /* The command handler functions. */
00091         bool _cmdCreateConfig( co::Command& command );
00092         bool _cmdDestroyConfig( co::Command& command );
00093     };
00094 
00095     template< class CL, class S, class CFG, class NF, class N > EQFABRIC_INL
00096     std::ostream& operator << ( std::ostream&, const Server< CL, S, CFG, NF, N>& );
00097 }
00098 }
00099 
00100 #endif // EQFABRIC_SERVER_H
00101 
Generated on Sun May 8 2011 19:11:07 for Equalizer 1.0 by  doxygen 1.7.3