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
>(&CSMLogger::classDescInserter
),
171 "<?xml version=\"1.0\"?>\n"
174 " name=\"CSMLogger\"\n"
175 " parent=\"AttachmentContainer\"\n"
176 " library=\"ContribCSM\"\n"
177 " pointerfieldtypes=\"none\"\n"
178 " structure=\"concrete\"\n"
179 " systemcomponent=\"true\"\n"
180 " parentsystemcomponent=\"true\"\n"
181 " decoratable=\"false\"\n"
182 " useLocalIncludes=\"false\"\n"
183 " isNodeCore=\"false\"\n"
184 " isBundle=\"true\"\n"
185 " parentFields=\"none\"\n"
188 " name=\"enabled\"\n"
190 " defaultValue=\"true\"\n"
191 " cardinality=\"single\"\n"
192 " visibility=\"external\"\n"
193 " access=\"public\">\n"
196 " name=\"containers\"\n"
197 " type=\"FieldContainer\"\n"
198 " cardinality=\"multi\"\n"
199 " visibility=\"external\"\n"
200 " access=\"public\"\n"
201 " category=\"pointer\"\n"
206 " type=\"std::string\"\n"
207 " cardinality=\"multi\"\n"
208 " visibility=\"external\"\n"
209 " access=\"public\"\n"
212 "</FieldContainer>\n",
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType
&CSMLoggerBase::getType(void)
223 const FieldContainerType
&CSMLoggerBase::getType(void) const
228 UInt32
CSMLoggerBase::getContainerSize(void) const
230 return sizeof(CSMLogger
);
233 /*------------------------- decorator get ------------------------------*/
236 SFBool
*CSMLoggerBase::editSFEnabled(void)
238 editSField(EnabledFieldMask
);
243 const SFBool
*CSMLoggerBase::getSFEnabled(void) const
249 //! Get the CSMLogger::_mfContainers field.
250 const MFUnrecFieldContainerPtr
*CSMLoggerBase::getMFContainers(void) const
252 return &_mfContainers
;
255 MFUnrecFieldContainerPtr
*CSMLoggerBase::editMFContainers (void)
257 editMField(ContainersFieldMask
, _mfContainers
);
259 return &_mfContainers
;
261 FieldContainer
* CSMLoggerBase::getContainers(const UInt32 index
) const
263 return _mfContainers
[index
];
266 MFString
*CSMLoggerBase::editMFFields(void)
268 editMField(FieldsFieldMask
, _mfFields
);
273 const MFString
*CSMLoggerBase::getMFFields(void) const
281 void CSMLoggerBase::pushToContainers(FieldContainer
* const value
)
283 editMField(ContainersFieldMask
, _mfContainers
);
285 _mfContainers
.push_back(value
);
288 void CSMLoggerBase::assignContainers(const MFUnrecFieldContainerPtr
&value
)
290 MFUnrecFieldContainerPtr::const_iterator elemIt
=
292 MFUnrecFieldContainerPtr::const_iterator elemEnd
=
295 static_cast<CSMLogger
*>(this)->clearContainers();
297 while(elemIt
!= elemEnd
)
299 this->pushToContainers(*elemIt
);
305 void CSMLoggerBase::removeFromContainers(UInt32 uiIndex
)
307 if(uiIndex
< _mfContainers
.size())
309 editMField(ContainersFieldMask
, _mfContainers
);
311 _mfContainers
.erase(uiIndex
);
315 void CSMLoggerBase::removeObjFromContainers(FieldContainer
* const value
)
317 Int32 iElemIdx
= _mfContainers
.findIndex(value
);
321 editMField(ContainersFieldMask
, _mfContainers
);
323 _mfContainers
.erase(iElemIdx
);
326 void CSMLoggerBase::clearContainers(void)
328 editMField(ContainersFieldMask
, _mfContainers
);
331 _mfContainers
.clear();
336 /*------------------------------ access -----------------------------------*/
338 SizeT
CSMLoggerBase::getBinSize(ConstFieldMaskArg whichField
)
340 SizeT returnValue
= Inherited::getBinSize(whichField
);
342 if(FieldBits::NoField
!= (EnabledFieldMask
& whichField
))
344 returnValue
+= _sfEnabled
.getBinSize();
346 if(FieldBits::NoField
!= (ContainersFieldMask
& whichField
))
348 returnValue
+= _mfContainers
.getBinSize();
350 if(FieldBits::NoField
!= (FieldsFieldMask
& whichField
))
352 returnValue
+= _mfFields
.getBinSize();
358 void CSMLoggerBase::copyToBin(BinaryDataHandler
&pMem
,
359 ConstFieldMaskArg whichField
)
361 Inherited::copyToBin(pMem
, whichField
);
363 if(FieldBits::NoField
!= (EnabledFieldMask
& whichField
))
365 _sfEnabled
.copyToBin(pMem
);
367 if(FieldBits::NoField
!= (ContainersFieldMask
& whichField
))
369 _mfContainers
.copyToBin(pMem
);
371 if(FieldBits::NoField
!= (FieldsFieldMask
& whichField
))
373 _mfFields
.copyToBin(pMem
);
377 void CSMLoggerBase::copyFromBin(BinaryDataHandler
&pMem
,
378 ConstFieldMaskArg whichField
)
380 Inherited::copyFromBin(pMem
, whichField
);
382 if(FieldBits::NoField
!= (EnabledFieldMask
& whichField
))
384 editSField(EnabledFieldMask
);
385 _sfEnabled
.copyFromBin(pMem
);
387 if(FieldBits::NoField
!= (ContainersFieldMask
& whichField
))
389 editMField(ContainersFieldMask
, _mfContainers
);
390 _mfContainers
.copyFromBin(pMem
);
392 if(FieldBits::NoField
!= (FieldsFieldMask
& whichField
))
394 editMField(FieldsFieldMask
, _mfFields
);
395 _mfFields
.copyFromBin(pMem
);
399 //! create a new instance of the class
400 CSMLoggerTransitPtr
CSMLoggerBase::createLocal(BitVector bFlags
)
402 CSMLoggerTransitPtr fc
;
404 if(getClassType().getPrototype() != NULL
)
406 FieldContainerTransitPtr tmpPtr
=
407 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
409 fc
= dynamic_pointer_cast
<CSMLogger
>(tmpPtr
);
415 //! create a new instance of the class, copy the container flags
416 CSMLoggerTransitPtr
CSMLoggerBase::createDependent(BitVector bFlags
)
418 CSMLoggerTransitPtr fc
;
420 if(getClassType().getPrototype() != NULL
)
422 FieldContainerTransitPtr tmpPtr
=
423 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
425 fc
= dynamic_pointer_cast
<CSMLogger
>(tmpPtr
);
431 //! create a new instance of the class
432 CSMLoggerTransitPtr
CSMLoggerBase::create(void)
434 return createLocal();
437 CSMLogger
*CSMLoggerBase::createEmptyLocal(BitVector bFlags
)
439 CSMLogger
*returnValue
;
441 newPtr
<CSMLogger
>(returnValue
, bFlags
);
443 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
448 //! create an empty new instance of the class, do not copy the prototype
449 CSMLogger
*CSMLoggerBase::createEmpty(void)
451 return createEmptyLocal();
455 FieldContainerTransitPtr
CSMLoggerBase::shallowCopyLocal(
456 BitVector bFlags
) const
460 newPtr(tmpPtr
, dynamic_cast<const CSMLogger
*>(this), bFlags
);
462 FieldContainerTransitPtr
returnValue(tmpPtr
);
464 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
469 FieldContainerTransitPtr
CSMLoggerBase::shallowCopyDependent(
470 BitVector bFlags
) const
474 newPtr(tmpPtr
, dynamic_cast<const CSMLogger
*>(this), ~bFlags
);
476 FieldContainerTransitPtr
returnValue(tmpPtr
);
478 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
483 FieldContainerTransitPtr
CSMLoggerBase::shallowCopy(void) const
485 return shallowCopyLocal();
491 /*------------------------- constructors ----------------------------------*/
493 CSMLoggerBase::CSMLoggerBase(void) :
495 _sfEnabled (bool(true)),
501 CSMLoggerBase::CSMLoggerBase(const CSMLoggerBase
&source
) :
503 _sfEnabled (source
._sfEnabled
),
505 _mfFields (source
._mfFields
)
510 /*-------------------------- destructors ----------------------------------*/
512 CSMLoggerBase::~CSMLoggerBase(void)
516 void CSMLoggerBase::onCreate(const CSMLogger
*source
)
518 Inherited::onCreate(source
);
522 CSMLogger
*pThis
= static_cast<CSMLogger
*>(this);
524 MFUnrecFieldContainerPtr::const_iterator ContainersIt
=
525 source
->_mfContainers
.begin();
526 MFUnrecFieldContainerPtr::const_iterator ContainersEnd
=
527 source
->_mfContainers
.end ();
529 while(ContainersIt
!= ContainersEnd
)
531 pThis
->pushToContainers(*ContainersIt
);
538 GetFieldHandlePtr
CSMLoggerBase::getHandleEnabled (void) const
540 SFBool::GetHandlePtr
returnValue(
541 new SFBool::GetHandle(
543 this->getType().getFieldDesc(EnabledFieldId
),
544 const_cast<CSMLoggerBase
*>(this)));
549 EditFieldHandlePtr
CSMLoggerBase::editHandleEnabled (void)
551 SFBool::EditHandlePtr
returnValue(
552 new SFBool::EditHandle(
554 this->getType().getFieldDesc(EnabledFieldId
),
558 editSField(EnabledFieldMask
);
563 GetFieldHandlePtr
CSMLoggerBase::getHandleContainers (void) const
565 MFUnrecFieldContainerPtr::GetHandlePtr
returnValue(
566 new MFUnrecFieldContainerPtr::GetHandle(
568 this->getType().getFieldDesc(ContainersFieldId
),
569 const_cast<CSMLoggerBase
*>(this)));
574 EditFieldHandlePtr
CSMLoggerBase::editHandleContainers (void)
576 MFUnrecFieldContainerPtr::EditHandlePtr
returnValue(
577 new MFUnrecFieldContainerPtr::EditHandle(
579 this->getType().getFieldDesc(ContainersFieldId
),
582 returnValue
->setAddMethod(
583 boost::bind(&CSMLogger::pushToContainers
,
584 static_cast<CSMLogger
*>(this), _1
));
585 returnValue
->setRemoveMethod(
586 boost::bind(&CSMLogger::removeFromContainers
,
587 static_cast<CSMLogger
*>(this), _1
));
588 returnValue
->setRemoveObjMethod(
589 boost::bind(&CSMLogger::removeObjFromContainers
,
590 static_cast<CSMLogger
*>(this), _1
));
591 returnValue
->setClearMethod(
592 boost::bind(&CSMLogger::clearContainers
,
593 static_cast<CSMLogger
*>(this)));
595 editMField(ContainersFieldMask
, _mfContainers
);
600 GetFieldHandlePtr
CSMLoggerBase::getHandleFields (void) const
602 MFString::GetHandlePtr
returnValue(
603 new MFString::GetHandle(
605 this->getType().getFieldDesc(FieldsFieldId
),
606 const_cast<CSMLoggerBase
*>(this)));
611 EditFieldHandlePtr
CSMLoggerBase::editHandleFields (void)
613 MFString::EditHandlePtr
returnValue(
614 new MFString::EditHandle(
616 this->getType().getFieldDesc(FieldsFieldId
),
620 editMField(FieldsFieldMask
, _mfFields
);
626 #ifdef OSG_MT_CPTR_ASPECT
627 void CSMLoggerBase::execSyncV( FieldContainer
&oFrom
,
628 ConstFieldMaskArg whichField
,
629 AspectOffsetStore
&oOffsets
,
630 ConstFieldMaskArg syncMode
,
631 const UInt32 uiSyncInfo
)
633 CSMLogger
*pThis
= static_cast<CSMLogger
*>(this);
635 pThis
->execSync(static_cast<CSMLogger
*>(&oFrom
),
644 #ifdef OSG_MT_CPTR_ASPECT
645 FieldContainer
*CSMLoggerBase::createAspectCopy(
646 const FieldContainer
*pRefAspect
) const
648 CSMLogger
*returnValue
;
650 newAspectCopy(returnValue
,
651 dynamic_cast<const CSMLogger
*>(pRefAspect
),
652 dynamic_cast<const CSMLogger
*>(this));
658 void CSMLoggerBase::resolveLinks(void)
660 Inherited::resolveLinks();
662 static_cast<CSMLogger
*>(this)->clearContainers();
664 #ifdef OSG_MT_CPTR_ASPECT
665 AspectOffsetStore oOffsets
;
667 _pAspectStore
->fillOffsetArray(oOffsets
, this);
670 #ifdef OSG_MT_CPTR_ASPECT
671 _mfFields
.terminateShare(Thread::getCurrentAspect(),