fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Cluster / Server / OSGClusterServer.h
blobd81f7848e79aff51e94ade4f4c7856a579f62f0e
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _CLUSTERSERVER_H_
40 #define _CLUSTERSERVER_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGClusterDef.h"
46 #include "OSGClusterWindow.h"
48 OSG_BEGIN_NAMESPACE
50 class PointConnection;
51 class ClusterWindow;
52 class RemoteAspect;
54 /*! \ingroup GrpClusterBase
55 \ingroup GrpLibOSGCluster
58 class OSG_CLUSTER_DLLMAPPING ClusterServer
60 /*========================== PUBLIC =================================*/
62 public:
64 /*---------------------------------------------------------------------*/
65 /*! \name Constructors */
66 /*! \{ */
68 ClusterServer( Window *window,
69 const std::string &serviceName,
70 const std::string &connectionType = "StreamSock",
71 const std::string &address = "",
72 UInt32 servicePort = 8437,
73 const std::string &serviceGroup = "");
75 /*! \} */
76 /*---------------------------------------------------------------------*/
77 /*! \name Destructor */
78 /*! \{ */
80 virtual ~ClusterServer(void);
82 /*! \} */
83 /*---------------------------------------------------------------------*/
84 /*! \name server actions */
85 /*! \{ */
87 void start (void );
88 void stop (void );
89 #ifdef OSG_OLD_RENDER_ACTION
90 void render (DrawActionBase *action );
91 #endif
93 #ifdef OSG_OLD_RENDER_ACTION
94 void doRender(DrawActionBase *action );
95 #endif
97 void render (RenderActionBase *action );
98 void doSync (bool applyToChangelist);
99 void doRender(RenderActionBase *action );
101 void doSwap (void );
103 /*! \} */
104 /*---------------------------------------------------------------------*/
105 /*! \name window access */
106 /*! \{ */
108 Window *getClusterWindow(void);
109 Window *getServerWindow (void);
111 RemoteAspect *getRemoteAspect (void) const;
112 UInt32 getServerId (void) const;
114 /*! \} */
115 /*---------------------------------------------------------------------*/
116 /*! \name set */
117 /*! \{ */
119 void setInterface(const std::string &interf);
121 /*! \} */
122 /*---------------------------------------------------------------------*/
123 /*! \name cluster server app init */
124 /*! \{ */
126 static void addInitFunction (InitFuncF initFunc);
127 static void addExitFunction (ExitFuncF exitFunc);
128 static bool init (Int32 argc,
129 Char8 **argv );
130 static bool exit (void );
132 /*! \} */
133 /*========================= PROTECTED ===============================*/
135 protected:
137 static std::vector<InitFuncF> *osgInitFunctions;
138 static std::vector<ExitFuncF> *osgExitFunctions;
140 /*---------------------------------------------------------------------*/
141 /*! \name ClusterWindow changed function */
142 /*! \{ */
144 bool windowChanged(FieldContainer * const fcp,
145 RemoteAspect * );
147 /*! \} */
148 /*---------------------------------------------------------------------*/
149 /*! \name Member */
150 /*! \{ */
152 WindowUnrecPtr _window;
153 PointConnection *_connection;
154 std::string _requestAddress;
155 std::string _boundAddress;
156 ClusterWindowUnrecPtr _clusterWindow;
157 RemoteAspect *_aspect;
158 std::string _serviceName;
159 std::string _connectionType;
160 UInt32 _servicePort;
161 std::string _serviceGroup;
162 UInt32 _serverId;
163 std::string _interface;
165 /*! \} */
166 /*========================== PRIVATE ================================*/
168 private:
170 /*---------------------------------------------------------------------*/
171 /*! \name helper function */
172 /*! \{ */
174 void acceptClient();
176 /*! \} */
177 /*---------------------------------------------------------------------*/
179 /*!\brief prohibit default function (move to 'public' if needed) */
180 ClusterServer(const ClusterServer &source);
181 /*!\brief prohibit default function (move to 'public' if needed) */
182 void operator =(const ClusterServer &source);
185 OSG_END_NAMESPACE
187 #include "OSGClusterServer.inl"
189 #endif /* _CLUSTERSERVER_H_ */