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
>(&ComputeCallbackAlgorithm::classDescInserter
),
146 "<?xml version=\"1.0\"?>\n"
149 " name=\"ComputeCallbackAlgorithm\"\n"
150 " parent=\"ComputeAlgorithm\"\n"
151 " library=\"ContribComputeBase\"\n"
152 " pointerfieldtypes=\"both\"\n"
153 " structure=\"concrete\"\n"
154 " systemcomponent=\"true\"\n"
155 " parentsystemcomponent=\"true\"\n"
156 " decoratable=\"false\"\n"
157 " useLocalIncludes=\"false\"\n"
158 " isNodeCore=\"false\"\n"
161 " name=\"callback\"\n"
162 " type=\"ComputeFunctorCallback\"\n"
163 " cardinality=\"single\"\n"
164 " visibility=\"external\"\n"
168 "</FieldContainer>\n",
172 /*------------------------------ get -----------------------------------*/
174 FieldContainerType
&ComputeCallbackAlgorithmBase::getType(void)
179 const FieldContainerType
&ComputeCallbackAlgorithmBase::getType(void) const
184 UInt32
ComputeCallbackAlgorithmBase::getContainerSize(void) const
186 return sizeof(ComputeCallbackAlgorithm
);
189 /*------------------------- decorator get ------------------------------*/
197 /*------------------------------ access -----------------------------------*/
199 SizeT
ComputeCallbackAlgorithmBase::getBinSize(ConstFieldMaskArg whichField
)
201 SizeT returnValue
= Inherited::getBinSize(whichField
);
203 if(FieldBits::NoField
!= (CallbackFieldMask
& whichField
))
205 returnValue
+= _sfCallback
.getBinSize();
211 void ComputeCallbackAlgorithmBase::copyToBin(BinaryDataHandler
&pMem
,
212 ConstFieldMaskArg whichField
)
214 Inherited::copyToBin(pMem
, whichField
);
216 if(FieldBits::NoField
!= (CallbackFieldMask
& whichField
))
218 _sfCallback
.copyToBin(pMem
);
222 void ComputeCallbackAlgorithmBase::copyFromBin(BinaryDataHandler
&pMem
,
223 ConstFieldMaskArg whichField
)
225 Inherited::copyFromBin(pMem
, whichField
);
227 if(FieldBits::NoField
!= (CallbackFieldMask
& whichField
))
229 editSField(CallbackFieldMask
);
230 _sfCallback
.copyFromBin(pMem
);
234 //! create a new instance of the class
235 ComputeCallbackAlgorithmTransitPtr
ComputeCallbackAlgorithmBase::createLocal(BitVector bFlags
)
237 ComputeCallbackAlgorithmTransitPtr fc
;
239 if(getClassType().getPrototype() != NULL
)
241 FieldContainerTransitPtr tmpPtr
=
242 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
244 fc
= dynamic_pointer_cast
<ComputeCallbackAlgorithm
>(tmpPtr
);
250 //! create a new instance of the class, copy the container flags
251 ComputeCallbackAlgorithmTransitPtr
ComputeCallbackAlgorithmBase::createDependent(BitVector bFlags
)
253 ComputeCallbackAlgorithmTransitPtr fc
;
255 if(getClassType().getPrototype() != NULL
)
257 FieldContainerTransitPtr tmpPtr
=
258 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
260 fc
= dynamic_pointer_cast
<ComputeCallbackAlgorithm
>(tmpPtr
);
266 //! create a new instance of the class
267 ComputeCallbackAlgorithmTransitPtr
ComputeCallbackAlgorithmBase::create(void)
269 ComputeCallbackAlgorithmTransitPtr fc
;
271 if(getClassType().getPrototype() != NULL
)
273 FieldContainerTransitPtr tmpPtr
=
274 getClassType().getPrototype()-> shallowCopy();
276 fc
= dynamic_pointer_cast
<ComputeCallbackAlgorithm
>(tmpPtr
);
282 ComputeCallbackAlgorithm
*ComputeCallbackAlgorithmBase::createEmptyLocal(BitVector bFlags
)
284 ComputeCallbackAlgorithm
*returnValue
;
286 newPtr
<ComputeCallbackAlgorithm
>(returnValue
, bFlags
);
288 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
293 //! create an empty new instance of the class, do not copy the prototype
294 ComputeCallbackAlgorithm
*ComputeCallbackAlgorithmBase::createEmpty(void)
296 ComputeCallbackAlgorithm
*returnValue
;
298 newPtr
<ComputeCallbackAlgorithm
>(returnValue
, Thread::getCurrentLocalFlags());
300 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
301 ~Thread::getCurrentLocalFlags();
307 FieldContainerTransitPtr
ComputeCallbackAlgorithmBase::shallowCopyLocal(
308 BitVector bFlags
) const
310 ComputeCallbackAlgorithm
*tmpPtr
;
312 newPtr(tmpPtr
, dynamic_cast<const ComputeCallbackAlgorithm
*>(this), bFlags
);
314 FieldContainerTransitPtr
returnValue(tmpPtr
);
316 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
321 FieldContainerTransitPtr
ComputeCallbackAlgorithmBase::shallowCopyDependent(
322 BitVector bFlags
) const
324 ComputeCallbackAlgorithm
*tmpPtr
;
326 newPtr(tmpPtr
, dynamic_cast<const ComputeCallbackAlgorithm
*>(this), ~bFlags
);
328 FieldContainerTransitPtr
returnValue(tmpPtr
);
330 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
335 FieldContainerTransitPtr
ComputeCallbackAlgorithmBase::shallowCopy(void) const
337 ComputeCallbackAlgorithm
*tmpPtr
;
340 dynamic_cast<const ComputeCallbackAlgorithm
*>(this),
341 Thread::getCurrentLocalFlags());
343 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
345 FieldContainerTransitPtr
returnValue(tmpPtr
);
353 /*------------------------- constructors ----------------------------------*/
355 ComputeCallbackAlgorithmBase::ComputeCallbackAlgorithmBase(void) :
361 ComputeCallbackAlgorithmBase::ComputeCallbackAlgorithmBase(const ComputeCallbackAlgorithmBase
&source
) :
363 _sfCallback (source
._sfCallback
)
368 /*-------------------------- destructors ----------------------------------*/
370 ComputeCallbackAlgorithmBase::~ComputeCallbackAlgorithmBase(void)
375 GetFieldHandlePtr
ComputeCallbackAlgorithmBase::getHandleCallback (void) const
377 SFComputeFunctorCallback::GetHandlePtr returnValue
;
382 EditFieldHandlePtr
ComputeCallbackAlgorithmBase::editHandleCallback (void)
384 EditFieldHandlePtr returnValue
;
390 #ifdef OSG_MT_CPTR_ASPECT
391 void ComputeCallbackAlgorithmBase::execSyncV( FieldContainer
&oFrom
,
392 ConstFieldMaskArg whichField
,
393 AspectOffsetStore
&oOffsets
,
394 ConstFieldMaskArg syncMode
,
395 const UInt32 uiSyncInfo
)
397 ComputeCallbackAlgorithm
*pThis
= static_cast<ComputeCallbackAlgorithm
*>(this);
399 pThis
->execSync(static_cast<ComputeCallbackAlgorithm
*>(&oFrom
),
408 #ifdef OSG_MT_CPTR_ASPECT
409 FieldContainer
*ComputeCallbackAlgorithmBase::createAspectCopy(
410 const FieldContainer
*pRefAspect
) const
412 ComputeCallbackAlgorithm
*returnValue
;
414 newAspectCopy(returnValue
,
415 dynamic_cast<const ComputeCallbackAlgorithm
*>(pRefAspect
),
416 dynamic_cast<const ComputeCallbackAlgorithm
*>(this));
422 void ComputeCallbackAlgorithmBase::resolveLinks(void)
424 Inherited::resolveLinks();