fixed: gcc8 compile issues
[opensg.git] / Source / Test / GroupLib / OSGTestMultiPartitionStageBase.cpp
bloba07599e8e87274cec80e2b6f545cd9af7db07cfa
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 TestMultiPartitionStage!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #include "OSGConfig.h"
61 #include "OSGTestMultiPartitionStageBase.h"
62 #include "OSGTestMultiPartitionStage.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::TestMultiPartitionStage
77 just dumps a message on traversal and render for testing
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var std::string TestMultiPartitionStageBase::_sfMessage
88 /*! \var Int32 TestMultiPartitionStageBase::_sfNumPartitions
92 /*! \var Int32 TestMultiPartitionStageBase::_mfOrder
96 /*! \var bool TestMultiPartitionStageBase::_sfUseGroup
101 /***************************************************************************\
102 * FieldType/FieldTrait Instantiation *
103 \***************************************************************************/
105 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
106 PointerType FieldTraits<TestMultiPartitionStage *, nsOSG>::_type(
107 "TestMultiPartitionStagePtr",
108 "StagePtr",
109 TestMultiPartitionStage::getClassType(),
110 nsOSG);
111 #endif
113 OSG_FIELDTRAITS_GETTYPE_NS(TestMultiPartitionStage *, nsOSG)
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void TestMultiPartitionStageBase::classDescInserter(TypeObject &oType)
121 FieldDescriptionBase *pDesc = NULL;
124 pDesc = new SFString::Description(
125 SFString::getClassType(),
126 "message",
128 MessageFieldId, MessageFieldMask,
129 false,
130 (Field::SFDefaultFlags | Field::FStdAccess),
131 static_cast<FieldEditMethodSig>(&TestMultiPartitionStage::editHandleMessage),
132 static_cast<FieldGetMethodSig >(&TestMultiPartitionStage::getHandleMessage));
134 oType.addInitialDesc(pDesc);
136 pDesc = new SFInt32::Description(
137 SFInt32::getClassType(),
138 "numPartitions",
140 NumPartitionsFieldId, NumPartitionsFieldMask,
141 false,
142 (Field::SFDefaultFlags | Field::FStdAccess),
143 static_cast<FieldEditMethodSig>(&TestMultiPartitionStage::editHandleNumPartitions),
144 static_cast<FieldGetMethodSig >(&TestMultiPartitionStage::getHandleNumPartitions));
146 oType.addInitialDesc(pDesc);
148 pDesc = new MFInt32::Description(
149 MFInt32::getClassType(),
150 "order",
152 OrderFieldId, OrderFieldMask,
153 false,
154 (Field::MFDefaultFlags | Field::FStdAccess),
155 static_cast<FieldEditMethodSig>(&TestMultiPartitionStage::editHandleOrder),
156 static_cast<FieldGetMethodSig >(&TestMultiPartitionStage::getHandleOrder));
158 oType.addInitialDesc(pDesc);
160 pDesc = new SFBool::Description(
161 SFBool::getClassType(),
162 "useGroup",
164 UseGroupFieldId, UseGroupFieldMask,
165 false,
166 (Field::SFDefaultFlags | Field::FStdAccess),
167 static_cast<FieldEditMethodSig>(&TestMultiPartitionStage::editHandleUseGroup),
168 static_cast<FieldGetMethodSig >(&TestMultiPartitionStage::getHandleUseGroup));
170 oType.addInitialDesc(pDesc);
174 TestMultiPartitionStageBase::TypeObject TestMultiPartitionStageBase::_type(
175 TestMultiPartitionStageBase::getClassname(),
176 Inherited::getClassname(),
177 "NULL",
178 nsOSG, //Namespace
179 reinterpret_cast<PrototypeCreateF>(&TestMultiPartitionStageBase::createEmptyLocal),
180 TestMultiPartitionStage::initMethod,
181 TestMultiPartitionStage::exitMethod,
182 reinterpret_cast<InitalInsertDescFunc>(&TestMultiPartitionStage::classDescInserter),
183 false,
185 "<?xml version=\"1.0\"?>\n"
186 "\n"
187 "<FieldContainer\n"
188 "\tname=\"TestMultiPartitionStage\"\n"
189 "\tparent=\"Stage\"\n"
190 "\tlibrary=\"Group\"\n"
191 "\tpointerfieldtypes=\"none\"\n"
192 "\tstructure=\"concrete\"\n"
193 "\tsystemcomponent=\"true\"\n"
194 "\tparentsystemcomponent=\"true\"\n"
195 "\tdecoratable=\"false\"\n"
196 "\tuseLocalIncludes=\"false\"\n"
197 " isNodeCore=\"true\"\n"
198 ">\n"
199 "just dumps a message on traversal and render for testing\n"
200 "\t<Field\n"
201 "\t\tname=\"message\"\n"
202 "\t\ttype=\"std::string\"\n"
203 "\t\tcardinality=\"single\"\n"
204 "\t\tvisibility=\"external\"\n"
205 "\t\taccess=\"public\"\n"
206 "\t>\n"
207 "\t</Field>\n"
208 " <Field\n"
209 " name=\"numPartitions\"\n"
210 " type=\"Int32\"\n"
211 " cardinality=\"single\"\n"
212 " visibility=\"external\"\n"
213 " access=\"public\"\n"
214 " defaultValue=\"1\"\n"
215 " >\n"
216 " </Field>\n"
217 " <Field\n"
218 " name=\"order\"\n"
219 " type=\"Int32\"\n"
220 " cardinality=\"multi\"\n"
221 " visibility=\"external\"\n"
222 " access=\"public\"\n"
223 " >\n"
224 " </Field>\n"
225 " <Field\n"
226 " name=\"useGroup\"\n"
227 " type=\"bool\"\n"
228 " cardinality=\"single\"\n"
229 " visibility=\"external\"\n"
230 " access=\"public\"\n"
231 " >\n"
232 " </Field>\n"
233 "</FieldContainer>\n",
234 "just dumps a message on traversal and render for testing\n"
237 /*------------------------------ get -----------------------------------*/
239 FieldContainerType &TestMultiPartitionStageBase::getType(void)
241 return _type;
244 const FieldContainerType &TestMultiPartitionStageBase::getType(void) const
246 return _type;
249 UInt32 TestMultiPartitionStageBase::getContainerSize(void) const
251 return sizeof(TestMultiPartitionStage);
254 /*------------------------- decorator get ------------------------------*/
257 SFString *TestMultiPartitionStageBase::editSFMessage(void)
259 editSField(MessageFieldMask);
261 return &_sfMessage;
264 const SFString *TestMultiPartitionStageBase::getSFMessage(void) const
266 return &_sfMessage;
270 SFInt32 *TestMultiPartitionStageBase::editSFNumPartitions(void)
272 editSField(NumPartitionsFieldMask);
274 return &_sfNumPartitions;
277 const SFInt32 *TestMultiPartitionStageBase::getSFNumPartitions(void) const
279 return &_sfNumPartitions;
283 MFInt32 *TestMultiPartitionStageBase::editMFOrder(void)
285 editMField(OrderFieldMask, _mfOrder);
287 return &_mfOrder;
290 const MFInt32 *TestMultiPartitionStageBase::getMFOrder(void) const
292 return &_mfOrder;
296 SFBool *TestMultiPartitionStageBase::editSFUseGroup(void)
298 editSField(UseGroupFieldMask);
300 return &_sfUseGroup;
303 const SFBool *TestMultiPartitionStageBase::getSFUseGroup(void) const
305 return &_sfUseGroup;
313 /*------------------------------ access -----------------------------------*/
315 SizeT TestMultiPartitionStageBase::getBinSize(ConstFieldMaskArg whichField)
317 SizeT returnValue = Inherited::getBinSize(whichField);
319 if(FieldBits::NoField != (MessageFieldMask & whichField))
321 returnValue += _sfMessage.getBinSize();
323 if(FieldBits::NoField != (NumPartitionsFieldMask & whichField))
325 returnValue += _sfNumPartitions.getBinSize();
327 if(FieldBits::NoField != (OrderFieldMask & whichField))
329 returnValue += _mfOrder.getBinSize();
331 if(FieldBits::NoField != (UseGroupFieldMask & whichField))
333 returnValue += _sfUseGroup.getBinSize();
336 return returnValue;
339 void TestMultiPartitionStageBase::copyToBin(BinaryDataHandler &pMem,
340 ConstFieldMaskArg whichField)
342 Inherited::copyToBin(pMem, whichField);
344 if(FieldBits::NoField != (MessageFieldMask & whichField))
346 _sfMessage.copyToBin(pMem);
348 if(FieldBits::NoField != (NumPartitionsFieldMask & whichField))
350 _sfNumPartitions.copyToBin(pMem);
352 if(FieldBits::NoField != (OrderFieldMask & whichField))
354 _mfOrder.copyToBin(pMem);
356 if(FieldBits::NoField != (UseGroupFieldMask & whichField))
358 _sfUseGroup.copyToBin(pMem);
362 void TestMultiPartitionStageBase::copyFromBin(BinaryDataHandler &pMem,
363 ConstFieldMaskArg whichField)
365 Inherited::copyFromBin(pMem, whichField);
367 if(FieldBits::NoField != (MessageFieldMask & whichField))
369 editSField(MessageFieldMask);
370 _sfMessage.copyFromBin(pMem);
372 if(FieldBits::NoField != (NumPartitionsFieldMask & whichField))
374 editSField(NumPartitionsFieldMask);
375 _sfNumPartitions.copyFromBin(pMem);
377 if(FieldBits::NoField != (OrderFieldMask & whichField))
379 editMField(OrderFieldMask, _mfOrder);
380 _mfOrder.copyFromBin(pMem);
382 if(FieldBits::NoField != (UseGroupFieldMask & whichField))
384 editSField(UseGroupFieldMask);
385 _sfUseGroup.copyFromBin(pMem);
389 //! create a new instance of the class
390 TestMultiPartitionStageTransitPtr TestMultiPartitionStageBase::createLocal(BitVector bFlags)
392 TestMultiPartitionStageTransitPtr fc;
394 if(getClassType().getPrototype() != NULL)
396 FieldContainerTransitPtr tmpPtr =
397 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
399 fc = dynamic_pointer_cast<TestMultiPartitionStage>(tmpPtr);
402 return fc;
405 //! create a new instance of the class, copy the container flags
406 TestMultiPartitionStageTransitPtr TestMultiPartitionStageBase::createDependent(BitVector bFlags)
408 TestMultiPartitionStageTransitPtr fc;
410 if(getClassType().getPrototype() != NULL)
412 FieldContainerTransitPtr tmpPtr =
413 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
415 fc = dynamic_pointer_cast<TestMultiPartitionStage>(tmpPtr);
418 return fc;
421 //! create a new instance of the class
422 TestMultiPartitionStageTransitPtr TestMultiPartitionStageBase::create(void)
424 TestMultiPartitionStageTransitPtr fc;
426 if(getClassType().getPrototype() != NULL)
428 FieldContainerTransitPtr tmpPtr =
429 getClassType().getPrototype()-> shallowCopy();
431 fc = dynamic_pointer_cast<TestMultiPartitionStage>(tmpPtr);
434 return fc;
437 TestMultiPartitionStage *TestMultiPartitionStageBase::createEmptyLocal(BitVector bFlags)
439 TestMultiPartitionStage *returnValue;
441 newPtr<TestMultiPartitionStage>(returnValue, bFlags);
443 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
445 return returnValue;
448 //! create an empty new instance of the class, do not copy the prototype
449 TestMultiPartitionStage *TestMultiPartitionStageBase::createEmpty(void)
451 TestMultiPartitionStage *returnValue;
453 newPtr<TestMultiPartitionStage>(returnValue, Thread::getCurrentLocalFlags());
455 returnValue->_pFieldFlags->_bNamespaceMask &=
456 ~Thread::getCurrentLocalFlags();
458 return returnValue;
462 FieldContainerTransitPtr TestMultiPartitionStageBase::shallowCopyLocal(
463 BitVector bFlags) const
465 TestMultiPartitionStage *tmpPtr;
467 newPtr(tmpPtr, dynamic_cast<const TestMultiPartitionStage *>(this), bFlags);
469 FieldContainerTransitPtr returnValue(tmpPtr);
471 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
473 return returnValue;
476 FieldContainerTransitPtr TestMultiPartitionStageBase::shallowCopyDependent(
477 BitVector bFlags) const
479 TestMultiPartitionStage *tmpPtr;
481 newPtr(tmpPtr, dynamic_cast<const TestMultiPartitionStage *>(this), ~bFlags);
483 FieldContainerTransitPtr returnValue(tmpPtr);
485 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
487 return returnValue;
490 FieldContainerTransitPtr TestMultiPartitionStageBase::shallowCopy(void) const
492 TestMultiPartitionStage *tmpPtr;
494 newPtr(tmpPtr,
495 dynamic_cast<const TestMultiPartitionStage *>(this),
496 Thread::getCurrentLocalFlags());
498 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
500 FieldContainerTransitPtr returnValue(tmpPtr);
502 return returnValue;
508 /*------------------------- constructors ----------------------------------*/
510 TestMultiPartitionStageBase::TestMultiPartitionStageBase(void) :
511 Inherited(),
512 _sfMessage (),
513 _sfNumPartitions (Int32(1)),
514 _mfOrder (),
515 _sfUseGroup ()
519 TestMultiPartitionStageBase::TestMultiPartitionStageBase(const TestMultiPartitionStageBase &source) :
520 Inherited(source),
521 _sfMessage (source._sfMessage ),
522 _sfNumPartitions (source._sfNumPartitions ),
523 _mfOrder (source._mfOrder ),
524 _sfUseGroup (source._sfUseGroup )
529 /*-------------------------- destructors ----------------------------------*/
531 TestMultiPartitionStageBase::~TestMultiPartitionStageBase(void)
536 GetFieldHandlePtr TestMultiPartitionStageBase::getHandleMessage (void) const
538 SFString::GetHandlePtr returnValue(
539 new SFString::GetHandle(
540 &_sfMessage,
541 this->getType().getFieldDesc(MessageFieldId),
542 const_cast<TestMultiPartitionStageBase *>(this)));
544 return returnValue;
547 EditFieldHandlePtr TestMultiPartitionStageBase::editHandleMessage (void)
549 SFString::EditHandlePtr returnValue(
550 new SFString::EditHandle(
551 &_sfMessage,
552 this->getType().getFieldDesc(MessageFieldId),
553 this));
556 editSField(MessageFieldMask);
558 return returnValue;
561 GetFieldHandlePtr TestMultiPartitionStageBase::getHandleNumPartitions (void) const
563 SFInt32::GetHandlePtr returnValue(
564 new SFInt32::GetHandle(
565 &_sfNumPartitions,
566 this->getType().getFieldDesc(NumPartitionsFieldId),
567 const_cast<TestMultiPartitionStageBase *>(this)));
569 return returnValue;
572 EditFieldHandlePtr TestMultiPartitionStageBase::editHandleNumPartitions (void)
574 SFInt32::EditHandlePtr returnValue(
575 new SFInt32::EditHandle(
576 &_sfNumPartitions,
577 this->getType().getFieldDesc(NumPartitionsFieldId),
578 this));
581 editSField(NumPartitionsFieldMask);
583 return returnValue;
586 GetFieldHandlePtr TestMultiPartitionStageBase::getHandleOrder (void) const
588 MFInt32::GetHandlePtr returnValue(
589 new MFInt32::GetHandle(
590 &_mfOrder,
591 this->getType().getFieldDesc(OrderFieldId),
592 const_cast<TestMultiPartitionStageBase *>(this)));
594 return returnValue;
597 EditFieldHandlePtr TestMultiPartitionStageBase::editHandleOrder (void)
599 MFInt32::EditHandlePtr returnValue(
600 new MFInt32::EditHandle(
601 &_mfOrder,
602 this->getType().getFieldDesc(OrderFieldId),
603 this));
606 editMField(OrderFieldMask, _mfOrder);
608 return returnValue;
611 GetFieldHandlePtr TestMultiPartitionStageBase::getHandleUseGroup (void) const
613 SFBool::GetHandlePtr returnValue(
614 new SFBool::GetHandle(
615 &_sfUseGroup,
616 this->getType().getFieldDesc(UseGroupFieldId),
617 const_cast<TestMultiPartitionStageBase *>(this)));
619 return returnValue;
622 EditFieldHandlePtr TestMultiPartitionStageBase::editHandleUseGroup (void)
624 SFBool::EditHandlePtr returnValue(
625 new SFBool::EditHandle(
626 &_sfUseGroup,
627 this->getType().getFieldDesc(UseGroupFieldId),
628 this));
631 editSField(UseGroupFieldMask);
633 return returnValue;
637 #ifdef OSG_MT_CPTR_ASPECT
638 void TestMultiPartitionStageBase::execSyncV( FieldContainer &oFrom,
639 ConstFieldMaskArg whichField,
640 AspectOffsetStore &oOffsets,
641 ConstFieldMaskArg syncMode,
642 const UInt32 uiSyncInfo)
644 TestMultiPartitionStage *pThis = static_cast<TestMultiPartitionStage *>(this);
646 pThis->execSync(static_cast<TestMultiPartitionStage *>(&oFrom),
647 whichField,
648 oOffsets,
649 syncMode,
650 uiSyncInfo);
652 #endif
655 #ifdef OSG_MT_CPTR_ASPECT
656 FieldContainer *TestMultiPartitionStageBase::createAspectCopy(
657 const FieldContainer *pRefAspect) const
659 TestMultiPartitionStage *returnValue;
661 newAspectCopy(returnValue,
662 dynamic_cast<const TestMultiPartitionStage *>(pRefAspect),
663 dynamic_cast<const TestMultiPartitionStage *>(this));
665 return returnValue;
667 #endif
669 void TestMultiPartitionStageBase::resolveLinks(void)
671 Inherited::resolveLinks();
673 #ifdef OSG_MT_CPTR_ASPECT
674 AspectOffsetStore oOffsets;
676 _pAspectStore->fillOffsetArray(oOffsets, this);
677 #endif
679 #ifdef OSG_MT_CPTR_ASPECT
680 _mfOrder.terminateShare(Thread::getCurrentAspect(),
681 oOffsets);
682 #endif
686 OSG_END_NAMESPACE