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"
65 #include "OSGStateChunk.h" // Chunks Class
67 #include "OSGStateBase.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
79 The state base class. See \ref PageSystemState for the conceptual background.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Int32 StateBase::_sfTransparencyMode
87 Set the transparency mode, possible values are TransparencyAutoDetection,
88 TransparencyForceTransparent and TransparencyForceOpaque
91 /*! \var StateChunk * StateBase::_mfChunks
96 /***************************************************************************\
97 * FieldType/FieldTrait Instantiation *
98 \***************************************************************************/
100 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
101 PointerType FieldTraits
<State
*, nsOSG
>::_type(
104 State::getClassType(),
108 OSG_FIELDTRAITS_GETTYPE_NS(State
*, nsOSG
)
110 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
114 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
118 /***************************************************************************\
119 * Field Description *
120 \***************************************************************************/
122 void StateBase::classDescInserter(TypeObject
&oType
)
124 FieldDescriptionBase
*pDesc
= NULL
;
127 pDesc
= new SFInt32::Description(
128 SFInt32::getClassType(),
130 "Set the transparency mode, possible values are TransparencyAutoDetection,\n"
131 "TransparencyForceTransparent and TransparencyForceOpaque \n",
132 TransparencyModeFieldId
, TransparencyModeFieldMask
,
134 (Field::SFDefaultFlags
| Field::FStdAccess
),
135 static_cast<FieldEditMethodSig
>(&State::editHandleTransparencyMode
),
136 static_cast<FieldGetMethodSig
>(&State::getHandleTransparencyMode
));
138 oType
.addInitialDesc(pDesc
);
140 pDesc
= new MFUnrecStateChunkPtr::Description(
141 MFUnrecStateChunkPtr::getClassType(),
144 ChunksFieldId
, ChunksFieldMask
,
146 (Field::MFDefaultFlags
| Field::FStdAccess
),
147 static_cast <FieldEditMethodSig
>(&State::invalidEditField
),
148 static_cast <FieldGetMethodSig
>(&State::invalidGetField
));
150 oType
.addInitialDesc(pDesc
);
154 StateBase::TypeObject
StateBase::_type(
155 StateBase::getClassname(),
156 Inherited::getClassname(),
159 reinterpret_cast<PrototypeCreateF
>(&StateBase::createEmptyLocal
),
160 reinterpret_cast<InitContainerF
>(&State::initMethod
),
161 reinterpret_cast<ExitContainerF
>(&State::exitMethod
),
162 reinterpret_cast<InitalInsertDescFunc
>(
163 reinterpret_cast<void *>(&State::classDescInserter
)),
166 "<?xml version=\"1.0\" ?>\n"
170 " parent=\"FieldContainer\"\n"
171 " library=\"System\"\n"
172 " structure=\"concrete\"\n"
173 " pointerfieldtypes=\"both\"\n"
174 " systemcomponent=\"true\"\n"
175 " parentsystemcomponent=\"true\"\n"
176 " docGroupBase=\"GrpSystemState\"\n"
179 " The state base class. See \\ref PageSystemState for the conceptual background.\n"
181 " name=\"transparencyMode\"\n"
183 " cardinality=\"single\"\n"
184 " visibility=\"external\"\n"
185 " defaultValue=\"0\"\n"
186 " access=\"public\"\n"
188 "\tSet the transparency mode, possible values are TransparencyAutoDetection,\n"
189 "\tTransparencyForceTransparent and TransparencyForceOpaque \n"
193 " type=\"StateChunkPtr\"\n"
194 " cardinality=\"multi\"\n"
195 " visibility=\"external\"\n"
196 " removeTo=\"NULL\"\n"
197 " clearMField=\"true\"\n"
201 "</FieldContainer>\n",
202 "The state base class. See \\ref PageSystemState for the conceptual background.\n"
205 /*------------------------------ get -----------------------------------*/
207 FieldContainerType
&StateBase::getType(void)
212 const FieldContainerType
&StateBase::getType(void) const
217 UInt32
StateBase::getContainerSize(void) const
219 return sizeof(State
);
222 /*------------------------- decorator get ------------------------------*/
225 SFInt32
*StateBase::editSFTransparencyMode(void)
227 editSField(TransparencyModeFieldMask
);
229 return &_sfTransparencyMode
;
232 const SFInt32
*StateBase::getSFTransparencyMode(void) const
234 return &_sfTransparencyMode
;
243 /*------------------------------ access -----------------------------------*/
245 SizeT
StateBase::getBinSize(ConstFieldMaskArg whichField
)
247 SizeT returnValue
= Inherited::getBinSize(whichField
);
249 if(FieldBits::NoField
!= (TransparencyModeFieldMask
& whichField
))
251 returnValue
+= _sfTransparencyMode
.getBinSize();
253 if(FieldBits::NoField
!= (ChunksFieldMask
& whichField
))
255 returnValue
+= _mfChunks
.getBinSize();
261 void StateBase::copyToBin(BinaryDataHandler
&pMem
,
262 ConstFieldMaskArg whichField
)
264 Inherited::copyToBin(pMem
, whichField
);
266 if(FieldBits::NoField
!= (TransparencyModeFieldMask
& whichField
))
268 _sfTransparencyMode
.copyToBin(pMem
);
270 if(FieldBits::NoField
!= (ChunksFieldMask
& whichField
))
272 _mfChunks
.copyToBin(pMem
);
276 void StateBase::copyFromBin(BinaryDataHandler
&pMem
,
277 ConstFieldMaskArg whichField
)
279 Inherited::copyFromBin(pMem
, whichField
);
281 if(FieldBits::NoField
!= (TransparencyModeFieldMask
& whichField
))
283 editSField(TransparencyModeFieldMask
);
284 _sfTransparencyMode
.copyFromBin(pMem
);
286 if(FieldBits::NoField
!= (ChunksFieldMask
& whichField
))
288 editMField(ChunksFieldMask
, _mfChunks
);
289 _mfChunks
.copyFromBin(pMem
);
293 //! create a new instance of the class
294 StateTransitPtr
StateBase::createLocal(BitVector bFlags
)
298 if(getClassType().getPrototype() != NULL
)
300 FieldContainerTransitPtr tmpPtr
=
301 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
303 fc
= dynamic_pointer_cast
<State
>(tmpPtr
);
309 //! create a new instance of the class, copy the container flags
310 StateTransitPtr
StateBase::createDependent(BitVector bFlags
)
314 if(getClassType().getPrototype() != NULL
)
316 FieldContainerTransitPtr tmpPtr
=
317 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
319 fc
= dynamic_pointer_cast
<State
>(tmpPtr
);
325 //! create a new instance of the class
326 StateTransitPtr
StateBase::create(void)
330 if(getClassType().getPrototype() != NULL
)
332 FieldContainerTransitPtr tmpPtr
=
333 getClassType().getPrototype()-> shallowCopy();
335 fc
= dynamic_pointer_cast
<State
>(tmpPtr
);
341 State
*StateBase::createEmptyLocal(BitVector bFlags
)
345 newPtr
<State
>(returnValue
, bFlags
);
347 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
352 //! create an empty new instance of the class, do not copy the prototype
353 State
*StateBase::createEmpty(void)
357 newPtr
<State
>(returnValue
, Thread::getCurrentLocalFlags());
359 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
360 ~Thread::getCurrentLocalFlags();
366 FieldContainerTransitPtr
StateBase::shallowCopyLocal(
367 BitVector bFlags
) const
371 newPtr(tmpPtr
, dynamic_cast<const State
*>(this), bFlags
);
373 FieldContainerTransitPtr
returnValue(tmpPtr
);
375 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
380 FieldContainerTransitPtr
StateBase::shallowCopyDependent(
381 BitVector bFlags
) const
385 newPtr(tmpPtr
, dynamic_cast<const State
*>(this), ~bFlags
);
387 FieldContainerTransitPtr
returnValue(tmpPtr
);
389 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
394 FieldContainerTransitPtr
StateBase::shallowCopy(void) const
399 dynamic_cast<const State
*>(this),
400 Thread::getCurrentLocalFlags());
402 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
404 FieldContainerTransitPtr
returnValue(tmpPtr
);
412 /*------------------------- constructors ----------------------------------*/
414 StateBase::StateBase(void) :
416 _sfTransparencyMode (Int32(0)),
421 StateBase::StateBase(const StateBase
&source
) :
423 _sfTransparencyMode (source
._sfTransparencyMode
),
429 /*-------------------------- destructors ----------------------------------*/
431 StateBase::~StateBase(void)
436 GetFieldHandlePtr
StateBase::getHandleTransparencyMode (void) const
438 SFInt32::GetHandlePtr
returnValue(
439 new SFInt32::GetHandle(
440 &_sfTransparencyMode
,
441 this->getType().getFieldDesc(TransparencyModeFieldId
),
442 const_cast<StateBase
*>(this)));
447 EditFieldHandlePtr
StateBase::editHandleTransparencyMode(void)
449 SFInt32::EditHandlePtr
returnValue(
450 new SFInt32::EditHandle(
451 &_sfTransparencyMode
,
452 this->getType().getFieldDesc(TransparencyModeFieldId
),
456 editSField(TransparencyModeFieldMask
);
461 GetFieldHandlePtr
StateBase::getHandleChunks (void) const
463 MFUnrecStateChunkPtr::GetHandlePtr returnValue
;
468 EditFieldHandlePtr
StateBase::editHandleChunks (void)
470 EditFieldHandlePtr returnValue
;
476 #ifdef OSG_MT_CPTR_ASPECT
477 void StateBase::execSyncV( FieldContainer
&oFrom
,
478 ConstFieldMaskArg whichField
,
479 AspectOffsetStore
&oOffsets
,
480 ConstFieldMaskArg syncMode
,
481 const UInt32 uiSyncInfo
)
483 State
*pThis
= static_cast<State
*>(this);
485 pThis
->execSync(static_cast<State
*>(&oFrom
),
494 #ifdef OSG_MT_CPTR_ASPECT
495 FieldContainer
*StateBase::createAspectCopy(
496 const FieldContainer
*pRefAspect
) const
500 newAspectCopy(returnValue
,
501 dynamic_cast<const State
*>(pRefAspect
),
502 dynamic_cast<const State
*>(this));
508 void StateBase::resolveLinks(void)
510 Inherited::resolveLinks();