fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Test / GroupLib / OSGTestStageBase.cpp
blob24e1383189db36de6f904cb0f355237f911399ce
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 TestStage!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
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)
68 #endif
70 OSG_BEGIN_NAMESPACE
72 /***************************************************************************\
73 * Description *
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(
95 "TestStagePtr",
96 "StagePtr",
97 TestStage::getClassType(),
98 nsOSG);
99 #endif
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(),
114 "message",
116 MessageFieldId, MessageFieldMask,
117 false,
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(),
129 "NULL",
130 nsOSG, //Namespace
131 reinterpret_cast<PrototypeCreateF>(&TestStageBase::createEmptyLocal),
132 TestStage::initMethod,
133 TestStage::exitMethod,
134 reinterpret_cast<InitalInsertDescFunc>(&TestStage::classDescInserter),
135 false,
137 "<?xml version=\"1.0\"?>\n"
138 "\n"
139 "<FieldContainer\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"
150 ">\n"
151 "just dumps a message on traversal and render for testing\n"
152 "\t<Field\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"
158 "\t>\n"
159 "\t</Field>\n"
160 "</FieldContainer>\n",
161 "just dumps a message on traversal and render for testing\n"
164 /*------------------------------ get -----------------------------------*/
166 FieldContainerType &TestStageBase::getType(void)
168 return _type;
171 const FieldContainerType &TestStageBase::getType(void) const
173 return _type;
176 UInt32 TestStageBase::getContainerSize(void) const
178 return sizeof(TestStage);
181 /*------------------------- decorator get ------------------------------*/
184 SFString *TestStageBase::editSFMessage(void)
186 editSField(MessageFieldMask);
188 return &_sfMessage;
191 const SFString *TestStageBase::getSFMessage(void) const
193 return &_sfMessage;
201 /*------------------------------ access -----------------------------------*/
203 SizeT TestStageBase::getBinSize(ConstFieldMaskArg whichField)
205 SizeT returnValue = Inherited::getBinSize(whichField);
207 if(FieldBits::NoField != (MessageFieldMask & whichField))
209 returnValue += _sfMessage.getBinSize();
212 return returnValue;
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);
251 return fc;
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);
267 return fc;
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);
283 return fc;
286 TestStage *TestStageBase::createEmptyLocal(BitVector bFlags)
288 TestStage *returnValue;
290 newPtr<TestStage>(returnValue, bFlags);
292 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
294 return returnValue;
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();
307 return returnValue;
311 FieldContainerTransitPtr TestStageBase::shallowCopyLocal(
312 BitVector bFlags) const
314 TestStage *tmpPtr;
316 newPtr(tmpPtr, dynamic_cast<const TestStage *>(this), bFlags);
318 FieldContainerTransitPtr returnValue(tmpPtr);
320 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
322 return returnValue;
325 FieldContainerTransitPtr TestStageBase::shallowCopyDependent(
326 BitVector bFlags) const
328 TestStage *tmpPtr;
330 newPtr(tmpPtr, dynamic_cast<const TestStage *>(this), ~bFlags);
332 FieldContainerTransitPtr returnValue(tmpPtr);
334 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
336 return returnValue;
339 FieldContainerTransitPtr TestStageBase::shallowCopy(void) const
341 TestStage *tmpPtr;
343 newPtr(tmpPtr,
344 dynamic_cast<const TestStage *>(this),
345 Thread::getCurrentLocalFlags());
347 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
349 FieldContainerTransitPtr returnValue(tmpPtr);
351 return returnValue;
357 /*------------------------- constructors ----------------------------------*/
359 TestStageBase::TestStageBase(void) :
360 Inherited(),
361 _sfMessage ()
365 TestStageBase::TestStageBase(const TestStageBase &source) :
366 Inherited(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(
383 &_sfMessage,
384 this->getType().getFieldDesc(MessageFieldId),
385 const_cast<TestStageBase *>(this)));
387 return returnValue;
390 EditFieldHandlePtr TestStageBase::editHandleMessage (void)
392 SFString::EditHandlePtr returnValue(
393 new SFString::EditHandle(
394 &_sfMessage,
395 this->getType().getFieldDesc(MessageFieldId),
396 this));
399 editSField(MessageFieldMask);
401 return returnValue;
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),
415 whichField,
416 oOffsets,
417 syncMode,
418 uiSyncInfo);
420 #endif
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));
433 return returnValue;
435 #endif
437 void TestStageBase::resolveLinks(void)
439 Inherited::resolveLinks();
445 OSG_END_NAMESPACE