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 **
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"
66 #include "OSGRangeLODBase.h"
67 #include "OSGRangeLOD.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::RangeLOD
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Pnt3f RangeLODBase::_sfCenter
86 The center for distance calculation.
89 /*! \var Real32 RangeLODBase::_sfSwitchIn
93 /*! \var Real32 RangeLODBase::_sfSwitchOut
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<RangeLOD
*, nsOSG
>::_type(
106 RangeLOD::getClassType(),
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(),
124 "The center for distance calculation.\n",
125 CenterFieldId
, CenterFieldMask
,
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(),
136 "The range intervals.\n",
137 SwitchInFieldId
, SwitchInFieldMask
,
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(),
148 "The range intervals.\n",
149 SwitchOutFieldId
, SwitchOutFieldMask
,
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(),
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
)),
171 "<?xml version=\"1.0\"?>\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"
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"
192 "\tThe center for distance calculation.\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"
201 "\tThe range intervals.\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"
210 "\tThe range intervals.\n"
212 "</FieldContainer>\n",
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType
&RangeLODBase::getType(void)
223 const FieldContainerType
&RangeLODBase::getType(void) const
228 UInt32
RangeLODBase::getContainerSize(void) const
230 return sizeof(RangeLOD
);
233 /*------------------------- decorator get ------------------------------*/
236 SFPnt3f
*RangeLODBase::editSFCenter(void)
238 editSField(CenterFieldMask
);
243 const SFPnt3f
*RangeLODBase::getSFCenter(void) const
249 SFReal32
*RangeLODBase::editSFSwitchIn(void)
251 editSField(SwitchInFieldMask
);
256 const SFReal32
*RangeLODBase::getSFSwitchIn(void) const
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();
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
);
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
);
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
);
390 RangeLOD
*RangeLODBase::createEmptyLocal(BitVector bFlags
)
392 RangeLOD
*returnValue
;
394 newPtr
<RangeLOD
>(returnValue
, bFlags
);
396 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
415 FieldContainerTransitPtr
RangeLODBase::shallowCopyLocal(
416 BitVector bFlags
) const
420 newPtr(tmpPtr
, dynamic_cast<const RangeLOD
*>(this), bFlags
);
422 FieldContainerTransitPtr
returnValue(tmpPtr
);
424 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
429 FieldContainerTransitPtr
RangeLODBase::shallowCopyDependent(
430 BitVector bFlags
) const
434 newPtr(tmpPtr
, dynamic_cast<const RangeLOD
*>(this), ~bFlags
);
436 FieldContainerTransitPtr
returnValue(tmpPtr
);
438 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
443 FieldContainerTransitPtr
RangeLODBase::shallowCopy(void) const
448 dynamic_cast<const RangeLOD
*>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr
returnValue(tmpPtr
);
461 /*------------------------- constructors ----------------------------------*/
463 RangeLODBase::RangeLODBase(void) :
471 RangeLODBase::RangeLODBase(const RangeLODBase
&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(
492 this->getType().getFieldDesc(CenterFieldId
),
493 const_cast<RangeLODBase
*>(this)));
498 EditFieldHandlePtr
RangeLODBase::editHandleCenter (void)
500 SFPnt3f::EditHandlePtr
returnValue(
501 new SFPnt3f::EditHandle(
503 this->getType().getFieldDesc(CenterFieldId
),
507 editSField(CenterFieldMask
);
512 GetFieldHandlePtr
RangeLODBase::getHandleSwitchIn (void) const
514 SFReal32::GetHandlePtr
returnValue(
515 new SFReal32::GetHandle(
517 this->getType().getFieldDesc(SwitchInFieldId
),
518 const_cast<RangeLODBase
*>(this)));
523 EditFieldHandlePtr
RangeLODBase::editHandleSwitchIn (void)
525 SFReal32::EditHandlePtr
returnValue(
526 new SFReal32::EditHandle(
528 this->getType().getFieldDesc(SwitchInFieldId
),
532 editSField(SwitchInFieldMask
);
537 GetFieldHandlePtr
RangeLODBase::getHandleSwitchOut (void) const
539 SFReal32::GetHandlePtr
returnValue(
540 new SFReal32::GetHandle(
542 this->getType().getFieldDesc(SwitchOutFieldId
),
543 const_cast<RangeLODBase
*>(this)));
548 EditFieldHandlePtr
RangeLODBase::editHandleSwitchOut (void)
550 SFReal32::EditHandlePtr
returnValue(
551 new SFReal32::EditHandle(
553 this->getType().getFieldDesc(SwitchOutFieldId
),
557 editSField(SwitchOutFieldMask
);
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
),
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));
595 void RangeLODBase::resolveLinks(void)
597 Inherited::resolveLinks();