1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ComputeCallbackAlgorithm!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
66 #include "OSGComputeCallbackAlgorithmBase.h"
67 #include "OSGComputeCallbackAlgorithm.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ComputeCallbackAlgorithm
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var ComputeFunctorCallback ComputeCallbackAlgorithmBase::_sfCallback
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits
<ComputeCallbackAlgorithm
*, nsOSG
>::_type(
96 "ComputeCallbackAlgorithmPtr",
97 "ComputeAlgorithmPtr",
98 ComputeCallbackAlgorithm::getClassType(),
102 OSG_FIELDTRAITS_GETTYPE_NS(ComputeCallbackAlgorithm
*, nsOSG
)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
105 ComputeCallbackAlgorithm
*,
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
109 ComputeCallbackAlgorithm
*,
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void ComputeCallbackAlgorithmBase::classDescInserter(TypeObject
&oType
)
118 FieldDescriptionBase
*pDesc
= NULL
;
121 pDesc
= new SFComputeFunctorCallback::Description(
122 SFComputeFunctorCallback::getClassType(),
125 CallbackFieldId
, CallbackFieldMask
,
127 (Field::SFDefaultFlags
| Field::FStdAccess
),
128 static_cast <FieldEditMethodSig
>(&ComputeCallbackAlgorithm::invalidEditField
),
129 static_cast <FieldGetMethodSig
>(&ComputeCallbackAlgorithm::invalidGetField
));
131 oType
.addInitialDesc(pDesc
);
135 ComputeCallbackAlgorithmBase::TypeObject
ComputeCallbackAlgorithmBase::_type(
136 ComputeCallbackAlgorithmBase::getClassname(),
137 Inherited::getClassname(),
140 reinterpret_cast<PrototypeCreateF
>(&ComputeCallbackAlgorithmBase::createEmptyLocal
),
141 reinterpret_cast<InitContainerF
>(&ComputeCallbackAlgorithm::initMethod
),
142 reinterpret_cast<ExitContainerF
>(&ComputeCallbackAlgorithm::exitMethod
),
143 reinterpret_cast<InitalInsertDescFunc
>(
144 reinterpret_cast<void *>(&ComputeCallbackAlgorithm::classDescInserter
)),
147 "<?xml version=\"1.0\"?>\n"
150 " name=\"ComputeCallbackAlgorithm\"\n"
151 " parent=\"ComputeAlgorithm\"\n"
152 " library=\"ContribComputeBase\"\n"
153 " pointerfieldtypes=\"both\"\n"
154 " structure=\"concrete\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " decoratable=\"false\"\n"
158 " useLocalIncludes=\"false\"\n"
159 " isNodeCore=\"false\"\n"
162 " name=\"callback\"\n"
163 " type=\"ComputeFunctorCallback\"\n"
164 " cardinality=\"single\"\n"
165 " visibility=\"external\"\n"
169 "</FieldContainer>\n",
173 /*------------------------------ get -----------------------------------*/
175 FieldContainerType
&ComputeCallbackAlgorithmBase::getType(void)
180 const FieldContainerType
&ComputeCallbackAlgorithmBase::getType(void) const
185 UInt32
ComputeCallbackAlgorithmBase::getContainerSize(void) const
187 return sizeof(ComputeCallbackAlgorithm
);
190 /*------------------------- decorator get ------------------------------*/
198 /*------------------------------ access -----------------------------------*/
200 SizeT
ComputeCallbackAlgorithmBase::getBinSize(ConstFieldMaskArg whichField
)
202 SizeT returnValue
= Inherited::getBinSize(whichField
);
204 if(FieldBits::NoField
!= (CallbackFieldMask
& whichField
))
206 returnValue
+= _sfCallback
.getBinSize();
212 void ComputeCallbackAlgorithmBase::copyToBin(BinaryDataHandler
&pMem
,
213 ConstFieldMaskArg whichField
)
215 Inherited::copyToBin(pMem
, whichField
);
217 if(FieldBits::NoField
!= (CallbackFieldMask
& whichField
))
219 _sfCallback
.copyToBin(pMem
);
223 void ComputeCallbackAlgorithmBase::copyFromBin(BinaryDataHandler
&pMem
,
224 ConstFieldMaskArg whichField
)
226 Inherited::copyFromBin(pMem
, whichField
);
228 if(FieldBits::NoField
!= (CallbackFieldMask
& whichField
))
230 editSField(CallbackFieldMask
);
231 _sfCallback
.copyFromBin(pMem
);
235 //! create a new instance of the class
236 ComputeCallbackAlgorithmTransitPtr
ComputeCallbackAlgorithmBase::createLocal(BitVector bFlags
)
238 ComputeCallbackAlgorithmTransitPtr fc
;
240 if(getClassType().getPrototype() != NULL
)
242 FieldContainerTransitPtr tmpPtr
=
243 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
245 fc
= dynamic_pointer_cast
<ComputeCallbackAlgorithm
>(tmpPtr
);
251 //! create a new instance of the class, copy the container flags
252 ComputeCallbackAlgorithmTransitPtr
ComputeCallbackAlgorithmBase::createDependent(BitVector bFlags
)
254 ComputeCallbackAlgorithmTransitPtr fc
;
256 if(getClassType().getPrototype() != NULL
)
258 FieldContainerTransitPtr tmpPtr
=
259 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
261 fc
= dynamic_pointer_cast
<ComputeCallbackAlgorithm
>(tmpPtr
);
267 //! create a new instance of the class
268 ComputeCallbackAlgorithmTransitPtr
ComputeCallbackAlgorithmBase::create(void)
270 ComputeCallbackAlgorithmTransitPtr fc
;
272 if(getClassType().getPrototype() != NULL
)
274 FieldContainerTransitPtr tmpPtr
=
275 getClassType().getPrototype()-> shallowCopy();
277 fc
= dynamic_pointer_cast
<ComputeCallbackAlgorithm
>(tmpPtr
);
283 ComputeCallbackAlgorithm
*ComputeCallbackAlgorithmBase::createEmptyLocal(BitVector bFlags
)
285 ComputeCallbackAlgorithm
*returnValue
;
287 newPtr
<ComputeCallbackAlgorithm
>(returnValue
, bFlags
);
289 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
294 //! create an empty new instance of the class, do not copy the prototype
295 ComputeCallbackAlgorithm
*ComputeCallbackAlgorithmBase::createEmpty(void)
297 ComputeCallbackAlgorithm
*returnValue
;
299 newPtr
<ComputeCallbackAlgorithm
>(returnValue
, Thread::getCurrentLocalFlags());
301 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
302 ~Thread::getCurrentLocalFlags();
308 FieldContainerTransitPtr
ComputeCallbackAlgorithmBase::shallowCopyLocal(
309 BitVector bFlags
) const
311 ComputeCallbackAlgorithm
*tmpPtr
;
313 newPtr(tmpPtr
, dynamic_cast<const ComputeCallbackAlgorithm
*>(this), bFlags
);
315 FieldContainerTransitPtr
returnValue(tmpPtr
);
317 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
322 FieldContainerTransitPtr
ComputeCallbackAlgorithmBase::shallowCopyDependent(
323 BitVector bFlags
) const
325 ComputeCallbackAlgorithm
*tmpPtr
;
327 newPtr(tmpPtr
, dynamic_cast<const ComputeCallbackAlgorithm
*>(this), ~bFlags
);
329 FieldContainerTransitPtr
returnValue(tmpPtr
);
331 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
336 FieldContainerTransitPtr
ComputeCallbackAlgorithmBase::shallowCopy(void) const
338 ComputeCallbackAlgorithm
*tmpPtr
;
341 dynamic_cast<const ComputeCallbackAlgorithm
*>(this),
342 Thread::getCurrentLocalFlags());
344 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
346 FieldContainerTransitPtr
returnValue(tmpPtr
);
354 /*------------------------- constructors ----------------------------------*/
356 ComputeCallbackAlgorithmBase::ComputeCallbackAlgorithmBase(void) :
362 ComputeCallbackAlgorithmBase::ComputeCallbackAlgorithmBase(const ComputeCallbackAlgorithmBase
&source
) :
364 _sfCallback (source
._sfCallback
)
369 /*-------------------------- destructors ----------------------------------*/
371 ComputeCallbackAlgorithmBase::~ComputeCallbackAlgorithmBase(void)
376 GetFieldHandlePtr
ComputeCallbackAlgorithmBase::getHandleCallback (void) const
378 SFComputeFunctorCallback::GetHandlePtr returnValue
;
383 EditFieldHandlePtr
ComputeCallbackAlgorithmBase::editHandleCallback (void)
385 EditFieldHandlePtr returnValue
;
391 #ifdef OSG_MT_CPTR_ASPECT
392 void ComputeCallbackAlgorithmBase::execSyncV( FieldContainer
&oFrom
,
393 ConstFieldMaskArg whichField
,
394 AspectOffsetStore
&oOffsets
,
395 ConstFieldMaskArg syncMode
,
396 const UInt32 uiSyncInfo
)
398 ComputeCallbackAlgorithm
*pThis
= static_cast<ComputeCallbackAlgorithm
*>(this);
400 pThis
->execSync(static_cast<ComputeCallbackAlgorithm
*>(&oFrom
),
409 #ifdef OSG_MT_CPTR_ASPECT
410 FieldContainer
*ComputeCallbackAlgorithmBase::createAspectCopy(
411 const FieldContainer
*pRefAspect
) const
413 ComputeCallbackAlgorithm
*returnValue
;
415 newAspectCopy(returnValue
,
416 dynamic_cast<const ComputeCallbackAlgorithm
*>(pRefAspect
),
417 dynamic_cast<const ComputeCallbackAlgorithm
*>(this));
423 void ComputeCallbackAlgorithmBase::resolveLinks(void)
425 Inherited::resolveLinks();