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 ChunkListHelper!
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 "OSGStateChunk.h" // Chunk Class
67 #include "OSGChunkListHelperBase.h"
68 #include "OSGChunkListHelper.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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",
103 ChunkListHelper::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(ChunkListHelper
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void ChunkListHelperBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new SFInt32::Description(
127 SFInt32::getClassType(),
130 SlotFieldId
, SlotFieldMask
,
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(),
142 ChunkFieldId
, ChunkFieldMask
,
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(),
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
)),
164 "<?xml version=\"1.0\" ?>\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"
178 "\t type=\"Int32\"\n"
179 "\t cardinality=\"single\"\n"
180 "\t visibility=\"external\"\n"
181 "\t access=\"public\"\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"
192 "</FieldContainer>\n",
196 /*------------------------------ get -----------------------------------*/
198 FieldContainerType
&ChunkListHelperBase::getType(void)
203 const FieldContainerType
&ChunkListHelperBase::getType(void) const
208 UInt32
ChunkListHelperBase::getContainerSize(void) const
210 return sizeof(ChunkListHelper
);
213 /*------------------------- decorator get ------------------------------*/
216 SFInt32
*ChunkListHelperBase::editSFSlot(void)
218 editSField(SlotFieldMask
);
223 const SFInt32
*ChunkListHelperBase::getSFSlot(void) const
229 //! Get the ChunkListHelper::_sfChunk field.
230 const SFUnrecStateChunkPtr
*ChunkListHelperBase::getSFChunk(void) const
235 SFUnrecStateChunkPtr
*ChunkListHelperBase::editSFChunk (void)
237 editSField(ChunkFieldMask
);
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();
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
);
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
);
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
);
359 ChunkListHelper
*ChunkListHelperBase::createEmptyLocal(BitVector bFlags
)
361 ChunkListHelper
*returnValue
;
363 newPtr
<ChunkListHelper
>(returnValue
, bFlags
);
365 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
412 FieldContainerTransitPtr
ChunkListHelperBase::shallowCopy(void) const
414 ChunkListHelper
*tmpPtr
;
417 dynamic_cast<const ChunkListHelper
*>(this),
418 Thread::getCurrentLocalFlags());
420 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
422 FieldContainerTransitPtr
returnValue(tmpPtr
);
430 /*------------------------- constructors ----------------------------------*/
432 ChunkListHelperBase::ChunkListHelperBase(void) :
439 ChunkListHelperBase::ChunkListHelperBase(const ChunkListHelperBase
&source
) :
441 _sfSlot (source
._sfSlot
),
447 /*-------------------------- destructors ----------------------------------*/
449 ChunkListHelperBase::~ChunkListHelperBase(void)
453 void ChunkListHelperBase::onCreate(const ChunkListHelper
*source
)
455 Inherited::onCreate(source
);
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(
470 this->getType().getFieldDesc(SlotFieldId
),
471 const_cast<ChunkListHelperBase
*>(this)));
476 EditFieldHandlePtr
ChunkListHelperBase::editHandleSlot (void)
478 SFInt32::EditHandlePtr
returnValue(
479 new SFInt32::EditHandle(
481 this->getType().getFieldDesc(SlotFieldId
),
485 editSField(SlotFieldMask
);
490 GetFieldHandlePtr
ChunkListHelperBase::getHandleChunk (void) const
492 SFUnrecStateChunkPtr::GetHandlePtr
returnValue(
493 new SFUnrecStateChunkPtr::GetHandle(
495 this->getType().getFieldDesc(ChunkFieldId
),
496 const_cast<ChunkListHelperBase
*>(this)));
501 EditFieldHandlePtr
ChunkListHelperBase::editHandleChunk (void)
503 SFUnrecStateChunkPtr::EditHandlePtr
returnValue(
504 new SFUnrecStateChunkPtr::EditHandle(
506 this->getType().getFieldDesc(ChunkFieldId
),
509 returnValue
->setSetMethod(
510 boost::bind(&ChunkListHelper::setChunk
,
511 static_cast<ChunkListHelper
*>(this), _1
));
513 editSField(ChunkFieldMask
);
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
),
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));
551 void ChunkListHelperBase::resolveLinks(void)
553 Inherited::resolveLinks();
555 static_cast<ChunkListHelper
*>(this)->setChunk(NULL
);