fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Dynamics / Base / OSGFrameHandler.h
blob5caa1f164165e8313e0f96eadece38e0201f099f
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 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 _OSGFRAMEHANDLER_H_
40 #define _OSGFRAMEHANDLER_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGFrameHandlerBase.h"
46 #include "OSGFrameTaskInterface.h"
48 OSG_BEGIN_NAMESPACE
50 /*! \brief FrameHandler class. See \ref
51 PageDynamicsFrameHandler for a description.
52 \ingroup GrpDynamicsBaseObj
53 \ingroup GrpLibOSGDynamics
54 \includebasedoc
57 class OSG_DYNAMICS_DLLMAPPING FrameHandler : public FrameHandlerBase
59 protected:
61 /*========================== PUBLIC =================================*/
63 public:
65 typedef FrameHandlerBase Inherited;
66 typedef FrameHandler Self;
68 /*---------------------------------------------------------------------*/
69 /*! \name Sync */
70 /*! \{ */
72 virtual void changed(ConstFieldMaskArg whichField,
73 UInt32 origin,
74 BitVector details );
76 /*! \} */
77 /*---------------------------------------------------------------------*/
78 /*! \name Instance */
79 /*! \{ */
81 static void setGlobalInstance(FrameHandler *pHandler);
82 static FrameHandler *the (void );
84 /*! \} */
85 /*---------------------------------------------------------------------*/
86 /*! \name Tasks */
87 /*! \{ */
89 void addTask (FrameTaskInterface *pTask,
90 bool bNoFrameFunction = false);
91 void removeTask(FrameTaskInterface *pTask );
93 /*! \} */
94 /*---------------------------------------------------------------------*/
95 /*! \name Frame */
96 /*! \{ */
98 bool init (void );
99 void frame (void );
100 void frame (Time frameTime);
101 void shutdown(void );
103 /*! \} */
104 /*---------------------------------------------------------------------*/
105 /*! \name Output */
106 /*! \{ */
108 virtual void dump( UInt32 uiIndent = 0,
109 const BitVector bvFlags = 0) const;
111 /*! \} */
112 /*========================= PROTECTED ===============================*/
114 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;
125 /*! \nohierarchy
128 struct FrameTaskLess : public std::binary_function<FrameTaskInterface *,
129 FrameTaskInterface *,
130 bool >
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 */
147 /*! \{ */
149 FrameHandler(void);
150 FrameHandler(const FrameHandler &source);
152 /*! \} */
153 /*---------------------------------------------------------------------*/
154 /*! \name Destructors */
155 /*! \{ */
157 virtual ~FrameHandler(void);
159 /*! \} */
160 /*---------------------------------------------------------------------*/
161 /*! \name Init */
162 /*! \{ */
164 static void initMethod(InitPhase ePhase);
166 const InterfaceStore *getMFFrameTasks (void) const;
168 const InterfaceStore *getMFUninitializedFrameTasks(void) const;
169 const InterfaceStore *getMFInitializedFrameTasks (void) const;
171 /*! \} */
172 /*---------------------------------------------------------------------*/
173 /*! \name Ptr MField Set */
174 /*! \{ */
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 );
188 /*! \} */
189 /*---------------------------------------------------------------------*/
190 /*! \name Ptr MField Set */
191 /*! \{ */
193 virtual void resolveLinks(void);
195 /*! \} */
196 /*========================== PRIVATE ================================*/
198 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;
209 OSG_END_NAMESPACE
211 #include "OSGFrameHandlerBase.inl"
212 #include "OSGFrameHandler.inl"
214 #endif /* _OSGFRAMEHANDLER_H_ */