1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 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 _OSGFRAMEHANDLER_H_
40 #define _OSGFRAMEHANDLER_H_
45 #include "OSGFrameHandlerBase.h"
46 #include "OSGFrameTaskInterface.h"
50 /*! \brief FrameHandler class. See \ref
51 PageDynamicsFrameHandler for a description.
52 \ingroup GrpDynamicsBaseObj
53 \ingroup GrpLibOSGDynamics
57 class OSG_DYNAMICS_DLLMAPPING FrameHandler
: public FrameHandlerBase
61 /*========================== PUBLIC =================================*/
65 typedef FrameHandlerBase Inherited
;
66 typedef FrameHandler Self
;
68 /*---------------------------------------------------------------------*/
72 virtual void changed(ConstFieldMaskArg whichField
,
77 /*---------------------------------------------------------------------*/
81 static void setGlobalInstance(FrameHandler
*pHandler
);
82 static FrameHandler
*the (void );
85 /*---------------------------------------------------------------------*/
89 void addTask (FrameTaskInterface
*pTask
,
90 bool bNoFrameFunction
= false);
91 void removeTask(FrameTaskInterface
*pTask
);
94 /*---------------------------------------------------------------------*/
100 void frame (Time frameTime
);
101 void shutdown(void );
104 /*---------------------------------------------------------------------*/
108 virtual void dump( UInt32 uiIndent
= 0,
109 const BitVector bvFlags
= 0) const;
112 /*========================= PROTECTED ===============================*/
116 // Variables should all be in FrameHandlerBase.
118 static bool _bRegistersInstanceRelease
;
119 static FrameHandlerUnrecPtr _pGlobalInstance
;
121 typedef std::vector
<FrameTaskInterface
*> InterfaceStore
;
122 typedef InterfaceStore::iterator InterfaceStoreIt
;
123 typedef InterfaceStore::const_iterator InterfaceStoreConstIt
;
128 struct FrameTaskLess
: public std::binary_function
<FrameTaskInterface
*,
129 FrameTaskInterface
*,
132 inline bool operator() (FrameTaskInterface
*lhs
,
133 FrameTaskInterface
*rhs
);
136 static bool releaseGlobalInstance(void);
138 void callTasks(void);
141 InterfaceStore _mfFrameTasks
;
142 InterfaceStore _mfUninitializedFrameTasks
;
143 InterfaceStore _mfInitializedFrameTasks
;
145 /*---------------------------------------------------------------------*/
146 /*! \name Constructors */
150 FrameHandler(const FrameHandler
&source
);
153 /*---------------------------------------------------------------------*/
154 /*! \name Destructors */
157 virtual ~FrameHandler(void);
160 /*---------------------------------------------------------------------*/
164 static void initMethod(InitPhase ePhase
);
166 const InterfaceStore
*getMFFrameTasks (void) const;
168 const InterfaceStore
*getMFUninitializedFrameTasks(void) const;
169 const InterfaceStore
*getMFInitializedFrameTasks (void) const;
172 /*---------------------------------------------------------------------*/
173 /*! \name Ptr MField Set */
176 void pushToFrameTasks (FrameTaskInterface
* const value
);
177 bool removeObjFromFrameTasks (FrameTaskInterface
* const value
);
178 void clearFrameTasks (void );
180 void pushToUninitializedFrameTasks (FrameTaskInterface
* const value
);
181 bool removeObjFromUninitializedFrameTasks(FrameTaskInterface
* const value
);
182 void clearUninitializedFrameTasks (void );
184 void pushToInitializedFrameTasks (FrameTaskInterface
* const value
);
185 bool removeObjFromInitializedFrameTasks (FrameTaskInterface
* const value
);
186 void clearInitializedFrameTasks (void );
189 /*---------------------------------------------------------------------*/
190 /*! \name Ptr MField Set */
193 virtual void resolveLinks(void);
196 /*========================== PRIVATE ================================*/
200 friend class FieldContainer
;
201 friend class FrameHandlerBase
;
203 // prohibit default functions (move to 'public' if you need one)
204 void operator =(const FrameHandler
&source
);
207 typedef FrameHandler
*FrameHandlerP
;
211 #include "OSGFrameHandlerBase.inl"
212 #include "OSGFrameHandler.inl"
214 #endif /* _OSGFRAMEHANDLER_H_ */