Equalizer  1.12.0
Parallel Rendering Framework
fabric/server.h
1 
2 /* Copyright (c) 2010-2015, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_SERVER_H
19 #define EQFABRIC_SERVER_H
20 
21 #include <eq/fabric/api.h>
22 #include <eq/fabric/types.h> // basic typedefs
23 #include <eq/fabric/nodeType.h> // for NODETYPE_EQ_SERVER enum
24 #include <co/types.h>
25 
26 namespace eq
27 {
28 namespace fabric
29 {
31 template< class CL, class S, class CFG, class NF, class N, class V >
32 class Server : public N
33 {
34 public:
36  typedef lunchbox::RefPtr< CL > ClientPtr;
38  typedef lunchbox::RefPtr< const CL > ConstClientPtr;
40  typedef std::vector< CFG* > Configs;
42  typedef NF NodeFactory;
43 
44  virtual void setClient( ClientPtr client );
45 
47  ClientPtr getClient() { return _client; }
48 
50  ConstClientPtr getClient() const { return _client; }
51 
53  const Configs& getConfigs() const { return _configs; }
54 
62  EQFABRIC_INL VisitorResult accept( V& visitor );
63 
65  EQFABRIC_INL VisitorResult accept( V& visitor ) const;
66 
68  NF* getNodeFactory() { return _nodeFactory; }
69 
70 protected:
72  explicit Server( NF* nodeFactory );
73 
75  virtual ~Server();
76 
78  void _addConfig( CFG* config );
79 
81  bool _removeConfig( CFG* config );
82 
83 private:
84  NF* const _nodeFactory;
85 
87  ClientPtr _client;
88 
90  Configs _configs;
91 
92  struct Private;
93  Private* _private; // placeholder for binary-compatible changes
94 
95  template< class, class, class, class, class, class, class >
96  friend class Config;
97 
98  /* The command handler functions. */
99  bool _cmdCreateConfig( co::ICommand& command );
100  bool _cmdDestroyConfig( co::ICommand& command );
101 };
102 
103 template< class CL, class S, class CFG, class NF, class N, class V >
104 EQFABRIC_INL std::ostream&
105 operator << ( std::ostream&, const Server< CL, S, CFG, NF, N, V >& );
106 }
107 }
108 
109 #endif // EQFABRIC_SERVER_H
A configuration is a visualization session driven by an application.
Definition: config.h:55
Proxy object for the connection to an Equalizer server.
Definition: server.h:40
ConstClientPtr getClient() const
Definition: fabric/server.h:50
Defines export visibility macros for library EqualizerFabric.
std::vector< CFG * > Configs
A vector of config pointers.
Definition: fabric/server.h:40
ClientPtr getClient()
Definition: fabric/server.h:47
const Configs & getConfigs() const
Definition: fabric/server.h:53
Base co::Node class for a server.
Definition: fabric/server.h:32
NF NodeFactory
The node factory.
Definition: fabric/server.h:42
The Equalizer client library.
Definition: eq/agl/types.h:23
EQFABRIC_INL VisitorResult accept(V &visitor)
Traverse this server and all children using a server visitor.
lunchbox::RefPtr< CL > ClientPtr
A reference-counted pointer to the client.
Definition: fabric/server.h:36
lunchbox::RefPtr< const CL > ConstClientPtr
A reference-counted const pointer to the client.
Definition: fabric/server.h:38