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 AlgorithmComputeElement!
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"
65 #include "OSGComputeAlgorithm.h" // Algorithm Class
67 #include "OSGAlgorithmComputeElementBase.h"
68 #include "OSGAlgorithmComputeElement.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::AlgorithmComputeElement
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var ComputeAlgorithm * AlgorithmComputeElementBase::_sfAlgorithm
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<AlgorithmComputeElement
*, nsOSG
>::_type(
97 "AlgorithmComputeElementPtr",
99 AlgorithmComputeElement::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(AlgorithmComputeElement
*, nsOSG
)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
106 AlgorithmComputeElement
*,
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
110 AlgorithmComputeElement
*,
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void AlgorithmComputeElementBase::classDescInserter(TypeObject
&oType
)
119 FieldDescriptionBase
*pDesc
= NULL
;
122 pDesc
= new SFUnrecComputeAlgorithmPtr::Description(
123 SFUnrecComputeAlgorithmPtr::getClassType(),
126 AlgorithmFieldId
, AlgorithmFieldMask
,
128 (Field::SFDefaultFlags
| Field::FStdAccess
),
129 static_cast<FieldEditMethodSig
>(&AlgorithmComputeElement::editHandleAlgorithm
),
130 static_cast<FieldGetMethodSig
>(&AlgorithmComputeElement::getHandleAlgorithm
));
132 oType
.addInitialDesc(pDesc
);
136 AlgorithmComputeElementBase::TypeObject
AlgorithmComputeElementBase::_type(
137 AlgorithmComputeElementBase::getClassname(),
138 Inherited::getClassname(),
141 reinterpret_cast<PrototypeCreateF
>(&AlgorithmComputeElementBase::createEmptyLocal
),
142 reinterpret_cast<InitContainerF
>(&AlgorithmComputeElement::initMethod
),
143 reinterpret_cast<ExitContainerF
>(&AlgorithmComputeElement::exitMethod
),
144 reinterpret_cast<InitalInsertDescFunc
>(&AlgorithmComputeElement::classDescInserter
),
147 "<?xml version=\"1.0\"?>\n"
150 " name=\"AlgorithmComputeElement\"\n"
151 " parent=\"ComputeElement\"\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=\"true\"\n"
162 " name=\"algorithm\"\n"
163 " type=\"ComputeAlgorithm\"\n"
164 " category=\"pointer\"\n"
165 " cardinality=\"single\"\n"
166 " visibility=\"external\"\n"
167 " defaultValue=\"NULL\"\n"
168 " access=\"public\"\n"
171 "</FieldContainer>\n",
175 /*------------------------------ get -----------------------------------*/
177 FieldContainerType
&AlgorithmComputeElementBase::getType(void)
182 const FieldContainerType
&AlgorithmComputeElementBase::getType(void) const
187 UInt32
AlgorithmComputeElementBase::getContainerSize(void) const
189 return sizeof(AlgorithmComputeElement
);
192 /*------------------------- decorator get ------------------------------*/
195 //! Get the AlgorithmComputeElement::_sfAlgorithm field.
196 const SFUnrecComputeAlgorithmPtr
*AlgorithmComputeElementBase::getSFAlgorithm(void) const
198 return &_sfAlgorithm
;
201 SFUnrecComputeAlgorithmPtr
*AlgorithmComputeElementBase::editSFAlgorithm (void)
203 editSField(AlgorithmFieldMask
);
205 return &_sfAlgorithm
;
208 //! Get the value of the AlgorithmComputeElement::_sfAlgorithm field.
209 ComputeAlgorithm
* AlgorithmComputeElementBase::getAlgorithm(void) const
211 return _sfAlgorithm
.getValue();
214 //! Set the value of the AlgorithmComputeElement::_sfAlgorithm field.
215 void AlgorithmComputeElementBase::setAlgorithm(ComputeAlgorithm
* const value
)
217 editSField(AlgorithmFieldMask
);
219 _sfAlgorithm
.setValue(value
);
227 /*------------------------------ access -----------------------------------*/
229 SizeT
AlgorithmComputeElementBase::getBinSize(ConstFieldMaskArg whichField
)
231 SizeT returnValue
= Inherited::getBinSize(whichField
);
233 if(FieldBits::NoField
!= (AlgorithmFieldMask
& whichField
))
235 returnValue
+= _sfAlgorithm
.getBinSize();
241 void AlgorithmComputeElementBase::copyToBin(BinaryDataHandler
&pMem
,
242 ConstFieldMaskArg whichField
)
244 Inherited::copyToBin(pMem
, whichField
);
246 if(FieldBits::NoField
!= (AlgorithmFieldMask
& whichField
))
248 _sfAlgorithm
.copyToBin(pMem
);
252 void AlgorithmComputeElementBase::copyFromBin(BinaryDataHandler
&pMem
,
253 ConstFieldMaskArg whichField
)
255 Inherited::copyFromBin(pMem
, whichField
);
257 if(FieldBits::NoField
!= (AlgorithmFieldMask
& whichField
))
259 editSField(AlgorithmFieldMask
);
260 _sfAlgorithm
.copyFromBin(pMem
);
264 //! create a new instance of the class
265 AlgorithmComputeElementTransitPtr
AlgorithmComputeElementBase::createLocal(BitVector bFlags
)
267 AlgorithmComputeElementTransitPtr fc
;
269 if(getClassType().getPrototype() != NULL
)
271 FieldContainerTransitPtr tmpPtr
=
272 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
274 fc
= dynamic_pointer_cast
<AlgorithmComputeElement
>(tmpPtr
);
280 //! create a new instance of the class, copy the container flags
281 AlgorithmComputeElementTransitPtr
AlgorithmComputeElementBase::createDependent(BitVector bFlags
)
283 AlgorithmComputeElementTransitPtr fc
;
285 if(getClassType().getPrototype() != NULL
)
287 FieldContainerTransitPtr tmpPtr
=
288 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
290 fc
= dynamic_pointer_cast
<AlgorithmComputeElement
>(tmpPtr
);
296 //! create a new instance of the class
297 AlgorithmComputeElementTransitPtr
AlgorithmComputeElementBase::create(void)
299 AlgorithmComputeElementTransitPtr fc
;
301 if(getClassType().getPrototype() != NULL
)
303 FieldContainerTransitPtr tmpPtr
=
304 getClassType().getPrototype()-> shallowCopy();
306 fc
= dynamic_pointer_cast
<AlgorithmComputeElement
>(tmpPtr
);
312 AlgorithmComputeElement
*AlgorithmComputeElementBase::createEmptyLocal(BitVector bFlags
)
314 AlgorithmComputeElement
*returnValue
;
316 newPtr
<AlgorithmComputeElement
>(returnValue
, bFlags
);
318 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
323 //! create an empty new instance of the class, do not copy the prototype
324 AlgorithmComputeElement
*AlgorithmComputeElementBase::createEmpty(void)
326 AlgorithmComputeElement
*returnValue
;
328 newPtr
<AlgorithmComputeElement
>(returnValue
, Thread::getCurrentLocalFlags());
330 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
331 ~Thread::getCurrentLocalFlags();
337 FieldContainerTransitPtr
AlgorithmComputeElementBase::shallowCopyLocal(
338 BitVector bFlags
) const
340 AlgorithmComputeElement
*tmpPtr
;
342 newPtr(tmpPtr
, dynamic_cast<const AlgorithmComputeElement
*>(this), bFlags
);
344 FieldContainerTransitPtr
returnValue(tmpPtr
);
346 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
351 FieldContainerTransitPtr
AlgorithmComputeElementBase::shallowCopyDependent(
352 BitVector bFlags
) const
354 AlgorithmComputeElement
*tmpPtr
;
356 newPtr(tmpPtr
, dynamic_cast<const AlgorithmComputeElement
*>(this), ~bFlags
);
358 FieldContainerTransitPtr
returnValue(tmpPtr
);
360 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
365 FieldContainerTransitPtr
AlgorithmComputeElementBase::shallowCopy(void) const
367 AlgorithmComputeElement
*tmpPtr
;
370 dynamic_cast<const AlgorithmComputeElement
*>(this),
371 Thread::getCurrentLocalFlags());
373 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
375 FieldContainerTransitPtr
returnValue(tmpPtr
);
383 /*------------------------- constructors ----------------------------------*/
385 AlgorithmComputeElementBase::AlgorithmComputeElementBase(void) :
391 AlgorithmComputeElementBase::AlgorithmComputeElementBase(const AlgorithmComputeElementBase
&source
) :
398 /*-------------------------- destructors ----------------------------------*/
400 AlgorithmComputeElementBase::~AlgorithmComputeElementBase(void)
404 void AlgorithmComputeElementBase::onCreate(const AlgorithmComputeElement
*source
)
406 Inherited::onCreate(source
);
410 AlgorithmComputeElement
*pThis
= static_cast<AlgorithmComputeElement
*>(this);
412 pThis
->setAlgorithm(source
->getAlgorithm());
416 GetFieldHandlePtr
AlgorithmComputeElementBase::getHandleAlgorithm (void) const
418 SFUnrecComputeAlgorithmPtr::GetHandlePtr
returnValue(
419 new SFUnrecComputeAlgorithmPtr::GetHandle(
421 this->getType().getFieldDesc(AlgorithmFieldId
),
422 const_cast<AlgorithmComputeElementBase
*>(this)));
427 EditFieldHandlePtr
AlgorithmComputeElementBase::editHandleAlgorithm (void)
429 SFUnrecComputeAlgorithmPtr::EditHandlePtr
returnValue(
430 new SFUnrecComputeAlgorithmPtr::EditHandle(
432 this->getType().getFieldDesc(AlgorithmFieldId
),
435 returnValue
->setSetMethod(
436 boost::bind(&AlgorithmComputeElement::setAlgorithm
,
437 static_cast<AlgorithmComputeElement
*>(this), _1
));
439 editSField(AlgorithmFieldMask
);
445 #ifdef OSG_MT_CPTR_ASPECT
446 void AlgorithmComputeElementBase::execSyncV( FieldContainer
&oFrom
,
447 ConstFieldMaskArg whichField
,
448 AspectOffsetStore
&oOffsets
,
449 ConstFieldMaskArg syncMode
,
450 const UInt32 uiSyncInfo
)
452 AlgorithmComputeElement
*pThis
= static_cast<AlgorithmComputeElement
*>(this);
454 pThis
->execSync(static_cast<AlgorithmComputeElement
*>(&oFrom
),
463 #ifdef OSG_MT_CPTR_ASPECT
464 FieldContainer
*AlgorithmComputeElementBase::createAspectCopy(
465 const FieldContainer
*pRefAspect
) const
467 AlgorithmComputeElement
*returnValue
;
469 newAspectCopy(returnValue
,
470 dynamic_cast<const AlgorithmComputeElement
*>(pRefAspect
),
471 dynamic_cast<const AlgorithmComputeElement
*>(this));
477 void AlgorithmComputeElementBase::resolveLinks(void)
479 Inherited::resolveLinks();
481 static_cast<AlgorithmComputeElement
*>(this)->setAlgorithm(NULL
);