Equalizer  1.2.1
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 #include <eq/fabric/visitorResult.h> // enum
00025 
00026 #include <co/types.h>
00027 
00028 namespace eq
00029 {
00030 namespace fabric
00031 {
00033     template< class CL, class S, class CFG, class NF, class N, class V >
00034     class Server : public N
00035     {
00036     public:
00038         typedef co::base::RefPtr< CL > ClientPtr;
00040         typedef co::base::RefPtr< const CL > ConstClientPtr;
00042         typedef std::vector< CFG* > Configs;
00044         typedef NF NodeFactory;
00045 
00046         virtual void setClient( ClientPtr client ); 
00047 
00049         ClientPtr getClient() { return _client; }
00050 
00052         ConstClientPtr getClient() const { return _client; }
00053 
00055         const Configs& getConfigs() const { return _configs; }
00056 
00064         EQFABRIC_INL VisitorResult accept( V& visitor );
00065 
00067         EQFABRIC_INL VisitorResult accept( V& visitor ) const;
00068 
00070         NF* getNodeFactory() { return _nodeFactory; }
00071 
00072     protected:
00074         Server( NF* nodeFactory );
00075 
00077         virtual ~Server();
00078 
00080         void _addConfig( CFG* config );
00081 
00083         bool _removeConfig( CFG* config );
00084 
00085     private:
00086         NF* const _nodeFactory; 
00087 
00089         ClientPtr _client;
00090 
00092         Configs _configs;
00093 
00094         struct Private;
00095         Private* _private; // placeholder for binary-compatible changes
00096 
00098         virtual uint32_t getType() const { return NODETYPE_EQ_SERVER; }
00099 
00100         template< class, class, class, class, class, class, class >
00101         friend class Config;
00102 
00103         /* The command handler functions. */
00104         bool _cmdCreateConfig( co::Command& command );
00105         bool _cmdDestroyConfig( co::Command& command );
00106     };
00107 
00108     template< class CL, class S, class CFG, class NF, class N, class V >
00109     EQFABRIC_INL std::ostream& 
00110     operator << ( std::ostream&, const Server< CL, S, CFG, NF, N, V >& );
00111 }
00112 }
00113 
00114 #endif // EQFABRIC_SERVER_H
00115 
Generated on Fri Jun 8 2012 15:44:32 for Equalizer 1.2.1 by  doxygen 1.8.0