fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FieldContainer / Mixins / OSGTraversalValidationHandlerMixin.h
blob0b655e9c5016db6889fc7ddff57c3fcc59e37a69
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2003 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 _OSGTRAVERSALVALIDATIONHANDLERMIXIN_H_
40 #define _OSGTRAVERSALVALIDATIONHANDLERMIXIN_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGOSGAnyFields.h"
47 #include <boost/bind.hpp>
49 #include "OSGWindow.h"
50 #include "OSGTraversalValidator.h"
51 #include "OSGRenderActionBase.h"
52 #include "OSGViewarea.h"
54 OSG_BEGIN_NAMESPACE
56 /*! \ingroup GrpSystemFieldContainerMixins
57 \ingroup GrpLibOSGSystem
59 template <class ParentT>
60 class TraversalValidationHandlerMixin : public ParentT
62 /*========================== PUBLIC =================================*/
64 public:
66 typedef TraversalValidationHandlerMixin<ParentT> Self;
68 typedef typename ParentT::Desc Desc;
69 typedef typename Desc::TypeObject TypeObject;
71 /*========================== PRIVATE ================================*/
73 protected:
75 typedef ParentT Inherited;
76 typedef typename Desc::DataSlotHandler DataSlotHandler;
77 typedef typename DataSlotHandler::DataSlotIdPool DataSlotIdPool;
78 typedef typename Desc::ElementIdPool ElementIdPool;
80 /*========================== PUBLIC =================================*/
82 public:
84 typedef TraversalValidator::ValidationStatus ValidationStatus;
86 enum UpdateMode
88 PerWindow = 0x0001,
89 PerViewport = 0x0002,
90 PerTraversal = 0x0003,
92 PerVisit = 0x0004,
94 OnRequest = 0x0005
97 /*---------------------------------------------------------------------*/
98 /*! \name dcast */
99 /*! \{ */
101 OSG_RC_FIRST_FIELD_DECL(UpdateMode );
103 OSG_RC_FIELD_DECL (RequestRun, UpdateMode);
104 OSG_RC_FIELD_DECL (DestroyedFunctors, RequestRun);
105 OSG_RC_LAST_FIELD_DECL (DestroyedFunctors );
107 /*! \} */
108 /*---------------------------------------------------------------------*/
109 /*! \name General Fieldcontainer Declaration */
110 /*! \{ */
112 /*! \} */
113 /*---------------------------------------------------------------------*/
114 /*! \name Constructors */
115 /*! \{ */
117 void addDestroyedFunctor (ChangedFunctor func,
118 std::string createSymbol);
120 template<class FunctorT>
121 void subDestroyedFunctor (FunctorT func );
123 template<class FunctorT>
124 bool hasDestroyedFunctor (FunctorT func );
126 void clearDestroyedFunctors (void );
128 template<class DataSlotHandlerT>
129 void clearDestroyedFunctorFor(DataSlotHandlerT *pHandler );
131 /*! \} */
132 /*---------------------------------------------------------------------*/
133 /*! \name Destructor */
134 /*! \{ */
136 bool requestRun(void);
138 /*! \} */
139 /*---------------------------------------------------------------------*/
140 /*! \name Helper */
141 /*! \{ */
143 void changed(ConstFieldMaskArg whichField,
144 UInt32 origin,
145 BitVector details);
147 /*! \} */
148 /*---------------------------------------------------------------------*/
149 /*! \name Get */
150 /*! \{ */
152 /*! \} */
153 /*---------------------------------------------------------------------*/
154 /*! \name Set */
155 /*! \{ */
157 /*! \} */
158 /*---------------------------------------------------------------------*/
159 /*! \name your_category */
160 /*! \{ */
162 void setUpdateMode (UpdateMode eMode);
163 UInt32 getUpdateMode (void ) const;
165 SFUInt32 *editSFUpdateMode(void );
166 const SFUInt32 *getSFUpdateMode (void ) const;
168 /*! \} */
169 /*---------------------------------------------------------------------*/
170 /*! \name Container Access */
171 /*! \{ */
173 /*! \} */
174 /*---------------------------------------------------------------------*/
175 /*! \name Binary Access */
176 /*! \{ */
178 virtual SizeT getBinSize (ConstFieldMaskArg whichField);
179 virtual void copyToBin (BinaryDataHandler &pMem,
180 ConstFieldMaskArg whichField);
181 virtual void copyFromBin(BinaryDataHandler &pMem,
182 ConstFieldMaskArg whichField);
184 /*! \} */
185 /*---------------------------------------------------------------------*/
186 /*! \name your_operators */
187 /*! \{ */
189 /*! \} */
190 /*---------------------------------------------------------------------*/
191 /*! \name Assignment */
192 /*! \{ */
194 /*! \} */
195 /*---------------------------------------------------------------------*/
196 /*! \name Comparison */
197 /*! \{ */
199 /*! \} */
200 /*---------------------------------------------------------------------*/
201 /*! \name Dump */
202 /*! \{ */
204 virtual void dump( UInt32 uiIndent = 0,
205 const BitVector bvFlags = 0) const;
207 /*! \} */
208 /*========================= PROTECTED ===============================*/
210 protected:
212 Int32 _iDataSlotId;
213 Int32 _iElementId;
215 /*---------------------------------------------------------------------*/
216 /*! \name Type information */
217 /*! \{ */
219 ValidationStatus validate(RenderActionBase *pAction);
221 /*! \} */
222 /*---------------------------------------------------------------------*/
223 /*! \name Fields */
224 /*! \{ */
226 SFUInt32 _sfUpdateMode;
227 SFOSGAny _sfRequestRun;
228 MFChangedFunctorCallback _mfDestroyedFunctors;
230 /*! \} */
231 /*---------------------------------------------------------------------*/
232 /*! \name Member */
233 /*! \{ */
235 TraversalValidationHandlerMixin(void);
236 TraversalValidationHandlerMixin(const Self &source);
238 virtual ~TraversalValidationHandlerMixin(void);
240 /*! \} */
241 /*---------------------------------------------------------------------*/
242 /*! \name Changed */
243 /*! \{ */
245 static void classDescInserter(TypeObject &oType);
247 /*! \} */
248 /*---------------------------------------------------------------------*/
249 /*! \name MT Destruction */
250 /*! \{ */
252 #ifdef OSG_MT_CPTR_ASPECT
253 void execSync ( Self *pFrom,
254 ConstFieldMaskArg whichField,
255 AspectOffsetStore &oOffsets,
256 ConstFieldMaskArg syncMode ,
257 const UInt32 uiSyncInfo);
258 #endif
261 /*! \} */
262 /*---------------------------------------------------------------------*/
263 /*! \name Edit */
264 /*! \{ */
266 /*! \} */
267 /*---------------------------------------------------------------------*/
268 /*! \name Edit */
269 /*! \{ */
271 EditFieldHandlePtr editHandleUpdateMode (void);
272 GetFieldHandlePtr getHandleUpdateMode (void) const;
274 GetFieldHandlePtr getHandleRequestRun (void) const;
276 GetFieldHandlePtr getHandleDestroyedFunctors (void) const;
277 EditFieldHandlePtr editHandleDestroyedFunctors(void);
279 /*! \} */
280 /*---------------------------------------------------------------------*/
281 /*! \name Sync */
282 /*! \{ */
284 void onCreateAspect (const Self *createAspect,
285 const Self *source = NULL);
287 void onCreate (const Self *source = NULL);
289 virtual void onDestroy ( UInt32 uiContainerId );
291 virtual void onDestroyAspect( UInt32 uiContainerId,
292 UInt32 uiAspect );
294 /*! \} */
295 /*========================== PRIVATE ================================*/
297 private:
299 /*!\brief prohibit default function (move to 'public' if needed) */
300 void operator =(const TraversalValidationHandlerMixin &source);
303 OSG_END_NAMESPACE
305 #include "OSGTraversalValidationHandlerMixin.inl"
307 #endif /* _OSGTRAVERSALVALIDATIONHANDLERMIXIN_H_ */