changed: gcc8 base update
[opensg.git] / Source / Contrib / ComputeBase / Base / OSGAlgorithmComputeElementBase.cpp
blobc4df473d46cc325d90c024937f5fdcff43c51522
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>(
145 reinterpret_cast<void *>(&AlgorithmComputeElement::classDescInserter)),
146 false,
148 "<?xml version=\"1.0\"?>\n"
149 "\n"
150 "<FieldContainer\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"
161 " >\n"
162 " <Field\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"
170 " >\n"
171 " </Field>\n"
172 "</FieldContainer>\n",
176 /*------------------------------ get -----------------------------------*/
178 FieldContainerType &AlgorithmComputeElementBase::getType(void)
180 return _type;
183 const FieldContainerType &AlgorithmComputeElementBase::getType(void) const
185 return _type;
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();
239 return returnValue;
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);
278 return fc;
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);
294 return fc;
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);
310 return fc;
313 AlgorithmComputeElement *AlgorithmComputeElementBase::createEmptyLocal(BitVector bFlags)
315 AlgorithmComputeElement *returnValue;
317 newPtr<AlgorithmComputeElement>(returnValue, bFlags);
319 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
321 return returnValue;
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();
334 return returnValue;
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;
349 return returnValue;
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;
363 return returnValue;
366 FieldContainerTransitPtr AlgorithmComputeElementBase::shallowCopy(void) const
368 AlgorithmComputeElement *tmpPtr;
370 newPtr(tmpPtr,
371 dynamic_cast<const AlgorithmComputeElement *>(this),
372 Thread::getCurrentLocalFlags());
374 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
376 FieldContainerTransitPtr returnValue(tmpPtr);
378 return returnValue;
384 /*------------------------- constructors ----------------------------------*/
386 AlgorithmComputeElementBase::AlgorithmComputeElementBase(void) :
387 Inherited(),
388 _sfAlgorithm (NULL)
392 AlgorithmComputeElementBase::AlgorithmComputeElementBase(const AlgorithmComputeElementBase &source) :
393 Inherited(source),
394 _sfAlgorithm (NULL)
399 /*-------------------------- destructors ----------------------------------*/
401 AlgorithmComputeElementBase::~AlgorithmComputeElementBase(void)
405 void AlgorithmComputeElementBase::onCreate(const AlgorithmComputeElement *source)
407 Inherited::onCreate(source);
409 if(source != NULL)
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(
421 &_sfAlgorithm,
422 this->getType().getFieldDesc(AlgorithmFieldId),
423 const_cast<AlgorithmComputeElementBase *>(this)));
425 return returnValue;
428 EditFieldHandlePtr AlgorithmComputeElementBase::editHandleAlgorithm (void)
430 SFUnrecComputeAlgorithmPtr::EditHandlePtr returnValue(
431 new SFUnrecComputeAlgorithmPtr::EditHandle(
432 &_sfAlgorithm,
433 this->getType().getFieldDesc(AlgorithmFieldId),
434 this));
436 returnValue->setSetMethod(
437 boost::bind(&AlgorithmComputeElement::setAlgorithm,
438 static_cast<AlgorithmComputeElement *>(this), _1));
440 editSField(AlgorithmFieldMask);
442 return returnValue;
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),
456 whichField,
457 oOffsets,
458 syncMode,
459 uiSyncInfo);
461 #endif
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));
474 return returnValue;
476 #endif
478 void AlgorithmComputeElementBase::resolveLinks(void)
480 Inherited::resolveLinks();
482 static_cast<AlgorithmComputeElement *>(this)->setAlgorithm(NULL);
488 OSG_END_NAMESPACE