1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGFieldContainer.h" // Containers Class
67 #include "OSGCSMLoggerBase.h"
68 #include "OSGCSMLogger.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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(
106 "AttachmentContainerPtr",
107 CSMLogger::getClassType(),
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(),
126 EnabledFieldId
, EnabledFieldMask
,
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(),
138 ContainersFieldId
, ContainersFieldMask
,
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(),
150 FieldsFieldId
, FieldsFieldMask
,
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(),
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
)),
172 "<?xml version=\"1.0\"?>\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"
189 " name=\"enabled\"\n"
191 " defaultValue=\"true\"\n"
192 " cardinality=\"single\"\n"
193 " visibility=\"external\"\n"
194 " access=\"public\">\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"
207 " type=\"std::string\"\n"
208 " cardinality=\"multi\"\n"
209 " visibility=\"external\"\n"
210 " access=\"public\"\n"
213 "</FieldContainer>\n",
217 /*------------------------------ get -----------------------------------*/
219 FieldContainerType
&CSMLoggerBase::getType(void)
224 const FieldContainerType
&CSMLoggerBase::getType(void) const
229 UInt32
CSMLoggerBase::getContainerSize(void) const
231 return sizeof(CSMLogger
);
234 /*------------------------- decorator get ------------------------------*/
237 SFBool
*CSMLoggerBase::editSFEnabled(void)
239 editSField(EnabledFieldMask
);
244 const SFBool
*CSMLoggerBase::getSFEnabled(void) const
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
);
274 const MFString
*CSMLoggerBase::getMFFields(void) const
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
=
293 MFUnrecFieldContainerPtr::const_iterator elemEnd
=
296 static_cast<CSMLogger
*>(this)->clearContainers();
298 while(elemIt
!= elemEnd
)
300 this->pushToContainers(*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
);
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();
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
);
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
);
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
;
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
461 newPtr(tmpPtr
, dynamic_cast<const CSMLogger
*>(this), bFlags
);
463 FieldContainerTransitPtr
returnValue(tmpPtr
);
465 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
470 FieldContainerTransitPtr
CSMLoggerBase::shallowCopyDependent(
471 BitVector bFlags
) const
475 newPtr(tmpPtr
, dynamic_cast<const CSMLogger
*>(this), ~bFlags
);
477 FieldContainerTransitPtr
returnValue(tmpPtr
);
479 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
484 FieldContainerTransitPtr
CSMLoggerBase::shallowCopy(void) const
486 return shallowCopyLocal();
492 /*------------------------- constructors ----------------------------------*/
494 CSMLoggerBase::CSMLoggerBase(void) :
496 _sfEnabled (bool(true)),
502 CSMLoggerBase::CSMLoggerBase(const CSMLoggerBase
&source
) :
504 _sfEnabled (source
._sfEnabled
),
506 _mfFields (source
._mfFields
)
511 /*-------------------------- destructors ----------------------------------*/
513 CSMLoggerBase::~CSMLoggerBase(void)
517 void CSMLoggerBase::onCreate(const CSMLogger
*source
)
519 Inherited::onCreate(source
);
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
);
539 GetFieldHandlePtr
CSMLoggerBase::getHandleEnabled (void) const
541 SFBool::GetHandlePtr
returnValue(
542 new SFBool::GetHandle(
544 this->getType().getFieldDesc(EnabledFieldId
),
545 const_cast<CSMLoggerBase
*>(this)));
550 EditFieldHandlePtr
CSMLoggerBase::editHandleEnabled (void)
552 SFBool::EditHandlePtr
returnValue(
553 new SFBool::EditHandle(
555 this->getType().getFieldDesc(EnabledFieldId
),
559 editSField(EnabledFieldMask
);
564 GetFieldHandlePtr
CSMLoggerBase::getHandleContainers (void) const
566 MFUnrecFieldContainerPtr::GetHandlePtr
returnValue(
567 new MFUnrecFieldContainerPtr::GetHandle(
569 this->getType().getFieldDesc(ContainersFieldId
),
570 const_cast<CSMLoggerBase
*>(this)));
575 EditFieldHandlePtr
CSMLoggerBase::editHandleContainers (void)
577 MFUnrecFieldContainerPtr::EditHandlePtr
returnValue(
578 new MFUnrecFieldContainerPtr::EditHandle(
580 this->getType().getFieldDesc(ContainersFieldId
),
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
);
601 GetFieldHandlePtr
CSMLoggerBase::getHandleFields (void) const
603 MFString::GetHandlePtr
returnValue(
604 new MFString::GetHandle(
606 this->getType().getFieldDesc(FieldsFieldId
),
607 const_cast<CSMLoggerBase
*>(this)));
612 EditFieldHandlePtr
CSMLoggerBase::editHandleFields (void)
614 MFString::EditHandlePtr
returnValue(
615 new MFString::EditHandle(
617 this->getType().getFieldDesc(FieldsFieldId
),
621 editMField(FieldsFieldMask
, _mfFields
);
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
),
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));
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);
671 #ifdef OSG_MT_CPTR_ASPECT
672 _mfFields
.terminateShare(Thread::getCurrentAspect(),