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
>(
145 reinterpret_cast<void *>(&AlgorithmComputeElement::classDescInserter
)),
148 "<?xml version=\"1.0\"?>\n"
151 " name=\"AlgorithmComputeElement\"\n"
152 " parent=\"ComputeElement\"\n"
153 " library=\"ContribComputeBase\"\n"
154 " pointerfieldtypes=\"both\"\n"
155 " structure=\"concrete\"\n"
156 " systemcomponent=\"true\"\n"
157 " parentsystemcomponent=\"true\"\n"
158 " decoratable=\"false\"\n"
159 " useLocalIncludes=\"false\"\n"
160 " isNodeCore=\"true\"\n"
163 " name=\"algorithm\"\n"
164 " type=\"ComputeAlgorithm\"\n"
165 " category=\"pointer\"\n"
166 " cardinality=\"single\"\n"
167 " visibility=\"external\"\n"
168 " defaultValue=\"NULL\"\n"
169 " access=\"public\"\n"
172 "</FieldContainer>\n",
176 /*------------------------------ get -----------------------------------*/
178 FieldContainerType
&AlgorithmComputeElementBase::getType(void)
183 const FieldContainerType
&AlgorithmComputeElementBase::getType(void) const
188 UInt32
AlgorithmComputeElementBase::getContainerSize(void) const
190 return sizeof(AlgorithmComputeElement
);
193 /*------------------------- decorator get ------------------------------*/
196 //! Get the AlgorithmComputeElement::_sfAlgorithm field.
197 const SFUnrecComputeAlgorithmPtr
*AlgorithmComputeElementBase::getSFAlgorithm(void) const
199 return &_sfAlgorithm
;
202 SFUnrecComputeAlgorithmPtr
*AlgorithmComputeElementBase::editSFAlgorithm (void)
204 editSField(AlgorithmFieldMask
);
206 return &_sfAlgorithm
;
209 //! Get the value of the AlgorithmComputeElement::_sfAlgorithm field.
210 ComputeAlgorithm
* AlgorithmComputeElementBase::getAlgorithm(void) const
212 return _sfAlgorithm
.getValue();
215 //! Set the value of the AlgorithmComputeElement::_sfAlgorithm field.
216 void AlgorithmComputeElementBase::setAlgorithm(ComputeAlgorithm
* const value
)
218 editSField(AlgorithmFieldMask
);
220 _sfAlgorithm
.setValue(value
);
228 /*------------------------------ access -----------------------------------*/
230 SizeT
AlgorithmComputeElementBase::getBinSize(ConstFieldMaskArg whichField
)
232 SizeT returnValue
= Inherited::getBinSize(whichField
);
234 if(FieldBits::NoField
!= (AlgorithmFieldMask
& whichField
))
236 returnValue
+= _sfAlgorithm
.getBinSize();
242 void AlgorithmComputeElementBase::copyToBin(BinaryDataHandler
&pMem
,
243 ConstFieldMaskArg whichField
)
245 Inherited::copyToBin(pMem
, whichField
);
247 if(FieldBits::NoField
!= (AlgorithmFieldMask
& whichField
))
249 _sfAlgorithm
.copyToBin(pMem
);
253 void AlgorithmComputeElementBase::copyFromBin(BinaryDataHandler
&pMem
,
254 ConstFieldMaskArg whichField
)
256 Inherited::copyFromBin(pMem
, whichField
);
258 if(FieldBits::NoField
!= (AlgorithmFieldMask
& whichField
))
260 editSField(AlgorithmFieldMask
);
261 _sfAlgorithm
.copyFromBin(pMem
);
265 //! create a new instance of the class
266 AlgorithmComputeElementTransitPtr
AlgorithmComputeElementBase::createLocal(BitVector bFlags
)
268 AlgorithmComputeElementTransitPtr fc
;
270 if(getClassType().getPrototype() != NULL
)
272 FieldContainerTransitPtr tmpPtr
=
273 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
275 fc
= dynamic_pointer_cast
<AlgorithmComputeElement
>(tmpPtr
);
281 //! create a new instance of the class, copy the container flags
282 AlgorithmComputeElementTransitPtr
AlgorithmComputeElementBase::createDependent(BitVector bFlags
)
284 AlgorithmComputeElementTransitPtr fc
;
286 if(getClassType().getPrototype() != NULL
)
288 FieldContainerTransitPtr tmpPtr
=
289 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
291 fc
= dynamic_pointer_cast
<AlgorithmComputeElement
>(tmpPtr
);
297 //! create a new instance of the class
298 AlgorithmComputeElementTransitPtr
AlgorithmComputeElementBase::create(void)
300 AlgorithmComputeElementTransitPtr fc
;
302 if(getClassType().getPrototype() != NULL
)
304 FieldContainerTransitPtr tmpPtr
=
305 getClassType().getPrototype()-> shallowCopy();
307 fc
= dynamic_pointer_cast
<AlgorithmComputeElement
>(tmpPtr
);
313 AlgorithmComputeElement
*AlgorithmComputeElementBase::createEmptyLocal(BitVector bFlags
)
315 AlgorithmComputeElement
*returnValue
;
317 newPtr
<AlgorithmComputeElement
>(returnValue
, bFlags
);
319 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
324 //! create an empty new instance of the class, do not copy the prototype
325 AlgorithmComputeElement
*AlgorithmComputeElementBase::createEmpty(void)
327 AlgorithmComputeElement
*returnValue
;
329 newPtr
<AlgorithmComputeElement
>(returnValue
, Thread::getCurrentLocalFlags());
331 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
332 ~Thread::getCurrentLocalFlags();
338 FieldContainerTransitPtr
AlgorithmComputeElementBase::shallowCopyLocal(
339 BitVector bFlags
) const
341 AlgorithmComputeElement
*tmpPtr
;
343 newPtr(tmpPtr
, dynamic_cast<const AlgorithmComputeElement
*>(this), bFlags
);
345 FieldContainerTransitPtr
returnValue(tmpPtr
);
347 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
352 FieldContainerTransitPtr
AlgorithmComputeElementBase::shallowCopyDependent(
353 BitVector bFlags
) const
355 AlgorithmComputeElement
*tmpPtr
;
357 newPtr(tmpPtr
, dynamic_cast<const AlgorithmComputeElement
*>(this), ~bFlags
);
359 FieldContainerTransitPtr
returnValue(tmpPtr
);
361 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
366 FieldContainerTransitPtr
AlgorithmComputeElementBase::shallowCopy(void) const
368 AlgorithmComputeElement
*tmpPtr
;
371 dynamic_cast<const AlgorithmComputeElement
*>(this),
372 Thread::getCurrentLocalFlags());
374 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
376 FieldContainerTransitPtr
returnValue(tmpPtr
);
384 /*------------------------- constructors ----------------------------------*/
386 AlgorithmComputeElementBase::AlgorithmComputeElementBase(void) :
392 AlgorithmComputeElementBase::AlgorithmComputeElementBase(const AlgorithmComputeElementBase
&source
) :
399 /*-------------------------- destructors ----------------------------------*/
401 AlgorithmComputeElementBase::~AlgorithmComputeElementBase(void)
405 void AlgorithmComputeElementBase::onCreate(const AlgorithmComputeElement
*source
)
407 Inherited::onCreate(source
);
411 AlgorithmComputeElement
*pThis
= static_cast<AlgorithmComputeElement
*>(this);
413 pThis
->setAlgorithm(source
->getAlgorithm());
417 GetFieldHandlePtr
AlgorithmComputeElementBase::getHandleAlgorithm (void) const
419 SFUnrecComputeAlgorithmPtr::GetHandlePtr
returnValue(
420 new SFUnrecComputeAlgorithmPtr::GetHandle(
422 this->getType().getFieldDesc(AlgorithmFieldId
),
423 const_cast<AlgorithmComputeElementBase
*>(this)));
428 EditFieldHandlePtr
AlgorithmComputeElementBase::editHandleAlgorithm (void)
430 SFUnrecComputeAlgorithmPtr::EditHandlePtr
returnValue(
431 new SFUnrecComputeAlgorithmPtr::EditHandle(
433 this->getType().getFieldDesc(AlgorithmFieldId
),
436 returnValue
->setSetMethod(
437 boost::bind(&AlgorithmComputeElement::setAlgorithm
,
438 static_cast<AlgorithmComputeElement
*>(this), _1
));
440 editSField(AlgorithmFieldMask
);
446 #ifdef OSG_MT_CPTR_ASPECT
447 void AlgorithmComputeElementBase::execSyncV( FieldContainer
&oFrom
,
448 ConstFieldMaskArg whichField
,
449 AspectOffsetStore
&oOffsets
,
450 ConstFieldMaskArg syncMode
,
451 const UInt32 uiSyncInfo
)
453 AlgorithmComputeElement
*pThis
= static_cast<AlgorithmComputeElement
*>(this);
455 pThis
->execSync(static_cast<AlgorithmComputeElement
*>(&oFrom
),
464 #ifdef OSG_MT_CPTR_ASPECT
465 FieldContainer
*AlgorithmComputeElementBase::createAspectCopy(
466 const FieldContainer
*pRefAspect
) const
468 AlgorithmComputeElement
*returnValue
;
470 newAspectCopy(returnValue
,
471 dynamic_cast<const AlgorithmComputeElement
*>(pRefAspect
),
472 dynamic_cast<const AlgorithmComputeElement
*>(this));
478 void AlgorithmComputeElementBase::resolveLinks(void)
480 Inherited::resolveLinks();
482 static_cast<AlgorithmComputeElement
*>(this)->setAlgorithm(NULL
);