changed: gcc8 base update
[opensg.git] / Source / System / Cluster / Window / Base / OSGClusterWindow.h
blob077f6dcc31c26b2858766eb820f5466aaee824b9
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 _OSGCLUSTERWINDOW_H_
40 #define _OSGCLUSTERWINDOW_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGClusterWindowBase.h"
46 #include "OSGStatElemTypes.h"
48 #include <boost/function.hpp>
50 OSG_BEGIN_NAMESPACE
52 class StatCollector;
53 class Connection;
54 class ClusterServer;
55 class RemoteAspect;
56 class ClusterNetwork;
57 OSG_GEN_MEMOBJPTR(ClusterNetwork);
58 class RenderActionBase;
60 /*! \ingroup GrpClusterWindowObj
61 \ingroup GrpLibOSGCluster
62 \includebasedoc
65 class OSG_CLUSTER_DLLMAPPING ClusterWindow : public ClusterWindowBase
67 private:
69 /*========================== PUBLIC =================================*/
71 public:
73 typedef ClusterWindowBase Inherited;
75 /*---------------------------------------------------------------------*/
76 /*! \name window functions */
77 /*! \{ */
79 virtual void changed(ConstFieldMaskArg whichField,
80 UInt32 origin,
81 BitVector detail);
83 /*! \} */
84 /*---------------------------------------------------------------------*/
85 /*! \name Output */
86 /*! \{ */
88 virtual void dump( UInt32 uiIndent = 0,
89 const BitVector bvFlags = 0) const;
91 /*! \} */
92 /*---------------------------------------------------------------------*/
93 /*! \name GL implementation functions */
94 /*! \{ */
96 #if 0
97 virtual void(*getFunctionByName (const Char8 *s))();
98 #endif
100 /*! \} */
101 /*---------------------------------------------------------------------*/
102 /*! \name Window system implementation functions */
103 /*! \{ */
105 virtual void init(GLInitFunctor oFunc = GLInitFunctor());
107 virtual void render (RenderActionBase *action);
109 /*! \} */
110 /*---------------------------------------------------------------------*/
111 /*! \name Window system implementation functions */
112 /*! \{ */
114 virtual void activate (void);
115 virtual void deactivate(void);
116 virtual bool swap (void);
118 virtual void terminate (void);
120 /*! \} */
121 /*---------------------------------------------------------------------*/
122 /*! \name asynchronous initialization */
123 /*! \{ */
125 typedef boost::function<bool (const std::string &msg,
126 const std::string &server,
127 Real32 progress)> ConnectionCB;
129 bool initAsync (const ConnectionCB &fp);
130 void setConnectionCB(const ConnectionCB &fp);
132 /*! \} */
133 /*---------------------------------------------------------------------*/
134 /*! \name connection pool */
135 /*! \{ */
137 ClusterNetwork *getNetwork(void);
139 /*! \} */
140 /*---------------------------------------------------------------------*/
141 /*! \name Statistics */
142 /*! \{ */
144 StatCollector *getStatistics(void ) const;
145 void setStatistics(StatCollector *stat);
147 /*! \} */
148 /*---------------------------------------------------------------------*/
149 /*! \name static stat elem */
150 /*! \{ */
152 static StatElemDesc<StatTimeElem> statActivateTime;
153 static StatElemDesc<StatTimeElem> statFrameInitTime;
154 static StatElemDesc<StatTimeElem> statRAVTime;
155 static StatElemDesc<StatTimeElem> statSwapTime;
156 static StatElemDesc<StatTimeElem> statFrameExitTime;
158 /*! \} */
159 /*---------------------------------------------------------------------*/
160 /*! \name Calibration */
161 /*! \{ */
163 /*! \} */
164 /*---------------------------------------------------------------------*/
165 /*! \name Exceptions */
166 /*! \{ */
168 /*! \nohierarchy
171 class OSG_CLUSTER_DLLMAPPING AsyncCancel : public Exception
173 public:
174 AsyncCancel();
177 /*! \} */
178 /*========================= PROTECTED ===============================*/
180 protected:
182 /*---------------------------------------------------------------------*/
183 /*! \name client window funcitons */
184 /*! \{ */
186 virtual void clientInit (void );
187 virtual void clientPreSync(void );
189 virtual void clientRender (RenderActionBase *action);
190 virtual void clientSwap (void );
192 /*! \} */
193 /*---------------------------------------------------------------------*/
194 /*! \name server window funcitons */
195 /*! \{ */
197 virtual void serverInit (Window *window,
198 UInt32 id );
199 virtual void serverRender(Window *window,
200 UInt32 id,
201 RenderActionBase *action);
202 virtual void serverSwap (Window *window,
203 UInt32 id );
205 /*! \} */
206 /*---------------------------------------------------------------------*/
207 /*! \name Constructors / Destructor */
208 /*! \{ */
210 ClusterWindow(void);
211 ClusterWindow(const ClusterWindow &source);
213 virtual ~ClusterWindow(void);
215 /*! \} */
216 /*---------------------------------------------------------------------*/
217 /*! \name unsynced thread variables */
218 /*! \{ */
220 bool _firstFrame;
221 StatCollector *_statistics;
223 /*! \} */
224 /*---------------------------------------------------------------------*/
225 /*! \name Window system implementation functions */
226 /*! \{ */
228 virtual void doFrameInit (bool reinitExtFuctions = false);
229 virtual void doFrameExit (void );
230 virtual void doActivate (void );
231 virtual void doDeactivate (void );
232 virtual bool doSwap (void );
234 virtual void doRenderAllViewports(RenderActionBase *action );
236 virtual bool hasContext (void );
238 /*! \} */
239 /*---------------------------------------------------------------------*/
240 /*! \name init method */
241 /*! \{ */
243 static void initMethod(InitPhase ePhase);
244 static void exitMethod(InitPhase ePhase);
246 /*! \} */
247 /*========================== PRIVATE ================================*/
249 private:
251 /*---------------------------------------------------------------------*/
252 /*! \name private members */
253 /*! \{ */
255 ConnectionCB _connectionFP;
256 ClusterNetworkRefPtr _network;
258 /*! \} */
259 /*---------------------------------------------------------------------*/
261 friend class FieldContainer;
262 friend class ClusterWindowBase;
263 friend class ClusterServer;
264 friend class ClusterClient;
266 // prohibit default functions (move to 'public' if you need one)
267 void operator =(const ClusterWindow &source);
270 typedef ClusterWindow *ClusterWindowP;
272 OSG_END_NAMESPACE
274 #include "OSGClusterWindow.inl"
275 #include "OSGClusterWindowBase.inl"
277 #endif /* _OSGCLUSTERWINDOW_H_ */