1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 \*****************************************************************************/
56 #include "OSGConfig.h"
61 #include "OSGTestStageBase.h"
62 #include "OSGTestStage.h"
64 #include <boost/bind.hpp>
66 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
67 #pragma warning(disable:4355)
72 /***************************************************************************\
74 \***************************************************************************/
76 /*! \class OSG::TestStage
77 just dumps a message on traversal and render for testing
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var std::string TestStageBase::_sfMessage
89 /***************************************************************************\
90 * FieldType/FieldTrait Instantiation *
91 \***************************************************************************/
93 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
94 PointerType FieldTraits
<TestStage
*, nsOSG
>::_type(
97 TestStage::getClassType(),
101 OSG_FIELDTRAITS_GETTYPE_NS(TestStage
*, nsOSG
)
103 /***************************************************************************\
104 * Field Description *
105 \***************************************************************************/
107 void TestStageBase::classDescInserter(TypeObject
&oType
)
109 FieldDescriptionBase
*pDesc
= NULL
;
112 pDesc
= new SFString::Description(
113 SFString::getClassType(),
116 MessageFieldId
, MessageFieldMask
,
118 (Field::SFDefaultFlags
| Field::FStdAccess
),
119 static_cast<FieldEditMethodSig
>(&TestStage::editHandleMessage
),
120 static_cast<FieldGetMethodSig
>(&TestStage::getHandleMessage
));
122 oType
.addInitialDesc(pDesc
);
126 TestStageBase::TypeObject
TestStageBase::_type(
127 TestStageBase::getClassname(),
128 Inherited::getClassname(),
131 reinterpret_cast<PrototypeCreateF
>(&TestStageBase::createEmptyLocal
),
132 TestStage::initMethod
,
133 TestStage::exitMethod
,
134 reinterpret_cast<InitalInsertDescFunc
>(&TestStage::classDescInserter
),
137 "<?xml version=\"1.0\"?>\n"
140 "\tname=\"TestStage\"\n"
141 "\tparent=\"Stage\"\n"
142 "\tlibrary=\"Group\"\n"
143 "\tpointerfieldtypes=\"none\"\n"
144 "\tstructure=\"concrete\"\n"
145 "\tsystemcomponent=\"true\"\n"
146 "\tparentsystemcomponent=\"true\"\n"
147 "\tdecoratable=\"false\"\n"
148 "\tuseLocalIncludes=\"false\"\n"
149 " isNodeCore=\"true\"\n"
151 "just dumps a message on traversal and render for testing\n"
153 "\t\tname=\"message\"\n"
154 "\t\ttype=\"std::string\"\n"
155 "\t\tcardinality=\"single\"\n"
156 "\t\tvisibility=\"external\"\n"
157 "\t\taccess=\"public\"\n"
160 "</FieldContainer>\n",
161 "just dumps a message on traversal and render for testing\n"
164 /*------------------------------ get -----------------------------------*/
166 FieldContainerType
&TestStageBase::getType(void)
171 const FieldContainerType
&TestStageBase::getType(void) const
176 UInt32
TestStageBase::getContainerSize(void) const
178 return sizeof(TestStage
);
181 /*------------------------- decorator get ------------------------------*/
184 SFString
*TestStageBase::editSFMessage(void)
186 editSField(MessageFieldMask
);
191 const SFString
*TestStageBase::getSFMessage(void) const
201 /*------------------------------ access -----------------------------------*/
203 SizeT
TestStageBase::getBinSize(ConstFieldMaskArg whichField
)
205 SizeT returnValue
= Inherited::getBinSize(whichField
);
207 if(FieldBits::NoField
!= (MessageFieldMask
& whichField
))
209 returnValue
+= _sfMessage
.getBinSize();
215 void TestStageBase::copyToBin(BinaryDataHandler
&pMem
,
216 ConstFieldMaskArg whichField
)
218 Inherited::copyToBin(pMem
, whichField
);
220 if(FieldBits::NoField
!= (MessageFieldMask
& whichField
))
222 _sfMessage
.copyToBin(pMem
);
226 void TestStageBase::copyFromBin(BinaryDataHandler
&pMem
,
227 ConstFieldMaskArg whichField
)
229 Inherited::copyFromBin(pMem
, whichField
);
231 if(FieldBits::NoField
!= (MessageFieldMask
& whichField
))
233 editSField(MessageFieldMask
);
234 _sfMessage
.copyFromBin(pMem
);
238 //! create a new instance of the class
239 TestStageTransitPtr
TestStageBase::createLocal(BitVector bFlags
)
241 TestStageTransitPtr fc
;
243 if(getClassType().getPrototype() != NULL
)
245 FieldContainerTransitPtr tmpPtr
=
246 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
248 fc
= dynamic_pointer_cast
<TestStage
>(tmpPtr
);
254 //! create a new instance of the class, copy the container flags
255 TestStageTransitPtr
TestStageBase::createDependent(BitVector bFlags
)
257 TestStageTransitPtr fc
;
259 if(getClassType().getPrototype() != NULL
)
261 FieldContainerTransitPtr tmpPtr
=
262 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
264 fc
= dynamic_pointer_cast
<TestStage
>(tmpPtr
);
270 //! create a new instance of the class
271 TestStageTransitPtr
TestStageBase::create(void)
273 TestStageTransitPtr fc
;
275 if(getClassType().getPrototype() != NULL
)
277 FieldContainerTransitPtr tmpPtr
=
278 getClassType().getPrototype()-> shallowCopy();
280 fc
= dynamic_pointer_cast
<TestStage
>(tmpPtr
);
286 TestStage
*TestStageBase::createEmptyLocal(BitVector bFlags
)
288 TestStage
*returnValue
;
290 newPtr
<TestStage
>(returnValue
, bFlags
);
292 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
297 //! create an empty new instance of the class, do not copy the prototype
298 TestStage
*TestStageBase::createEmpty(void)
300 TestStage
*returnValue
;
302 newPtr
<TestStage
>(returnValue
, Thread::getCurrentLocalFlags());
304 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
305 ~Thread::getCurrentLocalFlags();
311 FieldContainerTransitPtr
TestStageBase::shallowCopyLocal(
312 BitVector bFlags
) const
316 newPtr(tmpPtr
, dynamic_cast<const TestStage
*>(this), bFlags
);
318 FieldContainerTransitPtr
returnValue(tmpPtr
);
320 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
325 FieldContainerTransitPtr
TestStageBase::shallowCopyDependent(
326 BitVector bFlags
) const
330 newPtr(tmpPtr
, dynamic_cast<const TestStage
*>(this), ~bFlags
);
332 FieldContainerTransitPtr
returnValue(tmpPtr
);
334 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
339 FieldContainerTransitPtr
TestStageBase::shallowCopy(void) const
344 dynamic_cast<const TestStage
*>(this),
345 Thread::getCurrentLocalFlags());
347 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
349 FieldContainerTransitPtr
returnValue(tmpPtr
);
357 /*------------------------- constructors ----------------------------------*/
359 TestStageBase::TestStageBase(void) :
365 TestStageBase::TestStageBase(const TestStageBase
&source
) :
367 _sfMessage (source
._sfMessage
)
372 /*-------------------------- destructors ----------------------------------*/
374 TestStageBase::~TestStageBase(void)
379 GetFieldHandlePtr
TestStageBase::getHandleMessage (void) const
381 SFString::GetHandlePtr
returnValue(
382 new SFString::GetHandle(
384 this->getType().getFieldDesc(MessageFieldId
),
385 const_cast<TestStageBase
*>(this)));
390 EditFieldHandlePtr
TestStageBase::editHandleMessage (void)
392 SFString::EditHandlePtr
returnValue(
393 new SFString::EditHandle(
395 this->getType().getFieldDesc(MessageFieldId
),
399 editSField(MessageFieldMask
);
405 #ifdef OSG_MT_CPTR_ASPECT
406 void TestStageBase::execSyncV( FieldContainer
&oFrom
,
407 ConstFieldMaskArg whichField
,
408 AspectOffsetStore
&oOffsets
,
409 ConstFieldMaskArg syncMode
,
410 const UInt32 uiSyncInfo
)
412 TestStage
*pThis
= static_cast<TestStage
*>(this);
414 pThis
->execSync(static_cast<TestStage
*>(&oFrom
),
423 #ifdef OSG_MT_CPTR_ASPECT
424 FieldContainer
*TestStageBase::createAspectCopy(
425 const FieldContainer
*pRefAspect
) const
427 TestStage
*returnValue
;
429 newAspectCopy(returnValue
,
430 dynamic_cast<const TestStage
*>(pRefAspect
),
431 dynamic_cast<const TestStage
*>(this));
437 void TestStageBase::resolveLinks(void)
439 Inherited::resolveLinks();