changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGRangeLODBase.cpp
blob51fa4b39f0b9e39deccfcb95a549d38998cfcbfd
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 RangeLOD!
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 "OSGRangeLODBase.h"
67 #include "OSGRangeLOD.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::RangeLOD
78 OpenFlight LOD
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Pnt3f RangeLODBase::_sfCenter
86 The center for distance calculation.
89 /*! \var Real32 RangeLODBase::_sfSwitchIn
90 The range intervals.
93 /*! \var Real32 RangeLODBase::_sfSwitchOut
94 The range intervals.
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits<RangeLOD *, nsOSG>::_type(
104 "RangeLODPtr",
105 "GroupPtr",
106 RangeLOD::getClassType(),
107 nsOSG);
108 #endif
110 OSG_FIELDTRAITS_GETTYPE_NS(RangeLOD *, nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void RangeLODBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new SFPnt3f::Description(
122 SFPnt3f::getClassType(),
123 "center",
124 "The center for distance calculation.\n",
125 CenterFieldId, CenterFieldMask,
126 false,
127 (Field::SFDefaultFlags | Field::FStdAccess),
128 static_cast<FieldEditMethodSig>(&RangeLOD::editHandleCenter),
129 static_cast<FieldGetMethodSig >(&RangeLOD::getHandleCenter));
131 oType.addInitialDesc(pDesc);
133 pDesc = new SFReal32::Description(
134 SFReal32::getClassType(),
135 "switchIn",
136 "The range intervals.\n",
137 SwitchInFieldId, SwitchInFieldMask,
138 false,
139 (Field::SFDefaultFlags | Field::FStdAccess),
140 static_cast<FieldEditMethodSig>(&RangeLOD::editHandleSwitchIn),
141 static_cast<FieldGetMethodSig >(&RangeLOD::getHandleSwitchIn));
143 oType.addInitialDesc(pDesc);
145 pDesc = new SFReal32::Description(
146 SFReal32::getClassType(),
147 "switchOut",
148 "The range intervals.\n",
149 SwitchOutFieldId, SwitchOutFieldMask,
150 false,
151 (Field::SFDefaultFlags | Field::FStdAccess),
152 static_cast<FieldEditMethodSig>(&RangeLOD::editHandleSwitchOut),
153 static_cast<FieldGetMethodSig >(&RangeLOD::getHandleSwitchOut));
155 oType.addInitialDesc(pDesc);
159 RangeLODBase::TypeObject RangeLODBase::_type(
160 RangeLODBase::getClassname(),
161 Inherited::getClassname(),
162 "NULL",
163 nsOSG, //Namespace
164 reinterpret_cast<PrototypeCreateF>(&RangeLODBase::createEmptyLocal),
165 reinterpret_cast<InitContainerF>(&RangeLOD::initMethod),
166 reinterpret_cast<ExitContainerF>(&RangeLOD::exitMethod),
167 reinterpret_cast<InitalInsertDescFunc>(
168 reinterpret_cast<void *>(&RangeLOD::classDescInserter)),
169 false,
171 "<?xml version=\"1.0\"?>\n"
172 "\n"
173 "<FieldContainer\n"
174 " name=\"RangeLOD\"\n"
175 " parent=\"Group\"\n"
176 " library=\"Group\"\n"
177 " pointerfieldtypes=\"none\"\n"
178 " structure=\"concrete\"\n"
179 " systemcomponent=\"true\"\n"
180 " parentsystemcomponent=\"true\"\n"
181 " isNodeCore=\"true\"\n"
182 " docGroupBase=\"GrpGroupMisc\"\n"
183 " >\n"
184 " OpenFlight LOD\n"
185 " <Field\n"
186 "\t name=\"center\"\n"
187 "\t type=\"Pnt3f\"\n"
188 "\t cardinality=\"single\"\n"
189 "\t visibility=\"external\"\n"
190 "\t access=\"public\"\n"
191 "\t >\n"
192 "\tThe center for distance calculation.\n"
193 " </Field>\n"
194 " <Field\n"
195 "\t name=\"switchIn\"\n"
196 "\t type=\"Real32\"\n"
197 "\t cardinality=\"single\"\n"
198 "\t visibility=\"external\"\n"
199 "\t access=\"public\"\n"
200 "\t >\n"
201 "\tThe range intervals.\n"
202 " </Field>\n"
203 " <Field\n"
204 "\t name=\"switchOut\"\n"
205 "\t type=\"Real32\"\n"
206 "\t cardinality=\"single\"\n"
207 "\t visibility=\"external\"\n"
208 "\t access=\"public\"\n"
209 "\t >\n"
210 "\tThe range intervals.\n"
211 " </Field>\n"
212 "</FieldContainer>\n",
213 "OpenFlight LOD\n"
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType &RangeLODBase::getType(void)
220 return _type;
223 const FieldContainerType &RangeLODBase::getType(void) const
225 return _type;
228 UInt32 RangeLODBase::getContainerSize(void) const
230 return sizeof(RangeLOD);
233 /*------------------------- decorator get ------------------------------*/
236 SFPnt3f *RangeLODBase::editSFCenter(void)
238 editSField(CenterFieldMask);
240 return &_sfCenter;
243 const SFPnt3f *RangeLODBase::getSFCenter(void) const
245 return &_sfCenter;
249 SFReal32 *RangeLODBase::editSFSwitchIn(void)
251 editSField(SwitchInFieldMask);
253 return &_sfSwitchIn;
256 const SFReal32 *RangeLODBase::getSFSwitchIn(void) const
258 return &_sfSwitchIn;
262 SFReal32 *RangeLODBase::editSFSwitchOut(void)
264 editSField(SwitchOutFieldMask);
266 return &_sfSwitchOut;
269 const SFReal32 *RangeLODBase::getSFSwitchOut(void) const
271 return &_sfSwitchOut;
279 /*------------------------------ access -----------------------------------*/
281 SizeT RangeLODBase::getBinSize(ConstFieldMaskArg whichField)
283 SizeT returnValue = Inherited::getBinSize(whichField);
285 if(FieldBits::NoField != (CenterFieldMask & whichField))
287 returnValue += _sfCenter.getBinSize();
289 if(FieldBits::NoField != (SwitchInFieldMask & whichField))
291 returnValue += _sfSwitchIn.getBinSize();
293 if(FieldBits::NoField != (SwitchOutFieldMask & whichField))
295 returnValue += _sfSwitchOut.getBinSize();
298 return returnValue;
301 void RangeLODBase::copyToBin(BinaryDataHandler &pMem,
302 ConstFieldMaskArg whichField)
304 Inherited::copyToBin(pMem, whichField);
306 if(FieldBits::NoField != (CenterFieldMask & whichField))
308 _sfCenter.copyToBin(pMem);
310 if(FieldBits::NoField != (SwitchInFieldMask & whichField))
312 _sfSwitchIn.copyToBin(pMem);
314 if(FieldBits::NoField != (SwitchOutFieldMask & whichField))
316 _sfSwitchOut.copyToBin(pMem);
320 void RangeLODBase::copyFromBin(BinaryDataHandler &pMem,
321 ConstFieldMaskArg whichField)
323 Inherited::copyFromBin(pMem, whichField);
325 if(FieldBits::NoField != (CenterFieldMask & whichField))
327 editSField(CenterFieldMask);
328 _sfCenter.copyFromBin(pMem);
330 if(FieldBits::NoField != (SwitchInFieldMask & whichField))
332 editSField(SwitchInFieldMask);
333 _sfSwitchIn.copyFromBin(pMem);
335 if(FieldBits::NoField != (SwitchOutFieldMask & whichField))
337 editSField(SwitchOutFieldMask);
338 _sfSwitchOut.copyFromBin(pMem);
342 //! create a new instance of the class
343 RangeLODTransitPtr RangeLODBase::createLocal(BitVector bFlags)
345 RangeLODTransitPtr fc;
347 if(getClassType().getPrototype() != NULL)
349 FieldContainerTransitPtr tmpPtr =
350 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
352 fc = dynamic_pointer_cast<RangeLOD>(tmpPtr);
355 return fc;
358 //! create a new instance of the class, copy the container flags
359 RangeLODTransitPtr RangeLODBase::createDependent(BitVector bFlags)
361 RangeLODTransitPtr fc;
363 if(getClassType().getPrototype() != NULL)
365 FieldContainerTransitPtr tmpPtr =
366 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
368 fc = dynamic_pointer_cast<RangeLOD>(tmpPtr);
371 return fc;
374 //! create a new instance of the class
375 RangeLODTransitPtr RangeLODBase::create(void)
377 RangeLODTransitPtr fc;
379 if(getClassType().getPrototype() != NULL)
381 FieldContainerTransitPtr tmpPtr =
382 getClassType().getPrototype()-> shallowCopy();
384 fc = dynamic_pointer_cast<RangeLOD>(tmpPtr);
387 return fc;
390 RangeLOD *RangeLODBase::createEmptyLocal(BitVector bFlags)
392 RangeLOD *returnValue;
394 newPtr<RangeLOD>(returnValue, bFlags);
396 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
398 return returnValue;
401 //! create an empty new instance of the class, do not copy the prototype
402 RangeLOD *RangeLODBase::createEmpty(void)
404 RangeLOD *returnValue;
406 newPtr<RangeLOD>(returnValue, Thread::getCurrentLocalFlags());
408 returnValue->_pFieldFlags->_bNamespaceMask &=
409 ~Thread::getCurrentLocalFlags();
411 return returnValue;
415 FieldContainerTransitPtr RangeLODBase::shallowCopyLocal(
416 BitVector bFlags) const
418 RangeLOD *tmpPtr;
420 newPtr(tmpPtr, dynamic_cast<const RangeLOD *>(this), bFlags);
422 FieldContainerTransitPtr returnValue(tmpPtr);
424 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
426 return returnValue;
429 FieldContainerTransitPtr RangeLODBase::shallowCopyDependent(
430 BitVector bFlags) const
432 RangeLOD *tmpPtr;
434 newPtr(tmpPtr, dynamic_cast<const RangeLOD *>(this), ~bFlags);
436 FieldContainerTransitPtr returnValue(tmpPtr);
438 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
440 return returnValue;
443 FieldContainerTransitPtr RangeLODBase::shallowCopy(void) const
445 RangeLOD *tmpPtr;
447 newPtr(tmpPtr,
448 dynamic_cast<const RangeLOD *>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr returnValue(tmpPtr);
455 return returnValue;
461 /*------------------------- constructors ----------------------------------*/
463 RangeLODBase::RangeLODBase(void) :
464 Inherited(),
465 _sfCenter (),
466 _sfSwitchIn (),
467 _sfSwitchOut ()
471 RangeLODBase::RangeLODBase(const RangeLODBase &source) :
472 Inherited(source),
473 _sfCenter (source._sfCenter ),
474 _sfSwitchIn (source._sfSwitchIn ),
475 _sfSwitchOut (source._sfSwitchOut )
480 /*-------------------------- destructors ----------------------------------*/
482 RangeLODBase::~RangeLODBase(void)
487 GetFieldHandlePtr RangeLODBase::getHandleCenter (void) const
489 SFPnt3f::GetHandlePtr returnValue(
490 new SFPnt3f::GetHandle(
491 &_sfCenter,
492 this->getType().getFieldDesc(CenterFieldId),
493 const_cast<RangeLODBase *>(this)));
495 return returnValue;
498 EditFieldHandlePtr RangeLODBase::editHandleCenter (void)
500 SFPnt3f::EditHandlePtr returnValue(
501 new SFPnt3f::EditHandle(
502 &_sfCenter,
503 this->getType().getFieldDesc(CenterFieldId),
504 this));
507 editSField(CenterFieldMask);
509 return returnValue;
512 GetFieldHandlePtr RangeLODBase::getHandleSwitchIn (void) const
514 SFReal32::GetHandlePtr returnValue(
515 new SFReal32::GetHandle(
516 &_sfSwitchIn,
517 this->getType().getFieldDesc(SwitchInFieldId),
518 const_cast<RangeLODBase *>(this)));
520 return returnValue;
523 EditFieldHandlePtr RangeLODBase::editHandleSwitchIn (void)
525 SFReal32::EditHandlePtr returnValue(
526 new SFReal32::EditHandle(
527 &_sfSwitchIn,
528 this->getType().getFieldDesc(SwitchInFieldId),
529 this));
532 editSField(SwitchInFieldMask);
534 return returnValue;
537 GetFieldHandlePtr RangeLODBase::getHandleSwitchOut (void) const
539 SFReal32::GetHandlePtr returnValue(
540 new SFReal32::GetHandle(
541 &_sfSwitchOut,
542 this->getType().getFieldDesc(SwitchOutFieldId),
543 const_cast<RangeLODBase *>(this)));
545 return returnValue;
548 EditFieldHandlePtr RangeLODBase::editHandleSwitchOut (void)
550 SFReal32::EditHandlePtr returnValue(
551 new SFReal32::EditHandle(
552 &_sfSwitchOut,
553 this->getType().getFieldDesc(SwitchOutFieldId),
554 this));
557 editSField(SwitchOutFieldMask);
559 return returnValue;
563 #ifdef OSG_MT_CPTR_ASPECT
564 void RangeLODBase::execSyncV( FieldContainer &oFrom,
565 ConstFieldMaskArg whichField,
566 AspectOffsetStore &oOffsets,
567 ConstFieldMaskArg syncMode,
568 const UInt32 uiSyncInfo)
570 RangeLOD *pThis = static_cast<RangeLOD *>(this);
572 pThis->execSync(static_cast<RangeLOD *>(&oFrom),
573 whichField,
574 oOffsets,
575 syncMode,
576 uiSyncInfo);
578 #endif
581 #ifdef OSG_MT_CPTR_ASPECT
582 FieldContainer *RangeLODBase::createAspectCopy(
583 const FieldContainer *pRefAspect) const
585 RangeLOD *returnValue;
587 newAspectCopy(returnValue,
588 dynamic_cast<const RangeLOD *>(pRefAspect),
589 dynamic_cast<const RangeLOD *>(this));
591 return returnValue;
593 #endif
595 void RangeLODBase::resolveLinks(void)
597 Inherited::resolveLinks();
603 OSG_END_NAMESPACE