Equalizer  2.1.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 <co/types.h>
22 #include <eq/fabric/api.h>
23 #include <eq/fabric/nodeType.h> // for NODETYPE_EQ_SERVER enum
24 #include <eq/fabric/types.h> // basic typedefs
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; }
49  ConstClientPtr getClient() const { return _client; }
51  const Configs& getConfigs() const { return _configs; }
59  EQFABRIC_INL VisitorResult accept(V& visitor);
60 
62  EQFABRIC_INL VisitorResult accept(V& visitor) const;
63 
65  NF* getNodeFactory() { return _nodeFactory; }
66 protected:
68  explicit Server(NF* nodeFactory);
69 
71  virtual ~Server();
72 
74  void _addConfig(CFG* config);
75 
77  bool _removeConfig(CFG* config);
78 
79 private:
80  NF* const _nodeFactory;
81 
83  ClientPtr _client;
84 
86  Configs _configs;
87 
88  struct Private;
89  Private* _private; // placeholder for binary-compatible changes
90 
91  template <class, class, class, class, class, class, class>
92  friend class Config;
93 
94  /* The command handler functions. */
95  bool _cmdCreateConfig(co::ICommand& command);
96  bool _cmdDestroyConfig(co::ICommand& command);
97 };
98 
99 template <class CL, class S, class CFG, class NF, class N, class V>
100 EQFABRIC_INL std::ostream& operator<<(std::ostream&,
102 }
103 }
104 
105 #endif // EQFABRIC_SERVER_H
ConstClientPtr getClient() const
Definition: fabric/server.h:49
Defines export visibility macros for library EqualizerFabric.
ClientPtr getClient()
Definition: fabric/server.h:47
const Configs & getConfigs() const
Definition: fabric/server.h:51
Base co::Node class for a server.
Definition: fabric/server.h:32
std::vector< CFG * > Configs
A vector of config pointers.
Definition: fabric/server.h:40
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.
std::ostream & operator<<(std::ostream &os, const AxisEvent &event)
Print the axis event to the given output stream.
Definition: axisEvent.h:49
lunchbox::RefPtr< CL > ClientPtr
A reference-counted pointer to the client.
Definition: fabric/server.h:36
Base data class for a configuration.
Definition: fabric/config.h:34
lunchbox::RefPtr< const CL > ConstClientPtr
A reference-counted const pointer to the client.
Definition: fabric/server.h:38