changed: gcc8 base update
[opensg.git] / Source / System / State / Base / OSGChunkListHelperBase.cpp
blobe1134f14fc705daeb4a01f25bef43af591d37746
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 ChunkListHelper!
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 "OSGStateChunk.h" // Chunk Class
67 #include "OSGChunkListHelperBase.h"
68 #include "OSGChunkListHelper.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::ChunkListHelper
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Int32 ChunkListHelperBase::_sfSlot
90 /*! \var StateChunk * ChunkListHelperBase::_sfChunk
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits<ChunkListHelper *, nsOSG>::_type(
101 "ChunkListHelperPtr",
102 "FieldContainerPtr",
103 ChunkListHelper::getClassType(),
104 nsOSG);
105 #endif
107 OSG_FIELDTRAITS_GETTYPE_NS(ChunkListHelper *, nsOSG)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
110 ChunkListHelper *,
111 nsOSG)
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
114 ChunkListHelper *,
115 nsOSG)
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void ChunkListHelperBase::classDescInserter(TypeObject &oType)
123 FieldDescriptionBase *pDesc = NULL;
126 pDesc = new SFInt32::Description(
127 SFInt32::getClassType(),
128 "slot",
130 SlotFieldId, SlotFieldMask,
131 false,
132 (Field::SFDefaultFlags | Field::FStdAccess),
133 static_cast<FieldEditMethodSig>(&ChunkListHelper::editHandleSlot),
134 static_cast<FieldGetMethodSig >(&ChunkListHelper::getHandleSlot));
136 oType.addInitialDesc(pDesc);
138 pDesc = new SFUnrecStateChunkPtr::Description(
139 SFUnrecStateChunkPtr::getClassType(),
140 "chunk",
142 ChunkFieldId, ChunkFieldMask,
143 false,
144 (Field::SFDefaultFlags | Field::FStdAccess),
145 static_cast<FieldEditMethodSig>(&ChunkListHelper::editHandleChunk),
146 static_cast<FieldGetMethodSig >(&ChunkListHelper::getHandleChunk));
148 oType.addInitialDesc(pDesc);
152 ChunkListHelperBase::TypeObject ChunkListHelperBase::_type(
153 ChunkListHelperBase::getClassname(),
154 Inherited::getClassname(),
155 "NULL",
156 nsOSG, //Namespace
157 reinterpret_cast<PrototypeCreateF>(&ChunkListHelperBase::createEmptyLocal),
158 reinterpret_cast<InitContainerF>(&ChunkListHelper::initMethod),
159 reinterpret_cast<ExitContainerF>(&ChunkListHelper::exitMethod),
160 reinterpret_cast<InitalInsertDescFunc>(
161 reinterpret_cast<void *>(&ChunkListHelper::classDescInserter)),
162 false,
164 "<?xml version=\"1.0\" ?>\n"
165 "\n"
166 "<FieldContainer\n"
167 " name=\"ChunkListHelper\"\n"
168 " parent=\"FieldContainer\"\n"
169 " library=\"System\"\n"
170 " structure=\"concrete\"\n"
171 " pointerfieldtypes=\"both\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
174 " docGroupBase=\"GrpSystemFieldContainer\"\n"
175 ">\n"
176 " <Field\n"
177 "\t name=\"slot\"\n"
178 "\t type=\"Int32\"\n"
179 "\t cardinality=\"single\"\n"
180 "\t visibility=\"external\"\n"
181 "\t access=\"public\"\n"
182 "\t >\n"
183 " </Field>\n"
184 " <Field\n"
185 "\t name=\"chunk\"\n"
186 "\t type=\"StateChunkPtr\"\n"
187 "\t cardinality=\"single\"\n"
188 "\t visibility=\"external\"\n"
189 " access=\"public\"\n"
190 "\t >\n"
191 " </Field>\n"
192 "</FieldContainer>\n",
196 /*------------------------------ get -----------------------------------*/
198 FieldContainerType &ChunkListHelperBase::getType(void)
200 return _type;
203 const FieldContainerType &ChunkListHelperBase::getType(void) const
205 return _type;
208 UInt32 ChunkListHelperBase::getContainerSize(void) const
210 return sizeof(ChunkListHelper);
213 /*------------------------- decorator get ------------------------------*/
216 SFInt32 *ChunkListHelperBase::editSFSlot(void)
218 editSField(SlotFieldMask);
220 return &_sfSlot;
223 const SFInt32 *ChunkListHelperBase::getSFSlot(void) const
225 return &_sfSlot;
229 //! Get the ChunkListHelper::_sfChunk field.
230 const SFUnrecStateChunkPtr *ChunkListHelperBase::getSFChunk(void) const
232 return &_sfChunk;
235 SFUnrecStateChunkPtr *ChunkListHelperBase::editSFChunk (void)
237 editSField(ChunkFieldMask);
239 return &_sfChunk;
242 //! Get the value of the ChunkListHelper::_sfChunk field.
243 StateChunk * ChunkListHelperBase::getChunk(void) const
245 return _sfChunk.getValue();
248 //! Set the value of the ChunkListHelper::_sfChunk field.
249 void ChunkListHelperBase::setChunk(StateChunk * const value)
251 editSField(ChunkFieldMask);
253 _sfChunk.setValue(value);
261 /*------------------------------ access -----------------------------------*/
263 SizeT ChunkListHelperBase::getBinSize(ConstFieldMaskArg whichField)
265 SizeT returnValue = Inherited::getBinSize(whichField);
267 if(FieldBits::NoField != (SlotFieldMask & whichField))
269 returnValue += _sfSlot.getBinSize();
271 if(FieldBits::NoField != (ChunkFieldMask & whichField))
273 returnValue += _sfChunk.getBinSize();
276 return returnValue;
279 void ChunkListHelperBase::copyToBin(BinaryDataHandler &pMem,
280 ConstFieldMaskArg whichField)
282 Inherited::copyToBin(pMem, whichField);
284 if(FieldBits::NoField != (SlotFieldMask & whichField))
286 _sfSlot.copyToBin(pMem);
288 if(FieldBits::NoField != (ChunkFieldMask & whichField))
290 _sfChunk.copyToBin(pMem);
294 void ChunkListHelperBase::copyFromBin(BinaryDataHandler &pMem,
295 ConstFieldMaskArg whichField)
297 Inherited::copyFromBin(pMem, whichField);
299 if(FieldBits::NoField != (SlotFieldMask & whichField))
301 editSField(SlotFieldMask);
302 _sfSlot.copyFromBin(pMem);
304 if(FieldBits::NoField != (ChunkFieldMask & whichField))
306 editSField(ChunkFieldMask);
307 _sfChunk.copyFromBin(pMem);
311 //! create a new instance of the class
312 ChunkListHelperTransitPtr ChunkListHelperBase::createLocal(BitVector bFlags)
314 ChunkListHelperTransitPtr fc;
316 if(getClassType().getPrototype() != NULL)
318 FieldContainerTransitPtr tmpPtr =
319 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
321 fc = dynamic_pointer_cast<ChunkListHelper>(tmpPtr);
324 return fc;
327 //! create a new instance of the class, copy the container flags
328 ChunkListHelperTransitPtr ChunkListHelperBase::createDependent(BitVector bFlags)
330 ChunkListHelperTransitPtr fc;
332 if(getClassType().getPrototype() != NULL)
334 FieldContainerTransitPtr tmpPtr =
335 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
337 fc = dynamic_pointer_cast<ChunkListHelper>(tmpPtr);
340 return fc;
343 //! create a new instance of the class
344 ChunkListHelperTransitPtr ChunkListHelperBase::create(void)
346 ChunkListHelperTransitPtr fc;
348 if(getClassType().getPrototype() != NULL)
350 FieldContainerTransitPtr tmpPtr =
351 getClassType().getPrototype()-> shallowCopy();
353 fc = dynamic_pointer_cast<ChunkListHelper>(tmpPtr);
356 return fc;
359 ChunkListHelper *ChunkListHelperBase::createEmptyLocal(BitVector bFlags)
361 ChunkListHelper *returnValue;
363 newPtr<ChunkListHelper>(returnValue, bFlags);
365 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
367 return returnValue;
370 //! create an empty new instance of the class, do not copy the prototype
371 ChunkListHelper *ChunkListHelperBase::createEmpty(void)
373 ChunkListHelper *returnValue;
375 newPtr<ChunkListHelper>(returnValue, Thread::getCurrentLocalFlags());
377 returnValue->_pFieldFlags->_bNamespaceMask &=
378 ~Thread::getCurrentLocalFlags();
380 return returnValue;
384 FieldContainerTransitPtr ChunkListHelperBase::shallowCopyLocal(
385 BitVector bFlags) const
387 ChunkListHelper *tmpPtr;
389 newPtr(tmpPtr, dynamic_cast<const ChunkListHelper *>(this), bFlags);
391 FieldContainerTransitPtr returnValue(tmpPtr);
393 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
395 return returnValue;
398 FieldContainerTransitPtr ChunkListHelperBase::shallowCopyDependent(
399 BitVector bFlags) const
401 ChunkListHelper *tmpPtr;
403 newPtr(tmpPtr, dynamic_cast<const ChunkListHelper *>(this), ~bFlags);
405 FieldContainerTransitPtr returnValue(tmpPtr);
407 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
409 return returnValue;
412 FieldContainerTransitPtr ChunkListHelperBase::shallowCopy(void) const
414 ChunkListHelper *tmpPtr;
416 newPtr(tmpPtr,
417 dynamic_cast<const ChunkListHelper *>(this),
418 Thread::getCurrentLocalFlags());
420 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
422 FieldContainerTransitPtr returnValue(tmpPtr);
424 return returnValue;
430 /*------------------------- constructors ----------------------------------*/
432 ChunkListHelperBase::ChunkListHelperBase(void) :
433 Inherited(),
434 _sfSlot (),
435 _sfChunk (NULL)
439 ChunkListHelperBase::ChunkListHelperBase(const ChunkListHelperBase &source) :
440 Inherited(source),
441 _sfSlot (source._sfSlot ),
442 _sfChunk (NULL)
447 /*-------------------------- destructors ----------------------------------*/
449 ChunkListHelperBase::~ChunkListHelperBase(void)
453 void ChunkListHelperBase::onCreate(const ChunkListHelper *source)
455 Inherited::onCreate(source);
457 if(source != NULL)
459 ChunkListHelper *pThis = static_cast<ChunkListHelper *>(this);
461 pThis->setChunk(source->getChunk());
465 GetFieldHandlePtr ChunkListHelperBase::getHandleSlot (void) const
467 SFInt32::GetHandlePtr returnValue(
468 new SFInt32::GetHandle(
469 &_sfSlot,
470 this->getType().getFieldDesc(SlotFieldId),
471 const_cast<ChunkListHelperBase *>(this)));
473 return returnValue;
476 EditFieldHandlePtr ChunkListHelperBase::editHandleSlot (void)
478 SFInt32::EditHandlePtr returnValue(
479 new SFInt32::EditHandle(
480 &_sfSlot,
481 this->getType().getFieldDesc(SlotFieldId),
482 this));
485 editSField(SlotFieldMask);
487 return returnValue;
490 GetFieldHandlePtr ChunkListHelperBase::getHandleChunk (void) const
492 SFUnrecStateChunkPtr::GetHandlePtr returnValue(
493 new SFUnrecStateChunkPtr::GetHandle(
494 &_sfChunk,
495 this->getType().getFieldDesc(ChunkFieldId),
496 const_cast<ChunkListHelperBase *>(this)));
498 return returnValue;
501 EditFieldHandlePtr ChunkListHelperBase::editHandleChunk (void)
503 SFUnrecStateChunkPtr::EditHandlePtr returnValue(
504 new SFUnrecStateChunkPtr::EditHandle(
505 &_sfChunk,
506 this->getType().getFieldDesc(ChunkFieldId),
507 this));
509 returnValue->setSetMethod(
510 boost::bind(&ChunkListHelper::setChunk,
511 static_cast<ChunkListHelper *>(this), _1));
513 editSField(ChunkFieldMask);
515 return returnValue;
519 #ifdef OSG_MT_CPTR_ASPECT
520 void ChunkListHelperBase::execSyncV( FieldContainer &oFrom,
521 ConstFieldMaskArg whichField,
522 AspectOffsetStore &oOffsets,
523 ConstFieldMaskArg syncMode,
524 const UInt32 uiSyncInfo)
526 ChunkListHelper *pThis = static_cast<ChunkListHelper *>(this);
528 pThis->execSync(static_cast<ChunkListHelper *>(&oFrom),
529 whichField,
530 oOffsets,
531 syncMode,
532 uiSyncInfo);
534 #endif
537 #ifdef OSG_MT_CPTR_ASPECT
538 FieldContainer *ChunkListHelperBase::createAspectCopy(
539 const FieldContainer *pRefAspect) const
541 ChunkListHelper *returnValue;
543 newAspectCopy(returnValue,
544 dynamic_cast<const ChunkListHelper *>(pRefAspect),
545 dynamic_cast<const ChunkListHelper *>(this));
547 return returnValue;
549 #endif
551 void ChunkListHelperBase::resolveLinks(void)
553 Inherited::resolveLinks();
555 static_cast<ChunkListHelper *>(this)->setChunk(NULL);
561 OSG_END_NAMESPACE