fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComplexSceneManager / OSGComplexSceneManagerBase.cpp
blob6dde3097fc8d478c60be7ceaf101f9f49595ca98
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 ComplexSceneManager!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
65 #include "OSGFieldContainer.h" // Globals Class
66 #include "OSGCSMDrawManager.h" // DrawManager Class
68 #include "OSGComplexSceneManagerBase.h"
69 #include "OSGComplexSceneManager.h"
71 #include <boost/bind.hpp>
73 OSG_BEGIN_NAMESPACE
75 /***************************************************************************\
76 * Description *
77 \***************************************************************************/
79 /*! \class OSG::ComplexSceneManager
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var FieldContainer * ComplexSceneManagerBase::_mfGlobals
91 /*! \var CSMDrawManager * ComplexSceneManagerBase::_sfDrawManager
95 /*! \var Time ComplexSceneManagerBase::_sfStartTime
99 /*! \var Time ComplexSceneManagerBase::_sfTimeScale
103 /*! \var Time ComplexSceneManagerBase::_sfConstantTimeStep
107 /*! \var bool ComplexSceneManagerBase::_sfConstantTime
111 /*! \var bool ComplexSceneManagerBase::_sfPaused
115 /*! \var bool ComplexSceneManagerBase::_sfDumpFrameStart
119 /*! \var bool ComplexSceneManagerBase::_sfEnableWebService
123 /*! \var UInt32 ComplexSceneManagerBase::_sfWebServicePort
127 /*! \var std::string ComplexSceneManagerBase::_sfWebServiceRoot
131 /*! \var bool ComplexSceneManagerBase::_sfWaitKeyAfterFrame
136 /***************************************************************************\
137 * FieldType/FieldTrait Instantiation *
138 \***************************************************************************/
140 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
141 PointerType FieldTraits<ComplexSceneManager *, nsOSG>::_type(
142 "ComplexSceneManagerPtr",
143 "FieldContainerPtr",
144 ComplexSceneManager::getClassType(),
145 nsOSG);
146 #endif
148 OSG_FIELDTRAITS_GETTYPE_NS(ComplexSceneManager *, nsOSG)
150 /***************************************************************************\
151 * Field Description *
152 \***************************************************************************/
154 void ComplexSceneManagerBase::classDescInserter(TypeObject &oType)
156 FieldDescriptionBase *pDesc = NULL;
159 pDesc = new MFRecFieldContainerPtr::Description(
160 MFRecFieldContainerPtr::getClassType(),
161 "globals",
163 GlobalsFieldId, GlobalsFieldMask,
164 false,
165 (Field::MFDefaultFlags | Field::FStdAccess),
166 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleGlobals),
167 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleGlobals));
169 oType.addInitialDesc(pDesc);
171 pDesc = new SFUnrecCSMDrawManagerPtr::Description(
172 SFUnrecCSMDrawManagerPtr::getClassType(),
173 "drawManager",
175 DrawManagerFieldId, DrawManagerFieldMask,
176 false,
177 (Field::SFDefaultFlags | Field::FStdAccess),
178 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleDrawManager),
179 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleDrawManager));
181 oType.addInitialDesc(pDesc);
183 pDesc = new SFTime::Description(
184 SFTime::getClassType(),
185 "startTime",
187 StartTimeFieldId, StartTimeFieldMask,
188 true,
189 (Field::SFDefaultFlags | Field::FStdAccess),
190 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleStartTime),
191 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleStartTime));
193 oType.addInitialDesc(pDesc);
195 pDesc = new SFTime::Description(
196 SFTime::getClassType(),
197 "timeScale",
199 TimeScaleFieldId, TimeScaleFieldMask,
200 true,
201 (Field::SFDefaultFlags | Field::FStdAccess),
202 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleTimeScale),
203 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleTimeScale));
205 oType.addInitialDesc(pDesc);
207 pDesc = new SFTime::Description(
208 SFTime::getClassType(),
209 "constantTimeStep",
211 ConstantTimeStepFieldId, ConstantTimeStepFieldMask,
212 true,
213 (Field::SFDefaultFlags | Field::FStdAccess),
214 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleConstantTimeStep),
215 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleConstantTimeStep));
217 oType.addInitialDesc(pDesc);
219 pDesc = new SFBool::Description(
220 SFBool::getClassType(),
221 "constantTime",
223 ConstantTimeFieldId, ConstantTimeFieldMask,
224 true,
225 (Field::SFDefaultFlags | Field::FStdAccess),
226 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleConstantTime),
227 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleConstantTime));
229 oType.addInitialDesc(pDesc);
231 pDesc = new SFBool::Description(
232 SFBool::getClassType(),
233 "paused",
235 PausedFieldId, PausedFieldMask,
236 true,
237 (Field::SFDefaultFlags | Field::FStdAccess),
238 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandlePaused),
239 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandlePaused));
241 oType.addInitialDesc(pDesc);
243 pDesc = new SFBool::Description(
244 SFBool::getClassType(),
245 "dumpFrameStart",
247 DumpFrameStartFieldId, DumpFrameStartFieldMask,
248 true,
249 (Field::SFDefaultFlags | Field::FStdAccess),
250 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleDumpFrameStart),
251 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleDumpFrameStart));
253 oType.addInitialDesc(pDesc);
255 pDesc = new SFBool::Description(
256 SFBool::getClassType(),
257 "enableWebService",
259 EnableWebServiceFieldId, EnableWebServiceFieldMask,
260 true,
261 (Field::SFDefaultFlags | Field::FStdAccess),
262 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleEnableWebService),
263 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleEnableWebService));
265 oType.addInitialDesc(pDesc);
267 pDesc = new SFUInt32::Description(
268 SFUInt32::getClassType(),
269 "webServicePort",
271 WebServicePortFieldId, WebServicePortFieldMask,
272 true,
273 (Field::SFDefaultFlags | Field::FStdAccess),
274 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleWebServicePort),
275 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleWebServicePort));
277 oType.addInitialDesc(pDesc);
279 pDesc = new SFString::Description(
280 SFString::getClassType(),
281 "webServiceRoot",
283 WebServiceRootFieldId, WebServiceRootFieldMask,
284 true,
285 (Field::SFDefaultFlags | Field::FStdAccess),
286 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleWebServiceRoot),
287 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleWebServiceRoot));
289 oType.addInitialDesc(pDesc);
291 pDesc = new SFBool::Description(
292 SFBool::getClassType(),
293 "waitKeyAfterFrame",
295 WaitKeyAfterFrameFieldId, WaitKeyAfterFrameFieldMask,
296 true,
297 (Field::SFDefaultFlags | Field::FStdAccess),
298 static_cast<FieldEditMethodSig>(&ComplexSceneManager::editHandleWaitKeyAfterFrame),
299 static_cast<FieldGetMethodSig >(&ComplexSceneManager::getHandleWaitKeyAfterFrame));
301 oType.addInitialDesc(pDesc);
305 ComplexSceneManagerBase::TypeObject ComplexSceneManagerBase::_type(
306 ComplexSceneManagerBase::getClassname(),
307 Inherited::getClassname(),
308 "NULL",
309 nsOSG, //Namespace
310 reinterpret_cast<PrototypeCreateF>(&ComplexSceneManagerBase::createEmptyLocal),
311 reinterpret_cast<InitContainerF>(&ComplexSceneManager::initMethod),
312 reinterpret_cast<ExitContainerF>(&ComplexSceneManager::exitMethod),
313 reinterpret_cast<InitalInsertDescFunc>(
314 reinterpret_cast<void *>(&ComplexSceneManager::classDescInserter)),
315 false,
317 "<?xml version=\"1.0\"?>\n"
318 "\n"
319 "<FieldContainer\n"
320 " name=\"ComplexSceneManager\"\n"
321 " parent=\"FieldContainer\"\n"
322 " library=\"ContribCSM\"\n"
323 " pointerfieldtypes=\"none\"\n"
324 " structure=\"concrete\"\n"
325 " systemcomponent=\"true\"\n"
326 " parentsystemcomponent=\"true\"\n"
327 " decoratable=\"false\"\n"
328 " useLocalIncludes=\"false\"\n"
329 " isNodeCore=\"false\"\n"
330 " isBundle=\"true\"\n"
331 ">\n"
332 " \n"
333 "\t<Field\n"
334 "\t\tname=\"globals\"\n"
335 "\t\ttype=\"FieldContainer\"\n"
336 "\t\tcardinality=\"multi\"\n"
337 "\t\tvisibility=\"external\"\n"
338 "\t\taccess=\"public\"\n"
339 " category=\"recpointer\"\n"
340 "\t>\n"
341 "\t</Field>\n"
342 "\t<Field\n"
343 "\t\tname=\"drawManager\"\n"
344 "\t\ttype=\"CSMDrawManager\"\n"
345 "\t\tcardinality=\"single\"\n"
346 "\t\tvisibility=\"external\"\n"
347 "\t\tdefaultValue=\"NULL\"\n"
348 "\t\taccess=\"public\"\n"
349 " category=\"pointer\"\n"
350 "\t>\n"
351 "\t</Field>\n"
352 "\n"
353 "<!--\n"
354 "\t<Field\n"
355 "\t\tname=\"sensorTask\"\n"
356 "\t\ttype=\"SensorTask\"\n"
357 "\t\tcardinality=\"single\"\n"
358 "\t\tvisibility=\"external\"\n"
359 "\t\tdefaultValue=\"NULL\"\n"
360 "\t\taccess=\"public\"\n"
361 " category=\"pointer\"\n"
362 "\t>\n"
363 "\t</Field>\n"
364 "-->\n"
365 "\t<Field\n"
366 "\t\tname=\"startTime\"\n"
367 "\t\ttype=\"Time\"\n"
368 "\t\tcardinality=\"single\"\n"
369 "\t\tvisibility=\"internal\"\n"
370 "\t\taccess=\"public\"\n"
371 " defaultValue=\"0.0\"\n"
372 "\t>\n"
373 "\t</Field>\n"
374 "\t<Field\n"
375 "\t\tname=\"timeScale\"\n"
376 "\t\ttype=\"Time\"\n"
377 "\t\tcardinality=\"single\"\n"
378 "\t\tvisibility=\"internal\"\n"
379 "\t\taccess=\"public\"\n"
380 " defaultValue=\"1.0\"\n"
381 "\t>\n"
382 "\t</Field>\n"
383 "\t<Field\n"
384 "\t\tname=\"constantTimeStep\"\n"
385 "\t\ttype=\"Time\"\n"
386 "\t\tcardinality=\"single\"\n"
387 "\t\tvisibility=\"internal\"\n"
388 "\t\taccess=\"public\"\n"
389 " defaultValue=\"0.0\"\n"
390 "\t>\n"
391 "\t</Field>\n"
392 "\t<Field\n"
393 "\t\tname=\"constantTime\"\n"
394 "\t\ttype=\"bool\"\n"
395 "\t\tcardinality=\"single\"\n"
396 "\t\tvisibility=\"internal\"\n"
397 "\t\taccess=\"public\"\n"
398 " defaultValue=\"false\"\n"
399 "\t>\n"
400 "\t</Field>\n"
401 "\t<Field\n"
402 "\t\tname=\"paused\"\n"
403 "\t\ttype=\"bool\"\n"
404 "\t\tcardinality=\"single\"\n"
405 "\t\tvisibility=\"internal\"\n"
406 "\t\taccess=\"public\"\n"
407 " defaultValue=\"false\"\n"
408 "\t>\n"
409 "\t</Field>\n"
410 "\n"
411 "\t<Field\n"
412 "\t\tname=\"dumpFrameStart\"\n"
413 "\t\ttype=\"bool\"\n"
414 "\t\tcardinality=\"single\"\n"
415 "\t\tvisibility=\"internal\"\n"
416 "\t\taccess=\"public\"\n"
417 " defaultValue=\"false\"\n"
418 "\t>\n"
419 "\t</Field>\n"
420 "\n"
421 "\t<Field\n"
422 "\t\tname=\"enableWebService\"\n"
423 "\t\ttype=\"bool\"\n"
424 "\t\tcardinality=\"single\"\n"
425 "\t\tvisibility=\"internal\"\n"
426 "\t\taccess=\"public\"\n"
427 " defaultValue=\"false\"\n"
428 "\t>\n"
429 "\t</Field>\n"
430 "\t<Field\n"
431 "\t\tname=\"webServicePort\"\n"
432 "\t\ttype=\"UInt32\"\n"
433 "\t\tcardinality=\"single\"\n"
434 "\t\tvisibility=\"internal\"\n"
435 "\t\taccess=\"public\"\n"
436 " defaultValue=\"8080\"\n"
437 "\t>\n"
438 "\t</Field>\n"
439 "\t<Field\n"
440 "\t\tname=\"webServiceRoot\"\n"
441 "\t\ttype=\"std::string\"\n"
442 "\t\tcardinality=\"single\"\n"
443 "\t\tvisibility=\"internal\"\n"
444 "\t\taccess=\"public\"\n"
445 " defaultValue='\"RootNode\"'\n"
446 "\t>\n"
447 "\t</Field>\n"
448 "\t<Field\n"
449 "\t\tname=\"waitKeyAfterFrame\"\n"
450 "\t\ttype=\"bool\"\n"
451 "\t\tcardinality=\"single\"\n"
452 "\t\tvisibility=\"internal\"\n"
453 "\t\taccess=\"public\"\n"
454 " defaultValue=\"false\"\n"
455 "\t>\n"
456 "\t</Field>\n"
457 "\n"
458 "</FieldContainer>\n",
462 /*------------------------------ get -----------------------------------*/
464 FieldContainerType &ComplexSceneManagerBase::getType(void)
466 return _type;
469 const FieldContainerType &ComplexSceneManagerBase::getType(void) const
471 return _type;
474 UInt32 ComplexSceneManagerBase::getContainerSize(void) const
476 return sizeof(ComplexSceneManager);
479 /*------------------------- decorator get ------------------------------*/
482 //! Get the ComplexSceneManager::_mfGlobals field.
483 const MFRecFieldContainerPtr *ComplexSceneManagerBase::getMFGlobals(void) const
485 return &_mfGlobals;
488 MFRecFieldContainerPtr *ComplexSceneManagerBase::editMFGlobals (void)
490 editMField(GlobalsFieldMask, _mfGlobals);
492 return &_mfGlobals;
494 FieldContainer * ComplexSceneManagerBase::getGlobals(const UInt32 index) const
496 return _mfGlobals[index];
499 //! Get the ComplexSceneManager::_sfDrawManager field.
500 const SFUnrecCSMDrawManagerPtr *ComplexSceneManagerBase::getSFDrawManager(void) const
502 return &_sfDrawManager;
505 SFUnrecCSMDrawManagerPtr *ComplexSceneManagerBase::editSFDrawManager (void)
507 editSField(DrawManagerFieldMask);
509 return &_sfDrawManager;
512 //! Get the value of the ComplexSceneManager::_sfDrawManager field.
513 CSMDrawManager * ComplexSceneManagerBase::getDrawManager(void) const
515 return _sfDrawManager.getValue();
518 //! Set the value of the ComplexSceneManager::_sfDrawManager field.
519 void ComplexSceneManagerBase::setDrawManager(CSMDrawManager * const value)
521 editSField(DrawManagerFieldMask);
523 _sfDrawManager.setValue(value);
527 SFTime *ComplexSceneManagerBase::editSFStartTime(void)
529 editSField(StartTimeFieldMask);
531 return &_sfStartTime;
534 const SFTime *ComplexSceneManagerBase::getSFStartTime(void) const
536 return &_sfStartTime;
540 SFTime *ComplexSceneManagerBase::editSFTimeScale(void)
542 editSField(TimeScaleFieldMask);
544 return &_sfTimeScale;
547 const SFTime *ComplexSceneManagerBase::getSFTimeScale(void) const
549 return &_sfTimeScale;
553 SFTime *ComplexSceneManagerBase::editSFConstantTimeStep(void)
555 editSField(ConstantTimeStepFieldMask);
557 return &_sfConstantTimeStep;
560 const SFTime *ComplexSceneManagerBase::getSFConstantTimeStep(void) const
562 return &_sfConstantTimeStep;
566 SFBool *ComplexSceneManagerBase::editSFConstantTime(void)
568 editSField(ConstantTimeFieldMask);
570 return &_sfConstantTime;
573 const SFBool *ComplexSceneManagerBase::getSFConstantTime(void) const
575 return &_sfConstantTime;
579 SFBool *ComplexSceneManagerBase::editSFPaused(void)
581 editSField(PausedFieldMask);
583 return &_sfPaused;
586 const SFBool *ComplexSceneManagerBase::getSFPaused(void) const
588 return &_sfPaused;
592 SFBool *ComplexSceneManagerBase::editSFDumpFrameStart(void)
594 editSField(DumpFrameStartFieldMask);
596 return &_sfDumpFrameStart;
599 const SFBool *ComplexSceneManagerBase::getSFDumpFrameStart(void) const
601 return &_sfDumpFrameStart;
605 SFBool *ComplexSceneManagerBase::editSFEnableWebService(void)
607 editSField(EnableWebServiceFieldMask);
609 return &_sfEnableWebService;
612 const SFBool *ComplexSceneManagerBase::getSFEnableWebService(void) const
614 return &_sfEnableWebService;
618 SFUInt32 *ComplexSceneManagerBase::editSFWebServicePort(void)
620 editSField(WebServicePortFieldMask);
622 return &_sfWebServicePort;
625 const SFUInt32 *ComplexSceneManagerBase::getSFWebServicePort(void) const
627 return &_sfWebServicePort;
631 SFString *ComplexSceneManagerBase::editSFWebServiceRoot(void)
633 editSField(WebServiceRootFieldMask);
635 return &_sfWebServiceRoot;
638 const SFString *ComplexSceneManagerBase::getSFWebServiceRoot(void) const
640 return &_sfWebServiceRoot;
644 SFBool *ComplexSceneManagerBase::editSFWaitKeyAfterFrame(void)
646 editSField(WaitKeyAfterFrameFieldMask);
648 return &_sfWaitKeyAfterFrame;
651 const SFBool *ComplexSceneManagerBase::getSFWaitKeyAfterFrame(void) const
653 return &_sfWaitKeyAfterFrame;
659 void ComplexSceneManagerBase::pushToGlobals(FieldContainer * const value)
661 editMField(GlobalsFieldMask, _mfGlobals);
663 _mfGlobals.push_back(value);
666 void ComplexSceneManagerBase::assignGlobals (const MFRecFieldContainerPtr &value)
668 MFRecFieldContainerPtr::const_iterator elemIt =
669 value.begin();
670 MFRecFieldContainerPtr::const_iterator elemEnd =
671 value.end ();
673 static_cast<ComplexSceneManager *>(this)->clearGlobals();
675 while(elemIt != elemEnd)
677 this->pushToGlobals(*elemIt);
679 ++elemIt;
683 void ComplexSceneManagerBase::removeFromGlobals(UInt32 uiIndex)
685 if(uiIndex < _mfGlobals.size())
687 editMField(GlobalsFieldMask, _mfGlobals);
689 _mfGlobals.erase(uiIndex);
693 void ComplexSceneManagerBase::removeObjFromGlobals(FieldContainer * const value)
695 Int32 iElemIdx = _mfGlobals.findIndex(value);
697 if(iElemIdx != -1)
699 editMField(GlobalsFieldMask, _mfGlobals);
701 _mfGlobals.erase(iElemIdx);
704 void ComplexSceneManagerBase::clearGlobals(void)
706 editMField(GlobalsFieldMask, _mfGlobals);
709 _mfGlobals.clear();
714 /*------------------------------ access -----------------------------------*/
716 SizeT ComplexSceneManagerBase::getBinSize(ConstFieldMaskArg whichField)
718 SizeT returnValue = Inherited::getBinSize(whichField);
720 if(FieldBits::NoField != (GlobalsFieldMask & whichField))
722 returnValue += _mfGlobals.getBinSize();
724 if(FieldBits::NoField != (DrawManagerFieldMask & whichField))
726 returnValue += _sfDrawManager.getBinSize();
728 if(FieldBits::NoField != (StartTimeFieldMask & whichField))
730 returnValue += _sfStartTime.getBinSize();
732 if(FieldBits::NoField != (TimeScaleFieldMask & whichField))
734 returnValue += _sfTimeScale.getBinSize();
736 if(FieldBits::NoField != (ConstantTimeStepFieldMask & whichField))
738 returnValue += _sfConstantTimeStep.getBinSize();
740 if(FieldBits::NoField != (ConstantTimeFieldMask & whichField))
742 returnValue += _sfConstantTime.getBinSize();
744 if(FieldBits::NoField != (PausedFieldMask & whichField))
746 returnValue += _sfPaused.getBinSize();
748 if(FieldBits::NoField != (DumpFrameStartFieldMask & whichField))
750 returnValue += _sfDumpFrameStart.getBinSize();
752 if(FieldBits::NoField != (EnableWebServiceFieldMask & whichField))
754 returnValue += _sfEnableWebService.getBinSize();
756 if(FieldBits::NoField != (WebServicePortFieldMask & whichField))
758 returnValue += _sfWebServicePort.getBinSize();
760 if(FieldBits::NoField != (WebServiceRootFieldMask & whichField))
762 returnValue += _sfWebServiceRoot.getBinSize();
764 if(FieldBits::NoField != (WaitKeyAfterFrameFieldMask & whichField))
766 returnValue += _sfWaitKeyAfterFrame.getBinSize();
769 return returnValue;
772 void ComplexSceneManagerBase::copyToBin(BinaryDataHandler &pMem,
773 ConstFieldMaskArg whichField)
775 Inherited::copyToBin(pMem, whichField);
777 if(FieldBits::NoField != (GlobalsFieldMask & whichField))
779 _mfGlobals.copyToBin(pMem);
781 if(FieldBits::NoField != (DrawManagerFieldMask & whichField))
783 _sfDrawManager.copyToBin(pMem);
785 if(FieldBits::NoField != (StartTimeFieldMask & whichField))
787 _sfStartTime.copyToBin(pMem);
789 if(FieldBits::NoField != (TimeScaleFieldMask & whichField))
791 _sfTimeScale.copyToBin(pMem);
793 if(FieldBits::NoField != (ConstantTimeStepFieldMask & whichField))
795 _sfConstantTimeStep.copyToBin(pMem);
797 if(FieldBits::NoField != (ConstantTimeFieldMask & whichField))
799 _sfConstantTime.copyToBin(pMem);
801 if(FieldBits::NoField != (PausedFieldMask & whichField))
803 _sfPaused.copyToBin(pMem);
805 if(FieldBits::NoField != (DumpFrameStartFieldMask & whichField))
807 _sfDumpFrameStart.copyToBin(pMem);
809 if(FieldBits::NoField != (EnableWebServiceFieldMask & whichField))
811 _sfEnableWebService.copyToBin(pMem);
813 if(FieldBits::NoField != (WebServicePortFieldMask & whichField))
815 _sfWebServicePort.copyToBin(pMem);
817 if(FieldBits::NoField != (WebServiceRootFieldMask & whichField))
819 _sfWebServiceRoot.copyToBin(pMem);
821 if(FieldBits::NoField != (WaitKeyAfterFrameFieldMask & whichField))
823 _sfWaitKeyAfterFrame.copyToBin(pMem);
827 void ComplexSceneManagerBase::copyFromBin(BinaryDataHandler &pMem,
828 ConstFieldMaskArg whichField)
830 Inherited::copyFromBin(pMem, whichField);
832 if(FieldBits::NoField != (GlobalsFieldMask & whichField))
834 editMField(GlobalsFieldMask, _mfGlobals);
835 _mfGlobals.copyFromBin(pMem);
837 if(FieldBits::NoField != (DrawManagerFieldMask & whichField))
839 editSField(DrawManagerFieldMask);
840 _sfDrawManager.copyFromBin(pMem);
842 if(FieldBits::NoField != (StartTimeFieldMask & whichField))
844 editSField(StartTimeFieldMask);
845 _sfStartTime.copyFromBin(pMem);
847 if(FieldBits::NoField != (TimeScaleFieldMask & whichField))
849 editSField(TimeScaleFieldMask);
850 _sfTimeScale.copyFromBin(pMem);
852 if(FieldBits::NoField != (ConstantTimeStepFieldMask & whichField))
854 editSField(ConstantTimeStepFieldMask);
855 _sfConstantTimeStep.copyFromBin(pMem);
857 if(FieldBits::NoField != (ConstantTimeFieldMask & whichField))
859 editSField(ConstantTimeFieldMask);
860 _sfConstantTime.copyFromBin(pMem);
862 if(FieldBits::NoField != (PausedFieldMask & whichField))
864 editSField(PausedFieldMask);
865 _sfPaused.copyFromBin(pMem);
867 if(FieldBits::NoField != (DumpFrameStartFieldMask & whichField))
869 editSField(DumpFrameStartFieldMask);
870 _sfDumpFrameStart.copyFromBin(pMem);
872 if(FieldBits::NoField != (EnableWebServiceFieldMask & whichField))
874 editSField(EnableWebServiceFieldMask);
875 _sfEnableWebService.copyFromBin(pMem);
877 if(FieldBits::NoField != (WebServicePortFieldMask & whichField))
879 editSField(WebServicePortFieldMask);
880 _sfWebServicePort.copyFromBin(pMem);
882 if(FieldBits::NoField != (WebServiceRootFieldMask & whichField))
884 editSField(WebServiceRootFieldMask);
885 _sfWebServiceRoot.copyFromBin(pMem);
887 if(FieldBits::NoField != (WaitKeyAfterFrameFieldMask & whichField))
889 editSField(WaitKeyAfterFrameFieldMask);
890 _sfWaitKeyAfterFrame.copyFromBin(pMem);
894 //! create a new instance of the class
895 ComplexSceneManagerTransitPtr ComplexSceneManagerBase::createLocal(BitVector bFlags)
897 ComplexSceneManagerTransitPtr fc;
899 if(getClassType().getPrototype() != NULL)
901 FieldContainerTransitPtr tmpPtr =
902 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
904 fc = dynamic_pointer_cast<ComplexSceneManager>(tmpPtr);
907 return fc;
910 //! create a new instance of the class, copy the container flags
911 ComplexSceneManagerTransitPtr ComplexSceneManagerBase::createDependent(BitVector bFlags)
913 ComplexSceneManagerTransitPtr fc;
915 if(getClassType().getPrototype() != NULL)
917 FieldContainerTransitPtr tmpPtr =
918 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
920 fc = dynamic_pointer_cast<ComplexSceneManager>(tmpPtr);
923 return fc;
926 //! create a new instance of the class
927 ComplexSceneManagerTransitPtr ComplexSceneManagerBase::create(void)
929 return createLocal();
932 ComplexSceneManager *ComplexSceneManagerBase::createEmptyLocal(BitVector bFlags)
934 ComplexSceneManager *returnValue;
936 newPtr<ComplexSceneManager>(returnValue, bFlags);
938 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
940 return returnValue;
943 //! create an empty new instance of the class, do not copy the prototype
944 ComplexSceneManager *ComplexSceneManagerBase::createEmpty(void)
946 return createEmptyLocal();
950 FieldContainerTransitPtr ComplexSceneManagerBase::shallowCopyLocal(
951 BitVector bFlags) const
953 ComplexSceneManager *tmpPtr;
955 newPtr(tmpPtr, dynamic_cast<const ComplexSceneManager *>(this), bFlags);
957 FieldContainerTransitPtr returnValue(tmpPtr);
959 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
961 return returnValue;
964 FieldContainerTransitPtr ComplexSceneManagerBase::shallowCopyDependent(
965 BitVector bFlags) const
967 ComplexSceneManager *tmpPtr;
969 newPtr(tmpPtr, dynamic_cast<const ComplexSceneManager *>(this), ~bFlags);
971 FieldContainerTransitPtr returnValue(tmpPtr);
973 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
975 return returnValue;
978 FieldContainerTransitPtr ComplexSceneManagerBase::shallowCopy(void) const
980 return shallowCopyLocal();
986 /*------------------------- constructors ----------------------------------*/
988 ComplexSceneManagerBase::ComplexSceneManagerBase(void) :
989 Inherited(),
990 _mfGlobals (),
991 _sfDrawManager (NULL),
992 _sfStartTime (Time(0.0)),
993 _sfTimeScale (Time(1.0)),
994 _sfConstantTimeStep (Time(0.0)),
995 _sfConstantTime (bool(false)),
996 _sfPaused (bool(false)),
997 _sfDumpFrameStart (bool(false)),
998 _sfEnableWebService (bool(false)),
999 _sfWebServicePort (UInt32(8080)),
1000 _sfWebServiceRoot (std::string("RootNode")),
1001 _sfWaitKeyAfterFrame (bool(false))
1005 ComplexSceneManagerBase::ComplexSceneManagerBase(const ComplexSceneManagerBase &source) :
1006 Inherited(source),
1007 _mfGlobals (),
1008 _sfDrawManager (NULL),
1009 _sfStartTime (source._sfStartTime ),
1010 _sfTimeScale (source._sfTimeScale ),
1011 _sfConstantTimeStep (source._sfConstantTimeStep ),
1012 _sfConstantTime (source._sfConstantTime ),
1013 _sfPaused (source._sfPaused ),
1014 _sfDumpFrameStart (source._sfDumpFrameStart ),
1015 _sfEnableWebService (source._sfEnableWebService ),
1016 _sfWebServicePort (source._sfWebServicePort ),
1017 _sfWebServiceRoot (source._sfWebServiceRoot ),
1018 _sfWaitKeyAfterFrame (source._sfWaitKeyAfterFrame )
1023 /*-------------------------- destructors ----------------------------------*/
1025 ComplexSceneManagerBase::~ComplexSceneManagerBase(void)
1029 void ComplexSceneManagerBase::onCreate(const ComplexSceneManager *source)
1031 Inherited::onCreate(source);
1033 if(source != NULL)
1035 ComplexSceneManager *pThis = static_cast<ComplexSceneManager *>(this);
1037 MFRecFieldContainerPtr::const_iterator GlobalsIt =
1038 source->_mfGlobals.begin();
1039 MFRecFieldContainerPtr::const_iterator GlobalsEnd =
1040 source->_mfGlobals.end ();
1042 while(GlobalsIt != GlobalsEnd)
1044 pThis->pushToGlobals(*GlobalsIt);
1046 ++GlobalsIt;
1049 pThis->setDrawManager(source->getDrawManager());
1053 GetFieldHandlePtr ComplexSceneManagerBase::getHandleGlobals (void) const
1055 MFRecFieldContainerPtr::GetHandlePtr returnValue(
1056 new MFRecFieldContainerPtr::GetHandle(
1057 &_mfGlobals,
1058 this->getType().getFieldDesc(GlobalsFieldId),
1059 const_cast<ComplexSceneManagerBase *>(this)));
1061 return returnValue;
1064 EditFieldHandlePtr ComplexSceneManagerBase::editHandleGlobals (void)
1066 MFRecFieldContainerPtr::EditHandlePtr returnValue(
1067 new MFRecFieldContainerPtr::EditHandle(
1068 &_mfGlobals,
1069 this->getType().getFieldDesc(GlobalsFieldId),
1070 this));
1072 returnValue->setAddMethod(
1073 boost::bind(&ComplexSceneManager::pushToGlobals,
1074 static_cast<ComplexSceneManager *>(this), _1));
1075 returnValue->setRemoveMethod(
1076 boost::bind(&ComplexSceneManager::removeFromGlobals,
1077 static_cast<ComplexSceneManager *>(this), _1));
1078 returnValue->setRemoveObjMethod(
1079 boost::bind(&ComplexSceneManager::removeObjFromGlobals,
1080 static_cast<ComplexSceneManager *>(this), _1));
1081 returnValue->setClearMethod(
1082 boost::bind(&ComplexSceneManager::clearGlobals,
1083 static_cast<ComplexSceneManager *>(this)));
1085 editMField(GlobalsFieldMask, _mfGlobals);
1087 return returnValue;
1090 GetFieldHandlePtr ComplexSceneManagerBase::getHandleDrawManager (void) const
1092 SFUnrecCSMDrawManagerPtr::GetHandlePtr returnValue(
1093 new SFUnrecCSMDrawManagerPtr::GetHandle(
1094 &_sfDrawManager,
1095 this->getType().getFieldDesc(DrawManagerFieldId),
1096 const_cast<ComplexSceneManagerBase *>(this)));
1098 return returnValue;
1101 EditFieldHandlePtr ComplexSceneManagerBase::editHandleDrawManager (void)
1103 SFUnrecCSMDrawManagerPtr::EditHandlePtr returnValue(
1104 new SFUnrecCSMDrawManagerPtr::EditHandle(
1105 &_sfDrawManager,
1106 this->getType().getFieldDesc(DrawManagerFieldId),
1107 this));
1109 returnValue->setSetMethod(
1110 boost::bind(&ComplexSceneManager::setDrawManager,
1111 static_cast<ComplexSceneManager *>(this), _1));
1113 editSField(DrawManagerFieldMask);
1115 return returnValue;
1118 GetFieldHandlePtr ComplexSceneManagerBase::getHandleStartTime (void) const
1120 SFTime::GetHandlePtr returnValue(
1121 new SFTime::GetHandle(
1122 &_sfStartTime,
1123 this->getType().getFieldDesc(StartTimeFieldId),
1124 const_cast<ComplexSceneManagerBase *>(this)));
1126 return returnValue;
1129 EditFieldHandlePtr ComplexSceneManagerBase::editHandleStartTime (void)
1131 SFTime::EditHandlePtr returnValue(
1132 new SFTime::EditHandle(
1133 &_sfStartTime,
1134 this->getType().getFieldDesc(StartTimeFieldId),
1135 this));
1138 editSField(StartTimeFieldMask);
1140 return returnValue;
1143 GetFieldHandlePtr ComplexSceneManagerBase::getHandleTimeScale (void) const
1145 SFTime::GetHandlePtr returnValue(
1146 new SFTime::GetHandle(
1147 &_sfTimeScale,
1148 this->getType().getFieldDesc(TimeScaleFieldId),
1149 const_cast<ComplexSceneManagerBase *>(this)));
1151 return returnValue;
1154 EditFieldHandlePtr ComplexSceneManagerBase::editHandleTimeScale (void)
1156 SFTime::EditHandlePtr returnValue(
1157 new SFTime::EditHandle(
1158 &_sfTimeScale,
1159 this->getType().getFieldDesc(TimeScaleFieldId),
1160 this));
1163 editSField(TimeScaleFieldMask);
1165 return returnValue;
1168 GetFieldHandlePtr ComplexSceneManagerBase::getHandleConstantTimeStep (void) const
1170 SFTime::GetHandlePtr returnValue(
1171 new SFTime::GetHandle(
1172 &_sfConstantTimeStep,
1173 this->getType().getFieldDesc(ConstantTimeStepFieldId),
1174 const_cast<ComplexSceneManagerBase *>(this)));
1176 return returnValue;
1179 EditFieldHandlePtr ComplexSceneManagerBase::editHandleConstantTimeStep(void)
1181 SFTime::EditHandlePtr returnValue(
1182 new SFTime::EditHandle(
1183 &_sfConstantTimeStep,
1184 this->getType().getFieldDesc(ConstantTimeStepFieldId),
1185 this));
1188 editSField(ConstantTimeStepFieldMask);
1190 return returnValue;
1193 GetFieldHandlePtr ComplexSceneManagerBase::getHandleConstantTime (void) const
1195 SFBool::GetHandlePtr returnValue(
1196 new SFBool::GetHandle(
1197 &_sfConstantTime,
1198 this->getType().getFieldDesc(ConstantTimeFieldId),
1199 const_cast<ComplexSceneManagerBase *>(this)));
1201 return returnValue;
1204 EditFieldHandlePtr ComplexSceneManagerBase::editHandleConstantTime (void)
1206 SFBool::EditHandlePtr returnValue(
1207 new SFBool::EditHandle(
1208 &_sfConstantTime,
1209 this->getType().getFieldDesc(ConstantTimeFieldId),
1210 this));
1213 editSField(ConstantTimeFieldMask);
1215 return returnValue;
1218 GetFieldHandlePtr ComplexSceneManagerBase::getHandlePaused (void) const
1220 SFBool::GetHandlePtr returnValue(
1221 new SFBool::GetHandle(
1222 &_sfPaused,
1223 this->getType().getFieldDesc(PausedFieldId),
1224 const_cast<ComplexSceneManagerBase *>(this)));
1226 return returnValue;
1229 EditFieldHandlePtr ComplexSceneManagerBase::editHandlePaused (void)
1231 SFBool::EditHandlePtr returnValue(
1232 new SFBool::EditHandle(
1233 &_sfPaused,
1234 this->getType().getFieldDesc(PausedFieldId),
1235 this));
1238 editSField(PausedFieldMask);
1240 return returnValue;
1243 GetFieldHandlePtr ComplexSceneManagerBase::getHandleDumpFrameStart (void) const
1245 SFBool::GetHandlePtr returnValue(
1246 new SFBool::GetHandle(
1247 &_sfDumpFrameStart,
1248 this->getType().getFieldDesc(DumpFrameStartFieldId),
1249 const_cast<ComplexSceneManagerBase *>(this)));
1251 return returnValue;
1254 EditFieldHandlePtr ComplexSceneManagerBase::editHandleDumpFrameStart (void)
1256 SFBool::EditHandlePtr returnValue(
1257 new SFBool::EditHandle(
1258 &_sfDumpFrameStart,
1259 this->getType().getFieldDesc(DumpFrameStartFieldId),
1260 this));
1263 editSField(DumpFrameStartFieldMask);
1265 return returnValue;
1268 GetFieldHandlePtr ComplexSceneManagerBase::getHandleEnableWebService (void) const
1270 SFBool::GetHandlePtr returnValue(
1271 new SFBool::GetHandle(
1272 &_sfEnableWebService,
1273 this->getType().getFieldDesc(EnableWebServiceFieldId),
1274 const_cast<ComplexSceneManagerBase *>(this)));
1276 return returnValue;
1279 EditFieldHandlePtr ComplexSceneManagerBase::editHandleEnableWebService(void)
1281 SFBool::EditHandlePtr returnValue(
1282 new SFBool::EditHandle(
1283 &_sfEnableWebService,
1284 this->getType().getFieldDesc(EnableWebServiceFieldId),
1285 this));
1288 editSField(EnableWebServiceFieldMask);
1290 return returnValue;
1293 GetFieldHandlePtr ComplexSceneManagerBase::getHandleWebServicePort (void) const
1295 SFUInt32::GetHandlePtr returnValue(
1296 new SFUInt32::GetHandle(
1297 &_sfWebServicePort,
1298 this->getType().getFieldDesc(WebServicePortFieldId),
1299 const_cast<ComplexSceneManagerBase *>(this)));
1301 return returnValue;
1304 EditFieldHandlePtr ComplexSceneManagerBase::editHandleWebServicePort (void)
1306 SFUInt32::EditHandlePtr returnValue(
1307 new SFUInt32::EditHandle(
1308 &_sfWebServicePort,
1309 this->getType().getFieldDesc(WebServicePortFieldId),
1310 this));
1313 editSField(WebServicePortFieldMask);
1315 return returnValue;
1318 GetFieldHandlePtr ComplexSceneManagerBase::getHandleWebServiceRoot (void) const
1320 SFString::GetHandlePtr returnValue(
1321 new SFString::GetHandle(
1322 &_sfWebServiceRoot,
1323 this->getType().getFieldDesc(WebServiceRootFieldId),
1324 const_cast<ComplexSceneManagerBase *>(this)));
1326 return returnValue;
1329 EditFieldHandlePtr ComplexSceneManagerBase::editHandleWebServiceRoot (void)
1331 SFString::EditHandlePtr returnValue(
1332 new SFString::EditHandle(
1333 &_sfWebServiceRoot,
1334 this->getType().getFieldDesc(WebServiceRootFieldId),
1335 this));
1338 editSField(WebServiceRootFieldMask);
1340 return returnValue;
1343 GetFieldHandlePtr ComplexSceneManagerBase::getHandleWaitKeyAfterFrame (void) const
1345 SFBool::GetHandlePtr returnValue(
1346 new SFBool::GetHandle(
1347 &_sfWaitKeyAfterFrame,
1348 this->getType().getFieldDesc(WaitKeyAfterFrameFieldId),
1349 const_cast<ComplexSceneManagerBase *>(this)));
1351 return returnValue;
1354 EditFieldHandlePtr ComplexSceneManagerBase::editHandleWaitKeyAfterFrame(void)
1356 SFBool::EditHandlePtr returnValue(
1357 new SFBool::EditHandle(
1358 &_sfWaitKeyAfterFrame,
1359 this->getType().getFieldDesc(WaitKeyAfterFrameFieldId),
1360 this));
1363 editSField(WaitKeyAfterFrameFieldMask);
1365 return returnValue;
1369 #ifdef OSG_MT_CPTR_ASPECT
1370 void ComplexSceneManagerBase::execSyncV( FieldContainer &oFrom,
1371 ConstFieldMaskArg whichField,
1372 AspectOffsetStore &oOffsets,
1373 ConstFieldMaskArg syncMode,
1374 const UInt32 uiSyncInfo)
1376 ComplexSceneManager *pThis = static_cast<ComplexSceneManager *>(this);
1378 pThis->execSync(static_cast<ComplexSceneManager *>(&oFrom),
1379 whichField,
1380 oOffsets,
1381 syncMode,
1382 uiSyncInfo);
1384 #endif
1387 #ifdef OSG_MT_CPTR_ASPECT
1388 FieldContainer *ComplexSceneManagerBase::createAspectCopy(
1389 const FieldContainer *pRefAspect) const
1391 ComplexSceneManager *returnValue;
1393 newAspectCopy(returnValue,
1394 dynamic_cast<const ComplexSceneManager *>(pRefAspect),
1395 dynamic_cast<const ComplexSceneManager *>(this));
1397 return returnValue;
1399 #endif
1401 void ComplexSceneManagerBase::resolveLinks(void)
1403 Inherited::resolveLinks();
1405 static_cast<ComplexSceneManager *>(this)->clearGlobals();
1407 static_cast<ComplexSceneManager *>(this)->setDrawManager(NULL);
1413 OSG_END_NAMESPACE