changed: gcc8 base update
[opensg.git] / Source / Contrib / ComplexSceneManager / Helper / OSGCSMLoggerBase.cpp
blobc762ca76453cd788b5ee68f6b8b1958528fa99f5
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 CSMLogger!
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" // Containers Class
67 #include "OSGCSMLoggerBase.h"
68 #include "OSGCSMLogger.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::CSMLogger
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var bool CSMLoggerBase::_sfEnabled
90 /*! \var FieldContainer * CSMLoggerBase::_mfContainers
94 /*! \var std::string CSMLoggerBase::_mfFields
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits<CSMLogger *, nsOSG>::_type(
105 "CSMLoggerPtr",
106 "AttachmentContainerPtr",
107 CSMLogger::getClassType(),
108 nsOSG);
109 #endif
111 OSG_FIELDTRAITS_GETTYPE_NS(CSMLogger *, nsOSG)
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void CSMLoggerBase::classDescInserter(TypeObject &oType)
119 FieldDescriptionBase *pDesc = NULL;
122 pDesc = new SFBool::Description(
123 SFBool::getClassType(),
124 "enabled",
126 EnabledFieldId, EnabledFieldMask,
127 false,
128 (Field::SFDefaultFlags | Field::FStdAccess),
129 static_cast<FieldEditMethodSig>(&CSMLogger::editHandleEnabled),
130 static_cast<FieldGetMethodSig >(&CSMLogger::getHandleEnabled));
132 oType.addInitialDesc(pDesc);
134 pDesc = new MFUnrecFieldContainerPtr::Description(
135 MFUnrecFieldContainerPtr::getClassType(),
136 "containers",
138 ContainersFieldId, ContainersFieldMask,
139 false,
140 (Field::MFDefaultFlags | Field::FStdAccess),
141 static_cast<FieldEditMethodSig>(&CSMLogger::editHandleContainers),
142 static_cast<FieldGetMethodSig >(&CSMLogger::getHandleContainers));
144 oType.addInitialDesc(pDesc);
146 pDesc = new MFString::Description(
147 MFString::getClassType(),
148 "fields",
150 FieldsFieldId, FieldsFieldMask,
151 false,
152 (Field::MFDefaultFlags | Field::FStdAccess),
153 static_cast<FieldEditMethodSig>(&CSMLogger::editHandleFields),
154 static_cast<FieldGetMethodSig >(&CSMLogger::getHandleFields));
156 oType.addInitialDesc(pDesc);
160 CSMLoggerBase::TypeObject CSMLoggerBase::_type(
161 CSMLoggerBase::getClassname(),
162 Inherited::getClassname(),
163 "NULL",
164 nsOSG, //Namespace
165 reinterpret_cast<PrototypeCreateF>(&CSMLoggerBase::createEmptyLocal),
166 reinterpret_cast<InitContainerF>(&CSMLogger::initMethod),
167 reinterpret_cast<ExitContainerF>(&CSMLogger::exitMethod),
168 reinterpret_cast<InitalInsertDescFunc>(
169 reinterpret_cast<void *>(&CSMLogger::classDescInserter)),
170 false,
172 "<?xml version=\"1.0\"?>\n"
173 "\n"
174 "<FieldContainer\n"
175 " name=\"CSMLogger\"\n"
176 " parent=\"AttachmentContainer\"\n"
177 " library=\"ContribCSM\"\n"
178 " pointerfieldtypes=\"none\"\n"
179 " structure=\"concrete\"\n"
180 " systemcomponent=\"true\"\n"
181 " parentsystemcomponent=\"true\"\n"
182 " decoratable=\"false\"\n"
183 " useLocalIncludes=\"false\"\n"
184 " isNodeCore=\"false\"\n"
185 " isBundle=\"true\"\n"
186 " parentFields=\"none\"\n"
187 " >\n"
188 " <Field\n"
189 " name=\"enabled\"\n"
190 " type=\"bool\"\n"
191 " defaultValue=\"true\"\n"
192 " cardinality=\"single\"\n"
193 " visibility=\"external\"\n"
194 " access=\"public\">\n"
195 " </Field>\n"
196 " <Field\n"
197 " name=\"containers\"\n"
198 " type=\"FieldContainer\"\n"
199 " cardinality=\"multi\"\n"
200 " visibility=\"external\"\n"
201 " access=\"public\"\n"
202 " category=\"pointer\"\n"
203 " >\n"
204 " </Field>\n"
205 " <Field\n"
206 " name=\"fields\"\n"
207 " type=\"std::string\"\n"
208 " cardinality=\"multi\"\n"
209 " visibility=\"external\"\n"
210 " access=\"public\"\n"
211 " >\n"
212 " </Field>\n"
213 "</FieldContainer>\n",
217 /*------------------------------ get -----------------------------------*/
219 FieldContainerType &CSMLoggerBase::getType(void)
221 return _type;
224 const FieldContainerType &CSMLoggerBase::getType(void) const
226 return _type;
229 UInt32 CSMLoggerBase::getContainerSize(void) const
231 return sizeof(CSMLogger);
234 /*------------------------- decorator get ------------------------------*/
237 SFBool *CSMLoggerBase::editSFEnabled(void)
239 editSField(EnabledFieldMask);
241 return &_sfEnabled;
244 const SFBool *CSMLoggerBase::getSFEnabled(void) const
246 return &_sfEnabled;
250 //! Get the CSMLogger::_mfContainers field.
251 const MFUnrecFieldContainerPtr *CSMLoggerBase::getMFContainers(void) const
253 return &_mfContainers;
256 MFUnrecFieldContainerPtr *CSMLoggerBase::editMFContainers (void)
258 editMField(ContainersFieldMask, _mfContainers);
260 return &_mfContainers;
262 FieldContainer * CSMLoggerBase::getContainers(const UInt32 index) const
264 return _mfContainers[index];
267 MFString *CSMLoggerBase::editMFFields(void)
269 editMField(FieldsFieldMask, _mfFields);
271 return &_mfFields;
274 const MFString *CSMLoggerBase::getMFFields(void) const
276 return &_mfFields;
282 void CSMLoggerBase::pushToContainers(FieldContainer * const value)
284 editMField(ContainersFieldMask, _mfContainers);
286 _mfContainers.push_back(value);
289 void CSMLoggerBase::assignContainers(const MFUnrecFieldContainerPtr &value)
291 MFUnrecFieldContainerPtr::const_iterator elemIt =
292 value.begin();
293 MFUnrecFieldContainerPtr::const_iterator elemEnd =
294 value.end ();
296 static_cast<CSMLogger *>(this)->clearContainers();
298 while(elemIt != elemEnd)
300 this->pushToContainers(*elemIt);
302 ++elemIt;
306 void CSMLoggerBase::removeFromContainers(UInt32 uiIndex)
308 if(uiIndex < _mfContainers.size())
310 editMField(ContainersFieldMask, _mfContainers);
312 _mfContainers.erase(uiIndex);
316 void CSMLoggerBase::removeObjFromContainers(FieldContainer * const value)
318 Int32 iElemIdx = _mfContainers.findIndex(value);
320 if(iElemIdx != -1)
322 editMField(ContainersFieldMask, _mfContainers);
324 _mfContainers.erase(iElemIdx);
327 void CSMLoggerBase::clearContainers(void)
329 editMField(ContainersFieldMask, _mfContainers);
332 _mfContainers.clear();
337 /*------------------------------ access -----------------------------------*/
339 SizeT CSMLoggerBase::getBinSize(ConstFieldMaskArg whichField)
341 SizeT returnValue = Inherited::getBinSize(whichField);
343 if(FieldBits::NoField != (EnabledFieldMask & whichField))
345 returnValue += _sfEnabled.getBinSize();
347 if(FieldBits::NoField != (ContainersFieldMask & whichField))
349 returnValue += _mfContainers.getBinSize();
351 if(FieldBits::NoField != (FieldsFieldMask & whichField))
353 returnValue += _mfFields.getBinSize();
356 return returnValue;
359 void CSMLoggerBase::copyToBin(BinaryDataHandler &pMem,
360 ConstFieldMaskArg whichField)
362 Inherited::copyToBin(pMem, whichField);
364 if(FieldBits::NoField != (EnabledFieldMask & whichField))
366 _sfEnabled.copyToBin(pMem);
368 if(FieldBits::NoField != (ContainersFieldMask & whichField))
370 _mfContainers.copyToBin(pMem);
372 if(FieldBits::NoField != (FieldsFieldMask & whichField))
374 _mfFields.copyToBin(pMem);
378 void CSMLoggerBase::copyFromBin(BinaryDataHandler &pMem,
379 ConstFieldMaskArg whichField)
381 Inherited::copyFromBin(pMem, whichField);
383 if(FieldBits::NoField != (EnabledFieldMask & whichField))
385 editSField(EnabledFieldMask);
386 _sfEnabled.copyFromBin(pMem);
388 if(FieldBits::NoField != (ContainersFieldMask & whichField))
390 editMField(ContainersFieldMask, _mfContainers);
391 _mfContainers.copyFromBin(pMem);
393 if(FieldBits::NoField != (FieldsFieldMask & whichField))
395 editMField(FieldsFieldMask, _mfFields);
396 _mfFields.copyFromBin(pMem);
400 //! create a new instance of the class
401 CSMLoggerTransitPtr CSMLoggerBase::createLocal(BitVector bFlags)
403 CSMLoggerTransitPtr fc;
405 if(getClassType().getPrototype() != NULL)
407 FieldContainerTransitPtr tmpPtr =
408 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
410 fc = dynamic_pointer_cast<CSMLogger>(tmpPtr);
413 return fc;
416 //! create a new instance of the class, copy the container flags
417 CSMLoggerTransitPtr CSMLoggerBase::createDependent(BitVector bFlags)
419 CSMLoggerTransitPtr fc;
421 if(getClassType().getPrototype() != NULL)
423 FieldContainerTransitPtr tmpPtr =
424 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
426 fc = dynamic_pointer_cast<CSMLogger>(tmpPtr);
429 return fc;
432 //! create a new instance of the class
433 CSMLoggerTransitPtr CSMLoggerBase::create(void)
435 return createLocal();
438 CSMLogger *CSMLoggerBase::createEmptyLocal(BitVector bFlags)
440 CSMLogger *returnValue;
442 newPtr<CSMLogger>(returnValue, bFlags);
444 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
446 return returnValue;
449 //! create an empty new instance of the class, do not copy the prototype
450 CSMLogger *CSMLoggerBase::createEmpty(void)
452 return createEmptyLocal();
456 FieldContainerTransitPtr CSMLoggerBase::shallowCopyLocal(
457 BitVector bFlags) const
459 CSMLogger *tmpPtr;
461 newPtr(tmpPtr, dynamic_cast<const CSMLogger *>(this), bFlags);
463 FieldContainerTransitPtr returnValue(tmpPtr);
465 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
467 return returnValue;
470 FieldContainerTransitPtr CSMLoggerBase::shallowCopyDependent(
471 BitVector bFlags) const
473 CSMLogger *tmpPtr;
475 newPtr(tmpPtr, dynamic_cast<const CSMLogger *>(this), ~bFlags);
477 FieldContainerTransitPtr returnValue(tmpPtr);
479 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
481 return returnValue;
484 FieldContainerTransitPtr CSMLoggerBase::shallowCopy(void) const
486 return shallowCopyLocal();
492 /*------------------------- constructors ----------------------------------*/
494 CSMLoggerBase::CSMLoggerBase(void) :
495 Inherited(),
496 _sfEnabled (bool(true)),
497 _mfContainers (),
498 _mfFields ()
502 CSMLoggerBase::CSMLoggerBase(const CSMLoggerBase &source) :
503 Inherited(source),
504 _sfEnabled (source._sfEnabled ),
505 _mfContainers (),
506 _mfFields (source._mfFields )
511 /*-------------------------- destructors ----------------------------------*/
513 CSMLoggerBase::~CSMLoggerBase(void)
517 void CSMLoggerBase::onCreate(const CSMLogger *source)
519 Inherited::onCreate(source);
521 if(source != NULL)
523 CSMLogger *pThis = static_cast<CSMLogger *>(this);
525 MFUnrecFieldContainerPtr::const_iterator ContainersIt =
526 source->_mfContainers.begin();
527 MFUnrecFieldContainerPtr::const_iterator ContainersEnd =
528 source->_mfContainers.end ();
530 while(ContainersIt != ContainersEnd)
532 pThis->pushToContainers(*ContainersIt);
534 ++ContainersIt;
539 GetFieldHandlePtr CSMLoggerBase::getHandleEnabled (void) const
541 SFBool::GetHandlePtr returnValue(
542 new SFBool::GetHandle(
543 &_sfEnabled,
544 this->getType().getFieldDesc(EnabledFieldId),
545 const_cast<CSMLoggerBase *>(this)));
547 return returnValue;
550 EditFieldHandlePtr CSMLoggerBase::editHandleEnabled (void)
552 SFBool::EditHandlePtr returnValue(
553 new SFBool::EditHandle(
554 &_sfEnabled,
555 this->getType().getFieldDesc(EnabledFieldId),
556 this));
559 editSField(EnabledFieldMask);
561 return returnValue;
564 GetFieldHandlePtr CSMLoggerBase::getHandleContainers (void) const
566 MFUnrecFieldContainerPtr::GetHandlePtr returnValue(
567 new MFUnrecFieldContainerPtr::GetHandle(
568 &_mfContainers,
569 this->getType().getFieldDesc(ContainersFieldId),
570 const_cast<CSMLoggerBase *>(this)));
572 return returnValue;
575 EditFieldHandlePtr CSMLoggerBase::editHandleContainers (void)
577 MFUnrecFieldContainerPtr::EditHandlePtr returnValue(
578 new MFUnrecFieldContainerPtr::EditHandle(
579 &_mfContainers,
580 this->getType().getFieldDesc(ContainersFieldId),
581 this));
583 returnValue->setAddMethod(
584 boost::bind(&CSMLogger::pushToContainers,
585 static_cast<CSMLogger *>(this), _1));
586 returnValue->setRemoveMethod(
587 boost::bind(&CSMLogger::removeFromContainers,
588 static_cast<CSMLogger *>(this), _1));
589 returnValue->setRemoveObjMethod(
590 boost::bind(&CSMLogger::removeObjFromContainers,
591 static_cast<CSMLogger *>(this), _1));
592 returnValue->setClearMethod(
593 boost::bind(&CSMLogger::clearContainers,
594 static_cast<CSMLogger *>(this)));
596 editMField(ContainersFieldMask, _mfContainers);
598 return returnValue;
601 GetFieldHandlePtr CSMLoggerBase::getHandleFields (void) const
603 MFString::GetHandlePtr returnValue(
604 new MFString::GetHandle(
605 &_mfFields,
606 this->getType().getFieldDesc(FieldsFieldId),
607 const_cast<CSMLoggerBase *>(this)));
609 return returnValue;
612 EditFieldHandlePtr CSMLoggerBase::editHandleFields (void)
614 MFString::EditHandlePtr returnValue(
615 new MFString::EditHandle(
616 &_mfFields,
617 this->getType().getFieldDesc(FieldsFieldId),
618 this));
621 editMField(FieldsFieldMask, _mfFields);
623 return returnValue;
627 #ifdef OSG_MT_CPTR_ASPECT
628 void CSMLoggerBase::execSyncV( FieldContainer &oFrom,
629 ConstFieldMaskArg whichField,
630 AspectOffsetStore &oOffsets,
631 ConstFieldMaskArg syncMode,
632 const UInt32 uiSyncInfo)
634 CSMLogger *pThis = static_cast<CSMLogger *>(this);
636 pThis->execSync(static_cast<CSMLogger *>(&oFrom),
637 whichField,
638 oOffsets,
639 syncMode,
640 uiSyncInfo);
642 #endif
645 #ifdef OSG_MT_CPTR_ASPECT
646 FieldContainer *CSMLoggerBase::createAspectCopy(
647 const FieldContainer *pRefAspect) const
649 CSMLogger *returnValue;
651 newAspectCopy(returnValue,
652 dynamic_cast<const CSMLogger *>(pRefAspect),
653 dynamic_cast<const CSMLogger *>(this));
655 return returnValue;
657 #endif
659 void CSMLoggerBase::resolveLinks(void)
661 Inherited::resolveLinks();
663 static_cast<CSMLogger *>(this)->clearContainers();
665 #ifdef OSG_MT_CPTR_ASPECT
666 AspectOffsetStore oOffsets;
668 _pAspectStore->fillOffsetArray(oOffsets, this);
669 #endif
671 #ifdef OSG_MT_CPTR_ASPECT
672 _mfFields.terminateShare(Thread::getCurrentAspect(),
673 oOffsets);
674 #endif
678 OSG_END_NAMESPACE