fixed: gcc8 compile issues
[opensg.git] / Source / Contrib / ComputeBase / Base / OSGAlgorithmComputeElementBase.cpp
blob527d0f929a85583ba7ce22e3c3caa83042548320
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class AlgorithmComputeElement!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
65 #include "OSGComputeAlgorithm.h" // Algorithm Class
67 #include "OSGAlgorithmComputeElementBase.h"
68 #include "OSGAlgorithmComputeElement.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
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",
98 "ComputeElementPtr",
99 AlgorithmComputeElement::getClassType(),
100 nsOSG);
101 #endif
103 OSG_FIELDTRAITS_GETTYPE_NS(AlgorithmComputeElement *, nsOSG)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
106 AlgorithmComputeElement *,
107 nsOSG)
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
110 AlgorithmComputeElement *,
111 nsOSG)
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void AlgorithmComputeElementBase::classDescInserter(TypeObject &oType)
119 FieldDescriptionBase *pDesc = NULL;
122 pDesc = new SFUnrecComputeAlgorithmPtr::Description(
123 SFUnrecComputeAlgorithmPtr::getClassType(),
124 "algorithm",
126 AlgorithmFieldId, AlgorithmFieldMask,
127 false,
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(),
139 "NULL",
140 nsOSG, //Namespace
141 reinterpret_cast<PrototypeCreateF>(&AlgorithmComputeElementBase::createEmptyLocal),
142 reinterpret_cast<InitContainerF>(&AlgorithmComputeElement::initMethod),
143 reinterpret_cast<ExitContainerF>(&AlgorithmComputeElement::exitMethod),
144 reinterpret_cast<InitalInsertDescFunc>(&AlgorithmComputeElement::classDescInserter),
145 false,
147 "<?xml version=\"1.0\"?>\n"
148 "\n"
149 "<FieldContainer\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"
160 " >\n"
161 " <Field\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"
169 " >\n"
170 " </Field>\n"
171 "</FieldContainer>\n",
175 /*------------------------------ get -----------------------------------*/
177 FieldContainerType &AlgorithmComputeElementBase::getType(void)
179 return _type;
182 const FieldContainerType &AlgorithmComputeElementBase::getType(void) const
184 return _type;
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();
238 return returnValue;
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);
277 return fc;
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);
293 return fc;
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);
309 return fc;
312 AlgorithmComputeElement *AlgorithmComputeElementBase::createEmptyLocal(BitVector bFlags)
314 AlgorithmComputeElement *returnValue;
316 newPtr<AlgorithmComputeElement>(returnValue, bFlags);
318 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
320 return returnValue;
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();
333 return returnValue;
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;
348 return returnValue;
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;
362 return returnValue;
365 FieldContainerTransitPtr AlgorithmComputeElementBase::shallowCopy(void) const
367 AlgorithmComputeElement *tmpPtr;
369 newPtr(tmpPtr,
370 dynamic_cast<const AlgorithmComputeElement *>(this),
371 Thread::getCurrentLocalFlags());
373 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
375 FieldContainerTransitPtr returnValue(tmpPtr);
377 return returnValue;
383 /*------------------------- constructors ----------------------------------*/
385 AlgorithmComputeElementBase::AlgorithmComputeElementBase(void) :
386 Inherited(),
387 _sfAlgorithm (NULL)
391 AlgorithmComputeElementBase::AlgorithmComputeElementBase(const AlgorithmComputeElementBase &source) :
392 Inherited(source),
393 _sfAlgorithm (NULL)
398 /*-------------------------- destructors ----------------------------------*/
400 AlgorithmComputeElementBase::~AlgorithmComputeElementBase(void)
404 void AlgorithmComputeElementBase::onCreate(const AlgorithmComputeElement *source)
406 Inherited::onCreate(source);
408 if(source != NULL)
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(
420 &_sfAlgorithm,
421 this->getType().getFieldDesc(AlgorithmFieldId),
422 const_cast<AlgorithmComputeElementBase *>(this)));
424 return returnValue;
427 EditFieldHandlePtr AlgorithmComputeElementBase::editHandleAlgorithm (void)
429 SFUnrecComputeAlgorithmPtr::EditHandlePtr returnValue(
430 new SFUnrecComputeAlgorithmPtr::EditHandle(
431 &_sfAlgorithm,
432 this->getType().getFieldDesc(AlgorithmFieldId),
433 this));
435 returnValue->setSetMethod(
436 boost::bind(&AlgorithmComputeElement::setAlgorithm,
437 static_cast<AlgorithmComputeElement *>(this), _1));
439 editSField(AlgorithmFieldMask);
441 return returnValue;
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),
455 whichField,
456 oOffsets,
457 syncMode,
458 uiSyncInfo);
460 #endif
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));
473 return returnValue;
475 #endif
477 void AlgorithmComputeElementBase::resolveLinks(void)
479 Inherited::resolveLinks();
481 static_cast<AlgorithmComputeElement *>(this)->setAlgorithm(NULL);
487 OSG_END_NAMESPACE