1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 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 _OSGTRAVERSALVALIDATIONHANDLERMIXIN_H_
40 #define _OSGTRAVERSALVALIDATIONHANDLERMIXIN_H_
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"
56 /*! \ingroup GrpSystemFieldContainerMixins
57 \ingroup GrpLibOSGSystem
59 template <class ParentT
>
60 class TraversalValidationHandlerMixin
: public ParentT
62 /*========================== PUBLIC =================================*/
66 typedef TraversalValidationHandlerMixin
<ParentT
> Self
;
68 typedef typename
ParentT::Desc Desc
;
69 typedef typename
Desc::TypeObject TypeObject
;
71 /*========================== PRIVATE ================================*/
75 typedef ParentT Inherited
;
76 typedef typename
Desc::DataSlotHandler DataSlotHandler
;
77 typedef typename
DataSlotHandler::DataSlotIdPool DataSlotIdPool
;
78 typedef typename
Desc::ElementIdPool ElementIdPool
;
80 /*========================== PUBLIC =================================*/
84 typedef TraversalValidator::ValidationStatus ValidationStatus
;
90 PerTraversal
= 0x0003,
97 /*---------------------------------------------------------------------*/
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
);
108 /*---------------------------------------------------------------------*/
109 /*! \name General Fieldcontainer Declaration */
113 /*---------------------------------------------------------------------*/
114 /*! \name Constructors */
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
);
132 /*---------------------------------------------------------------------*/
133 /*! \name Destructor */
136 bool requestRun(void);
139 /*---------------------------------------------------------------------*/
143 void changed(ConstFieldMaskArg whichField
,
148 /*---------------------------------------------------------------------*/
153 /*---------------------------------------------------------------------*/
158 /*---------------------------------------------------------------------*/
159 /*! \name your_category */
162 void setUpdateMode (UpdateMode eMode
);
163 UInt32
getUpdateMode (void ) const;
165 SFUInt32
*editSFUpdateMode(void );
166 const SFUInt32
*getSFUpdateMode (void ) const;
169 /*---------------------------------------------------------------------*/
170 /*! \name Container Access */
174 /*---------------------------------------------------------------------*/
175 /*! \name Binary Access */
178 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
179 virtual void copyToBin (BinaryDataHandler
&pMem
,
180 ConstFieldMaskArg whichField
);
181 virtual void copyFromBin(BinaryDataHandler
&pMem
,
182 ConstFieldMaskArg whichField
);
185 /*---------------------------------------------------------------------*/
186 /*! \name your_operators */
190 /*---------------------------------------------------------------------*/
191 /*! \name Assignment */
195 /*---------------------------------------------------------------------*/
196 /*! \name Comparison */
200 /*---------------------------------------------------------------------*/
204 virtual void dump( UInt32 uiIndent
= 0,
205 const BitVector bvFlags
= 0) const;
208 /*========================= PROTECTED ===============================*/
215 /*---------------------------------------------------------------------*/
216 /*! \name Type information */
219 ValidationStatus
validate(RenderActionBase
*pAction
);
222 /*---------------------------------------------------------------------*/
226 SFUInt32 _sfUpdateMode
;
227 SFOSGAny _sfRequestRun
;
228 MFChangedFunctorCallback _mfDestroyedFunctors
;
231 /*---------------------------------------------------------------------*/
235 TraversalValidationHandlerMixin(void);
236 TraversalValidationHandlerMixin(const Self
&source
);
238 virtual ~TraversalValidationHandlerMixin(void);
241 /*---------------------------------------------------------------------*/
245 static void classDescInserter(TypeObject
&oType
);
248 /*---------------------------------------------------------------------*/
249 /*! \name MT Destruction */
252 #ifdef OSG_MT_CPTR_ASPECT
253 void execSync ( Self
*pFrom
,
254 ConstFieldMaskArg whichField
,
255 AspectOffsetStore
&oOffsets
,
256 ConstFieldMaskArg syncMode
,
257 const UInt32 uiSyncInfo
);
262 /*---------------------------------------------------------------------*/
267 /*---------------------------------------------------------------------*/
271 EditFieldHandlePtr
editHandleUpdateMode (void);
272 GetFieldHandlePtr
getHandleUpdateMode (void) const;
274 GetFieldHandlePtr
getHandleRequestRun (void) const;
276 GetFieldHandlePtr
getHandleDestroyedFunctors (void) const;
277 EditFieldHandlePtr
editHandleDestroyedFunctors(void);
280 /*---------------------------------------------------------------------*/
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
,
295 /*========================== PRIVATE ================================*/
299 /*!\brief prohibit default function (move to 'public' if needed) */
300 void operator =(const TraversalValidationHandlerMixin
&source
);
305 #include "OSGTraversalValidationHandlerMixin.inl"
307 #endif /* _OSGTRAVERSALVALIDATIONHANDLERMIXIN_H_ */