Equalizer  1.4.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 <lunchbox/types.h>
00027 #include <co/types.h>
00028 
00029 namespace eq
00030 {
00031 namespace fabric
00032 {
00034     template< class CL, class S, class CFG, class NF, class N, class V >
00035     class Server : public N
00036     {
00037     public:
00039         typedef lunchbox::RefPtr< CL > ClientPtr;
00041         typedef lunchbox::RefPtr< const CL > ConstClientPtr;
00043         typedef std::vector< CFG* > Configs;
00045         typedef NF NodeFactory;
00046 
00047         virtual void setClient( ClientPtr client ); 
00048 
00050         ClientPtr getClient() { return _client; }
00051 
00053         ConstClientPtr getClient() const { return _client; }
00054 
00056         const Configs& getConfigs() const { return _configs; }
00057 
00065         EQFABRIC_INL VisitorResult accept( V& visitor );
00066 
00068         EQFABRIC_INL VisitorResult accept( V& visitor ) const;
00069 
00071         NF* getNodeFactory() { return _nodeFactory; }
00072 
00073     protected:
00075         Server( NF* nodeFactory );
00076 
00078         virtual ~Server();
00079 
00081         void _addConfig( CFG* config );
00082 
00084         bool _removeConfig( CFG* config );
00085 
00086     private:
00087         NF* const _nodeFactory; 
00088 
00090         ClientPtr _client;
00091 
00093         Configs _configs;
00094 
00095         struct Private;
00096         Private* _private; // placeholder for binary-compatible changes
00097 
00099         virtual uint32_t getType() const { return NODETYPE_EQ_SERVER; }
00100 
00101         template< class, class, class, class, class, class, class >
00102         friend class Config;
00103 
00104         /* The command handler functions. */
00105         bool _cmdCreateConfig( co::Command& command );
00106         bool _cmdDestroyConfig( co::Command& command );
00107     };
00108 
00109     template< class CL, class S, class CFG, class NF, class N, class V >
00110     EQFABRIC_INL std::ostream& 
00111     operator << ( std::ostream&, const Server< CL, S, CFG, NF, N, V >& );
00112 }
00113 }
00114 
00115 #endif // EQFABRIC_SERVER_H
00116 
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1