1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCLUSTERWINDOW_H_
40 #define _OSGCLUSTERWINDOW_H_
45 #include "OSGClusterWindowBase.h"
46 #include "OSGStatElemTypes.h"
48 #include <boost/function.hpp>
57 OSG_GEN_MEMOBJPTR(ClusterNetwork
);
58 class RenderActionBase
;
60 /*! \ingroup GrpClusterWindowObj
61 \ingroup GrpLibOSGCluster
65 class OSG_CLUSTER_DLLMAPPING ClusterWindow
: public ClusterWindowBase
69 /*========================== PUBLIC =================================*/
73 typedef ClusterWindowBase Inherited
;
75 /*---------------------------------------------------------------------*/
76 /*! \name window functions */
79 virtual void changed(ConstFieldMaskArg whichField
,
84 /*---------------------------------------------------------------------*/
88 virtual void dump( UInt32 uiIndent
= 0,
89 const BitVector bvFlags
= 0) const;
92 /*---------------------------------------------------------------------*/
93 /*! \name GL implementation functions */
97 virtual void(*getFunctionByName (const Char8
*s
))();
101 /*---------------------------------------------------------------------*/
102 /*! \name Window system implementation functions */
105 virtual void init(GLInitFunctor oFunc
= GLInitFunctor());
107 virtual void render (RenderActionBase
*action
);
110 /*---------------------------------------------------------------------*/
111 /*! \name Window system implementation functions */
114 virtual void activate (void);
115 virtual void deactivate(void);
116 virtual bool swap (void);
118 virtual void terminate (void);
121 /*---------------------------------------------------------------------*/
122 /*! \name asynchronous initialization */
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
);
133 /*---------------------------------------------------------------------*/
134 /*! \name connection pool */
137 ClusterNetwork
*getNetwork(void);
140 /*---------------------------------------------------------------------*/
141 /*! \name Statistics */
144 StatCollector
*getStatistics(void ) const;
145 void setStatistics(StatCollector
*stat
);
148 /*---------------------------------------------------------------------*/
149 /*! \name static stat elem */
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
;
159 /*---------------------------------------------------------------------*/
160 /*! \name Calibration */
164 /*---------------------------------------------------------------------*/
165 /*! \name Exceptions */
171 class OSG_CLUSTER_DLLMAPPING AsyncCancel
: public Exception
178 /*========================= PROTECTED ===============================*/
182 /*---------------------------------------------------------------------*/
183 /*! \name client window funcitons */
186 virtual void clientInit (void );
187 virtual void clientPreSync(void );
189 virtual void clientRender (RenderActionBase
*action
);
190 virtual void clientSwap (void );
193 /*---------------------------------------------------------------------*/
194 /*! \name server window funcitons */
197 virtual void serverInit (Window
*window
,
199 virtual void serverRender(Window
*window
,
201 RenderActionBase
*action
);
202 virtual void serverSwap (Window
*window
,
206 /*---------------------------------------------------------------------*/
207 /*! \name Constructors / Destructor */
211 ClusterWindow(const ClusterWindow
&source
);
213 virtual ~ClusterWindow(void);
216 /*---------------------------------------------------------------------*/
217 /*! \name unsynced thread variables */
221 StatCollector
*_statistics
;
224 /*---------------------------------------------------------------------*/
225 /*! \name Window system implementation functions */
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 );
239 /*---------------------------------------------------------------------*/
240 /*! \name init method */
243 static void initMethod(InitPhase ePhase
);
244 static void exitMethod(InitPhase ePhase
);
247 /*========================== PRIVATE ================================*/
251 /*---------------------------------------------------------------------*/
252 /*! \name private members */
255 ConnectionCB _connectionFP
;
256 ClusterNetworkRefPtr _network
;
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
;
274 #include "OSGClusterWindow.inl"
275 #include "OSGClusterWindowBase.inl"
277 #endif /* _OSGCLUSTERWINDOW_H_ */