changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / Properties / OSGGeoMultiPropertyDataBase.cpp
blob5bbd82db339deb9c9b6faa0f42b15f8061a4d8b2
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 GeoMultiPropertyData!
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"
66 #include "OSGGeoMultiPropertyDataBase.h"
67 #include "OSGGeoMultiPropertyData.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::GeoMultiPropertyData
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt8 GeoMultiPropertyDataBase::_mfIData
86 The data for the multi-properties.
89 /*! \var UInt32 GeoMultiPropertyDataBase::_sfGLId
90 The internal GL object id for the VBO, if used.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<GeoMultiPropertyData *, nsOSG>::_type(
100 "GeoMultiPropertyDataPtr",
101 "StateChunkPtr",
102 GeoMultiPropertyData::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(GeoMultiPropertyData *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 GeoMultiPropertyData *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 GeoMultiPropertyData *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void GeoMultiPropertyDataBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new MFUInt8::Description(
126 MFUInt8::getClassType(),
127 "iData",
128 "The data for the multi-properties.\n",
129 IDataFieldId, IDataFieldMask,
130 false,
131 (Field::MFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&GeoMultiPropertyData::editHandleIData),
133 static_cast<FieldGetMethodSig >(&GeoMultiPropertyData::getHandleIData));
135 oType.addInitialDesc(pDesc);
137 pDesc = new SFUInt32::Description(
138 SFUInt32::getClassType(),
139 "GLId",
140 "The internal GL object id for the VBO, if used.\n",
141 GLIdFieldId, GLIdFieldMask,
142 true,
143 (Field::FClusterLocal),
144 static_cast<FieldEditMethodSig>(&GeoMultiPropertyData::editHandleGLId),
145 static_cast<FieldGetMethodSig >(&GeoMultiPropertyData::getHandleGLId));
147 oType.addInitialDesc(pDesc);
151 GeoMultiPropertyDataBase::TypeObject GeoMultiPropertyDataBase::_type(
152 GeoMultiPropertyDataBase::getClassname(),
153 Inherited::getClassname(),
154 "NULL",
155 nsOSG, //Namespace
156 reinterpret_cast<PrototypeCreateF>(&GeoMultiPropertyDataBase::createEmptyLocal),
157 reinterpret_cast<InitContainerF>(&GeoMultiPropertyData::initMethod),
158 reinterpret_cast<ExitContainerF>(&GeoMultiPropertyData::exitMethod),
159 reinterpret_cast<InitalInsertDescFunc>(
160 reinterpret_cast<void *>(&GeoMultiPropertyData::classDescInserter)),
161 false,
163 "<?xml version=\"1.0\"?>\n"
164 "\n"
165 "<FieldContainer\n"
166 " name=\"GeoMultiPropertyData\"\n"
167 " parent=\"StateChunk\"\n"
168 " library=\"Drawable\"\n"
169 " pointerfieldtypes=\"both\"\n"
170 " structure=\"concrete\"\n"
171 " systemcomponent=\"true\"\n"
172 " parentsystemcomponent=\"true\"\n"
173 " decoratable=\"false\"\n"
174 " docGroupBase=\"GrpDrawablesGeometry\"\n"
175 " >\n"
176 " <Field\n"
177 " name=\"iData\"\n"
178 " type=\"UInt8\"\n"
179 " cardinality=\"multi\"\n"
180 " visibility=\"external\"\n"
181 " access=\"public\"\n"
182 " >\n"
183 "\tThe data for the multi-properties.\n"
184 " </Field>\n"
185 " <Field\n"
186 " name=\"GLId\"\n"
187 " type=\"UInt32\"\n"
188 " cardinality=\"single\"\n"
189 " visibility=\"internal\"\n"
190 " access=\"public\"\n"
191 " defaultValue=\"0\"\n"
192 " fieldFlags=\"FClusterLocal\"\n"
193 " >\n"
194 "\tThe internal GL object id for the VBO, if used.\n"
195 " </Field>\n"
196 "</FieldContainer>\n",
200 /*------------------------------ get -----------------------------------*/
202 FieldContainerType &GeoMultiPropertyDataBase::getType(void)
204 return _type;
207 const FieldContainerType &GeoMultiPropertyDataBase::getType(void) const
209 return _type;
212 UInt32 GeoMultiPropertyDataBase::getContainerSize(void) const
214 return sizeof(GeoMultiPropertyData);
217 /*------------------------- decorator get ------------------------------*/
220 MFUInt8 *GeoMultiPropertyDataBase::editMFIData(void)
222 editMField(IDataFieldMask, _mfIData);
224 return &_mfIData;
227 const MFUInt8 *GeoMultiPropertyDataBase::getMFIData(void) const
229 return &_mfIData;
233 SFUInt32 *GeoMultiPropertyDataBase::editSFGLId(void)
235 editSField(GLIdFieldMask);
237 return &_sfGLId;
240 const SFUInt32 *GeoMultiPropertyDataBase::getSFGLId(void) const
242 return &_sfGLId;
250 /*------------------------------ access -----------------------------------*/
252 SizeT GeoMultiPropertyDataBase::getBinSize(ConstFieldMaskArg whichField)
254 SizeT returnValue = Inherited::getBinSize(whichField);
256 if(FieldBits::NoField != (IDataFieldMask & whichField))
258 returnValue += _mfIData.getBinSize();
260 if(FieldBits::NoField != (GLIdFieldMask & whichField))
262 returnValue += _sfGLId.getBinSize();
265 return returnValue;
268 void GeoMultiPropertyDataBase::copyToBin(BinaryDataHandler &pMem,
269 ConstFieldMaskArg whichField)
271 Inherited::copyToBin(pMem, whichField);
273 if(FieldBits::NoField != (IDataFieldMask & whichField))
275 _mfIData.copyToBin(pMem);
277 if(FieldBits::NoField != (GLIdFieldMask & whichField))
279 _sfGLId.copyToBin(pMem);
283 void GeoMultiPropertyDataBase::copyFromBin(BinaryDataHandler &pMem,
284 ConstFieldMaskArg whichField)
286 Inherited::copyFromBin(pMem, whichField);
288 if(FieldBits::NoField != (IDataFieldMask & whichField))
290 editMField(IDataFieldMask, _mfIData);
291 _mfIData.copyFromBin(pMem);
293 if(FieldBits::NoField != (GLIdFieldMask & whichField))
295 editSField(GLIdFieldMask);
296 _sfGLId.copyFromBin(pMem);
300 //! create a new instance of the class
301 GeoMultiPropertyDataTransitPtr GeoMultiPropertyDataBase::createLocal(BitVector bFlags)
303 GeoMultiPropertyDataTransitPtr fc;
305 if(getClassType().getPrototype() != NULL)
307 FieldContainerTransitPtr tmpPtr =
308 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
310 fc = dynamic_pointer_cast<GeoMultiPropertyData>(tmpPtr);
313 return fc;
316 //! create a new instance of the class, copy the container flags
317 GeoMultiPropertyDataTransitPtr GeoMultiPropertyDataBase::createDependent(BitVector bFlags)
319 GeoMultiPropertyDataTransitPtr fc;
321 if(getClassType().getPrototype() != NULL)
323 FieldContainerTransitPtr tmpPtr =
324 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
326 fc = dynamic_pointer_cast<GeoMultiPropertyData>(tmpPtr);
329 return fc;
332 //! create a new instance of the class
333 GeoMultiPropertyDataTransitPtr GeoMultiPropertyDataBase::create(void)
335 GeoMultiPropertyDataTransitPtr fc;
337 if(getClassType().getPrototype() != NULL)
339 FieldContainerTransitPtr tmpPtr =
340 getClassType().getPrototype()-> shallowCopy();
342 fc = dynamic_pointer_cast<GeoMultiPropertyData>(tmpPtr);
345 return fc;
348 GeoMultiPropertyData *GeoMultiPropertyDataBase::createEmptyLocal(BitVector bFlags)
350 GeoMultiPropertyData *returnValue;
352 newPtr<GeoMultiPropertyData>(returnValue, bFlags);
354 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
356 return returnValue;
359 //! create an empty new instance of the class, do not copy the prototype
360 GeoMultiPropertyData *GeoMultiPropertyDataBase::createEmpty(void)
362 GeoMultiPropertyData *returnValue;
364 newPtr<GeoMultiPropertyData>(returnValue, Thread::getCurrentLocalFlags());
366 returnValue->_pFieldFlags->_bNamespaceMask &=
367 ~Thread::getCurrentLocalFlags();
369 return returnValue;
373 FieldContainerTransitPtr GeoMultiPropertyDataBase::shallowCopyLocal(
374 BitVector bFlags) const
376 GeoMultiPropertyData *tmpPtr;
378 newPtr(tmpPtr, dynamic_cast<const GeoMultiPropertyData *>(this), bFlags);
380 FieldContainerTransitPtr returnValue(tmpPtr);
382 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
384 return returnValue;
387 FieldContainerTransitPtr GeoMultiPropertyDataBase::shallowCopyDependent(
388 BitVector bFlags) const
390 GeoMultiPropertyData *tmpPtr;
392 newPtr(tmpPtr, dynamic_cast<const GeoMultiPropertyData *>(this), ~bFlags);
394 FieldContainerTransitPtr returnValue(tmpPtr);
396 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
398 return returnValue;
401 FieldContainerTransitPtr GeoMultiPropertyDataBase::shallowCopy(void) const
403 GeoMultiPropertyData *tmpPtr;
405 newPtr(tmpPtr,
406 dynamic_cast<const GeoMultiPropertyData *>(this),
407 Thread::getCurrentLocalFlags());
409 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
411 FieldContainerTransitPtr returnValue(tmpPtr);
413 return returnValue;
419 /*------------------------- constructors ----------------------------------*/
421 GeoMultiPropertyDataBase::GeoMultiPropertyDataBase(void) :
422 Inherited(),
423 _mfIData (),
424 _sfGLId (UInt32(0))
428 GeoMultiPropertyDataBase::GeoMultiPropertyDataBase(const GeoMultiPropertyDataBase &source) :
429 Inherited(source),
430 _mfIData (source._mfIData ),
431 _sfGLId (source._sfGLId )
436 /*-------------------------- destructors ----------------------------------*/
438 GeoMultiPropertyDataBase::~GeoMultiPropertyDataBase(void)
443 GetFieldHandlePtr GeoMultiPropertyDataBase::getHandleIData (void) const
445 MFUInt8::GetHandlePtr returnValue(
446 new MFUInt8::GetHandle(
447 &_mfIData,
448 this->getType().getFieldDesc(IDataFieldId),
449 const_cast<GeoMultiPropertyDataBase *>(this)));
451 return returnValue;
454 EditFieldHandlePtr GeoMultiPropertyDataBase::editHandleIData (void)
456 MFUInt8::EditHandlePtr returnValue(
457 new MFUInt8::EditHandle(
458 &_mfIData,
459 this->getType().getFieldDesc(IDataFieldId),
460 this));
463 editMField(IDataFieldMask, _mfIData);
465 return returnValue;
468 GetFieldHandlePtr GeoMultiPropertyDataBase::getHandleGLId (void) const
470 SFUInt32::GetHandlePtr returnValue(
471 new SFUInt32::GetHandle(
472 &_sfGLId,
473 this->getType().getFieldDesc(GLIdFieldId),
474 const_cast<GeoMultiPropertyDataBase *>(this)));
476 return returnValue;
479 EditFieldHandlePtr GeoMultiPropertyDataBase::editHandleGLId (void)
481 SFUInt32::EditHandlePtr returnValue(
482 new SFUInt32::EditHandle(
483 &_sfGLId,
484 this->getType().getFieldDesc(GLIdFieldId),
485 this));
488 editSField(GLIdFieldMask);
490 return returnValue;
494 #ifdef OSG_MT_CPTR_ASPECT
495 void GeoMultiPropertyDataBase::execSyncV( FieldContainer &oFrom,
496 ConstFieldMaskArg whichField,
497 AspectOffsetStore &oOffsets,
498 ConstFieldMaskArg syncMode,
499 const UInt32 uiSyncInfo)
501 GeoMultiPropertyData *pThis = static_cast<GeoMultiPropertyData *>(this);
503 pThis->execSync(static_cast<GeoMultiPropertyData *>(&oFrom),
504 whichField,
505 oOffsets,
506 syncMode,
507 uiSyncInfo);
509 #endif
512 #ifdef OSG_MT_CPTR_ASPECT
513 FieldContainer *GeoMultiPropertyDataBase::createAspectCopy(
514 const FieldContainer *pRefAspect) const
516 GeoMultiPropertyData *returnValue;
518 newAspectCopy(returnValue,
519 dynamic_cast<const GeoMultiPropertyData *>(pRefAspect),
520 dynamic_cast<const GeoMultiPropertyData *>(this));
522 return returnValue;
524 #endif
526 void GeoMultiPropertyDataBase::resolveLinks(void)
528 Inherited::resolveLinks();
530 #ifdef OSG_MT_CPTR_ASPECT
531 AspectOffsetStore oOffsets;
533 _pAspectStore->fillOffsetArray(oOffsets, this);
534 #endif
536 #ifdef OSG_MT_CPTR_ASPECT
537 _mfIData.terminateShare(Thread::getCurrentAspect(),
538 oOffsets);
539 #endif
543 OSG_END_NAMESPACE