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 **
48 ** class CSMDrawManager!
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 "OSGCSMDrawer.h" // AppDrawer Class
67 #include "OSGCSMDrawManagerBase.h"
68 #include "OSGCSMDrawManager.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::CSMDrawManager
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var CSMDrawer * CSMDrawManagerBase::_sfAppDrawer
90 /*! \var CSMDrawer * CSMDrawManagerBase::_mfDrawer
94 /*! \var bool CSMDrawManagerBase::_sfParallel
98 /*! \var std::string CSMDrawManagerBase::_sfSyncBarrierName
102 /*! \var std::string CSMDrawManagerBase::_sfSwapBarrierName
107 /***************************************************************************\
108 * FieldType/FieldTrait Instantiation *
109 \***************************************************************************/
111 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
112 PointerType FieldTraits
<CSMDrawManager
*, nsOSG
>::_type(
114 "AttachmentContainerPtr",
115 CSMDrawManager::getClassType(),
119 OSG_FIELDTRAITS_GETTYPE_NS(CSMDrawManager
*, nsOSG
)
121 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
125 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
129 /***************************************************************************\
130 * Field Description *
131 \***************************************************************************/
133 void CSMDrawManagerBase::classDescInserter(TypeObject
&oType
)
135 FieldDescriptionBase
*pDesc
= NULL
;
138 pDesc
= new SFUnrecCSMDrawerPtr::Description(
139 SFUnrecCSMDrawerPtr::getClassType(),
142 AppDrawerFieldId
, AppDrawerFieldMask
,
144 (Field::SFDefaultFlags
| Field::FStdAccess
),
145 static_cast<FieldEditMethodSig
>(&CSMDrawManager::editHandleAppDrawer
),
146 static_cast<FieldGetMethodSig
>(&CSMDrawManager::getHandleAppDrawer
));
148 oType
.addInitialDesc(pDesc
);
150 pDesc
= new MFUnrecCSMDrawerPtr::Description(
151 MFUnrecCSMDrawerPtr::getClassType(),
154 DrawerFieldId
, DrawerFieldMask
,
156 (Field::MFDefaultFlags
| Field::FStdAccess
),
157 static_cast<FieldEditMethodSig
>(&CSMDrawManager::editHandleDrawer
),
158 static_cast<FieldGetMethodSig
>(&CSMDrawManager::getHandleDrawer
));
160 oType
.addInitialDesc(pDesc
);
162 pDesc
= new SFBool::Description(
163 SFBool::getClassType(),
166 ParallelFieldId
, ParallelFieldMask
,
168 (Field::SFDefaultFlags
| Field::FStdAccess
),
169 static_cast<FieldEditMethodSig
>(&CSMDrawManager::editHandleParallel
),
170 static_cast<FieldGetMethodSig
>(&CSMDrawManager::getHandleParallel
));
172 oType
.addInitialDesc(pDesc
);
174 pDesc
= new SFString::Description(
175 SFString::getClassType(),
178 SyncBarrierNameFieldId
, SyncBarrierNameFieldMask
,
180 (Field::SFDefaultFlags
| Field::FStdAccess
),
181 static_cast<FieldEditMethodSig
>(&CSMDrawManager::editHandleSyncBarrierName
),
182 static_cast<FieldGetMethodSig
>(&CSMDrawManager::getHandleSyncBarrierName
));
184 oType
.addInitialDesc(pDesc
);
186 pDesc
= new SFString::Description(
187 SFString::getClassType(),
190 SwapBarrierNameFieldId
, SwapBarrierNameFieldMask
,
192 (Field::SFDefaultFlags
| Field::FStdAccess
),
193 static_cast<FieldEditMethodSig
>(&CSMDrawManager::editHandleSwapBarrierName
),
194 static_cast<FieldGetMethodSig
>(&CSMDrawManager::getHandleSwapBarrierName
));
196 oType
.addInitialDesc(pDesc
);
200 CSMDrawManagerBase::TypeObject
CSMDrawManagerBase::_type(
201 CSMDrawManagerBase::getClassname(),
202 Inherited::getClassname(),
205 reinterpret_cast<PrototypeCreateF
>(&CSMDrawManagerBase::createEmptyLocal
),
206 reinterpret_cast<InitContainerF
>(&CSMDrawManager::initMethod
),
207 reinterpret_cast<ExitContainerF
>(&CSMDrawManager::exitMethod
),
208 reinterpret_cast<InitalInsertDescFunc
>(
209 reinterpret_cast<void *>(&CSMDrawManager::classDescInserter
)),
212 "<?xml version=\"1.0\"?>\n"
215 " name=\"CSMDrawManager\"\n"
216 " parent=\"AttachmentContainer\"\n"
217 " library=\"ContribCSM\"\n"
218 " pointerfieldtypes=\"both\"\n"
219 " structure=\"concrete\"\n"
220 " systemcomponent=\"true\"\n"
221 " parentsystemcomponent=\"true\"\n"
222 " decoratable=\"false\"\n"
223 " useLocalIncludes=\"false\"\n"
224 " isNodeCore=\"false\"\n"
225 " isBundle=\"true\"\n"
228 "\t\tname=\"appDrawer\"\n"
229 "\t\ttype=\"CSMDrawer\"\n"
230 "\t\tcardinality=\"single\"\n"
231 "\t\tvisibility=\"external\"\n"
232 "\t\taccess=\"public\"\n"
233 " category=\"pointer\"\n"
237 "\t\tname=\"drawer\"\n"
238 "\t\ttype=\"CSMDrawer\"\n"
239 "\t\tcardinality=\"multi\"\n"
240 "\t\tvisibility=\"external\"\n"
241 "\t\taccess=\"public\"\n"
242 " category=\"pointer\"\n"
246 " name=\"parallel\"\n"
248 " cardinality=\"single\"\n"
249 " visibility=\"external\"\n"
250 " access=\"public\"\n"
254 "\t\tname=\"syncBarrierName\"\n"
255 "\t\ttype=\"std::string\"\n"
256 "\t\tcardinality=\"single\"\n"
257 "\t\tvisibility=\"internal\"\n"
258 "\t\taccess=\"public\"\n"
259 " defaultValue=\"""\"\n"
263 "\t\tname=\"swapBarrierName\"\n"
264 "\t\ttype=\"std::string\"\n"
265 "\t\tcardinality=\"single\"\n"
266 "\t\tvisibility=\"internal\"\n"
267 "\t\taccess=\"public\"\n"
268 " defaultValue=\"""\"\n"
271 "</FieldContainer>\n",
275 /*------------------------------ get -----------------------------------*/
277 FieldContainerType
&CSMDrawManagerBase::getType(void)
282 const FieldContainerType
&CSMDrawManagerBase::getType(void) const
287 UInt32
CSMDrawManagerBase::getContainerSize(void) const
289 return sizeof(CSMDrawManager
);
292 /*------------------------- decorator get ------------------------------*/
295 //! Get the CSMDrawManager::_sfAppDrawer field.
296 const SFUnrecCSMDrawerPtr
*CSMDrawManagerBase::getSFAppDrawer(void) const
298 return &_sfAppDrawer
;
301 SFUnrecCSMDrawerPtr
*CSMDrawManagerBase::editSFAppDrawer (void)
303 editSField(AppDrawerFieldMask
);
305 return &_sfAppDrawer
;
308 //! Get the value of the CSMDrawManager::_sfAppDrawer field.
309 CSMDrawer
* CSMDrawManagerBase::getAppDrawer(void) const
311 return _sfAppDrawer
.getValue();
314 //! Set the value of the CSMDrawManager::_sfAppDrawer field.
315 void CSMDrawManagerBase::setAppDrawer(CSMDrawer
* const value
)
317 editSField(AppDrawerFieldMask
);
319 _sfAppDrawer
.setValue(value
);
323 //! Get the CSMDrawManager::_mfDrawer field.
324 const MFUnrecCSMDrawerPtr
*CSMDrawManagerBase::getMFDrawer(void) const
329 MFUnrecCSMDrawerPtr
*CSMDrawManagerBase::editMFDrawer (void)
331 editMField(DrawerFieldMask
, _mfDrawer
);
335 CSMDrawer
* CSMDrawManagerBase::getDrawer(const UInt32 index
) const
337 return _mfDrawer
[index
];
340 SFBool
*CSMDrawManagerBase::editSFParallel(void)
342 editSField(ParallelFieldMask
);
347 const SFBool
*CSMDrawManagerBase::getSFParallel(void) const
353 SFString
*CSMDrawManagerBase::editSFSyncBarrierName(void)
355 editSField(SyncBarrierNameFieldMask
);
357 return &_sfSyncBarrierName
;
360 const SFString
*CSMDrawManagerBase::getSFSyncBarrierName(void) const
362 return &_sfSyncBarrierName
;
366 SFString
*CSMDrawManagerBase::editSFSwapBarrierName(void)
368 editSField(SwapBarrierNameFieldMask
);
370 return &_sfSwapBarrierName
;
373 const SFString
*CSMDrawManagerBase::getSFSwapBarrierName(void) const
375 return &_sfSwapBarrierName
;
381 void CSMDrawManagerBase::pushToDrawer(CSMDrawer
* const value
)
383 editMField(DrawerFieldMask
, _mfDrawer
);
385 _mfDrawer
.push_back(value
);
388 void CSMDrawManagerBase::assignDrawer (const MFUnrecCSMDrawerPtr
&value
)
390 MFUnrecCSMDrawerPtr::const_iterator elemIt
=
392 MFUnrecCSMDrawerPtr::const_iterator elemEnd
=
395 static_cast<CSMDrawManager
*>(this)->clearDrawer();
397 while(elemIt
!= elemEnd
)
399 this->pushToDrawer(*elemIt
);
405 void CSMDrawManagerBase::removeFromDrawer(UInt32 uiIndex
)
407 if(uiIndex
< _mfDrawer
.size())
409 editMField(DrawerFieldMask
, _mfDrawer
);
411 _mfDrawer
.erase(uiIndex
);
415 void CSMDrawManagerBase::removeObjFromDrawer(CSMDrawer
* const value
)
417 Int32 iElemIdx
= _mfDrawer
.findIndex(value
);
421 editMField(DrawerFieldMask
, _mfDrawer
);
423 _mfDrawer
.erase(iElemIdx
);
426 void CSMDrawManagerBase::clearDrawer(void)
428 editMField(DrawerFieldMask
, _mfDrawer
);
436 /*------------------------------ access -----------------------------------*/
438 SizeT
CSMDrawManagerBase::getBinSize(ConstFieldMaskArg whichField
)
440 SizeT returnValue
= Inherited::getBinSize(whichField
);
442 if(FieldBits::NoField
!= (AppDrawerFieldMask
& whichField
))
444 returnValue
+= _sfAppDrawer
.getBinSize();
446 if(FieldBits::NoField
!= (DrawerFieldMask
& whichField
))
448 returnValue
+= _mfDrawer
.getBinSize();
450 if(FieldBits::NoField
!= (ParallelFieldMask
& whichField
))
452 returnValue
+= _sfParallel
.getBinSize();
454 if(FieldBits::NoField
!= (SyncBarrierNameFieldMask
& whichField
))
456 returnValue
+= _sfSyncBarrierName
.getBinSize();
458 if(FieldBits::NoField
!= (SwapBarrierNameFieldMask
& whichField
))
460 returnValue
+= _sfSwapBarrierName
.getBinSize();
466 void CSMDrawManagerBase::copyToBin(BinaryDataHandler
&pMem
,
467 ConstFieldMaskArg whichField
)
469 Inherited::copyToBin(pMem
, whichField
);
471 if(FieldBits::NoField
!= (AppDrawerFieldMask
& whichField
))
473 _sfAppDrawer
.copyToBin(pMem
);
475 if(FieldBits::NoField
!= (DrawerFieldMask
& whichField
))
477 _mfDrawer
.copyToBin(pMem
);
479 if(FieldBits::NoField
!= (ParallelFieldMask
& whichField
))
481 _sfParallel
.copyToBin(pMem
);
483 if(FieldBits::NoField
!= (SyncBarrierNameFieldMask
& whichField
))
485 _sfSyncBarrierName
.copyToBin(pMem
);
487 if(FieldBits::NoField
!= (SwapBarrierNameFieldMask
& whichField
))
489 _sfSwapBarrierName
.copyToBin(pMem
);
493 void CSMDrawManagerBase::copyFromBin(BinaryDataHandler
&pMem
,
494 ConstFieldMaskArg whichField
)
496 Inherited::copyFromBin(pMem
, whichField
);
498 if(FieldBits::NoField
!= (AppDrawerFieldMask
& whichField
))
500 editSField(AppDrawerFieldMask
);
501 _sfAppDrawer
.copyFromBin(pMem
);
503 if(FieldBits::NoField
!= (DrawerFieldMask
& whichField
))
505 editMField(DrawerFieldMask
, _mfDrawer
);
506 _mfDrawer
.copyFromBin(pMem
);
508 if(FieldBits::NoField
!= (ParallelFieldMask
& whichField
))
510 editSField(ParallelFieldMask
);
511 _sfParallel
.copyFromBin(pMem
);
513 if(FieldBits::NoField
!= (SyncBarrierNameFieldMask
& whichField
))
515 editSField(SyncBarrierNameFieldMask
);
516 _sfSyncBarrierName
.copyFromBin(pMem
);
518 if(FieldBits::NoField
!= (SwapBarrierNameFieldMask
& whichField
))
520 editSField(SwapBarrierNameFieldMask
);
521 _sfSwapBarrierName
.copyFromBin(pMem
);
525 //! create a new instance of the class
526 CSMDrawManagerTransitPtr
CSMDrawManagerBase::createLocal(BitVector bFlags
)
528 CSMDrawManagerTransitPtr fc
;
530 if(getClassType().getPrototype() != NULL
)
532 FieldContainerTransitPtr tmpPtr
=
533 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
535 fc
= dynamic_pointer_cast
<CSMDrawManager
>(tmpPtr
);
541 //! create a new instance of the class, copy the container flags
542 CSMDrawManagerTransitPtr
CSMDrawManagerBase::createDependent(BitVector bFlags
)
544 CSMDrawManagerTransitPtr fc
;
546 if(getClassType().getPrototype() != NULL
)
548 FieldContainerTransitPtr tmpPtr
=
549 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
551 fc
= dynamic_pointer_cast
<CSMDrawManager
>(tmpPtr
);
557 //! create a new instance of the class
558 CSMDrawManagerTransitPtr
CSMDrawManagerBase::create(void)
560 return createLocal();
563 CSMDrawManager
*CSMDrawManagerBase::createEmptyLocal(BitVector bFlags
)
565 CSMDrawManager
*returnValue
;
567 newPtr
<CSMDrawManager
>(returnValue
, bFlags
);
569 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
574 //! create an empty new instance of the class, do not copy the prototype
575 CSMDrawManager
*CSMDrawManagerBase::createEmpty(void)
577 return createEmptyLocal();
581 FieldContainerTransitPtr
CSMDrawManagerBase::shallowCopyLocal(
582 BitVector bFlags
) const
584 CSMDrawManager
*tmpPtr
;
586 newPtr(tmpPtr
, dynamic_cast<const CSMDrawManager
*>(this), bFlags
);
588 FieldContainerTransitPtr
returnValue(tmpPtr
);
590 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
595 FieldContainerTransitPtr
CSMDrawManagerBase::shallowCopyDependent(
596 BitVector bFlags
) const
598 CSMDrawManager
*tmpPtr
;
600 newPtr(tmpPtr
, dynamic_cast<const CSMDrawManager
*>(this), ~bFlags
);
602 FieldContainerTransitPtr
returnValue(tmpPtr
);
604 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
609 FieldContainerTransitPtr
CSMDrawManagerBase::shallowCopy(void) const
611 return shallowCopyLocal();
617 /*------------------------- constructors ----------------------------------*/
619 CSMDrawManagerBase::CSMDrawManagerBase(void) :
624 _sfSyncBarrierName (std::string("")),
625 _sfSwapBarrierName (std::string(""))
629 CSMDrawManagerBase::CSMDrawManagerBase(const CSMDrawManagerBase
&source
) :
633 _sfParallel (source
._sfParallel
),
634 _sfSyncBarrierName (source
._sfSyncBarrierName
),
635 _sfSwapBarrierName (source
._sfSwapBarrierName
)
640 /*-------------------------- destructors ----------------------------------*/
642 CSMDrawManagerBase::~CSMDrawManagerBase(void)
646 void CSMDrawManagerBase::onCreate(const CSMDrawManager
*source
)
648 Inherited::onCreate(source
);
652 CSMDrawManager
*pThis
= static_cast<CSMDrawManager
*>(this);
654 pThis
->setAppDrawer(source
->getAppDrawer());
656 MFUnrecCSMDrawerPtr::const_iterator DrawerIt
=
657 source
->_mfDrawer
.begin();
658 MFUnrecCSMDrawerPtr::const_iterator DrawerEnd
=
659 source
->_mfDrawer
.end ();
661 while(DrawerIt
!= DrawerEnd
)
663 pThis
->pushToDrawer(*DrawerIt
);
670 GetFieldHandlePtr
CSMDrawManagerBase::getHandleAppDrawer (void) const
672 SFUnrecCSMDrawerPtr::GetHandlePtr
returnValue(
673 new SFUnrecCSMDrawerPtr::GetHandle(
675 this->getType().getFieldDesc(AppDrawerFieldId
),
676 const_cast<CSMDrawManagerBase
*>(this)));
681 EditFieldHandlePtr
CSMDrawManagerBase::editHandleAppDrawer (void)
683 SFUnrecCSMDrawerPtr::EditHandlePtr
returnValue(
684 new SFUnrecCSMDrawerPtr::EditHandle(
686 this->getType().getFieldDesc(AppDrawerFieldId
),
689 returnValue
->setSetMethod(
690 boost::bind(&CSMDrawManager::setAppDrawer
,
691 static_cast<CSMDrawManager
*>(this), _1
));
693 editSField(AppDrawerFieldMask
);
698 GetFieldHandlePtr
CSMDrawManagerBase::getHandleDrawer (void) const
700 MFUnrecCSMDrawerPtr::GetHandlePtr
returnValue(
701 new MFUnrecCSMDrawerPtr::GetHandle(
703 this->getType().getFieldDesc(DrawerFieldId
),
704 const_cast<CSMDrawManagerBase
*>(this)));
709 EditFieldHandlePtr
CSMDrawManagerBase::editHandleDrawer (void)
711 MFUnrecCSMDrawerPtr::EditHandlePtr
returnValue(
712 new MFUnrecCSMDrawerPtr::EditHandle(
714 this->getType().getFieldDesc(DrawerFieldId
),
717 returnValue
->setAddMethod(
718 boost::bind(&CSMDrawManager::pushToDrawer
,
719 static_cast<CSMDrawManager
*>(this), _1
));
720 returnValue
->setRemoveMethod(
721 boost::bind(&CSMDrawManager::removeFromDrawer
,
722 static_cast<CSMDrawManager
*>(this), _1
));
723 returnValue
->setRemoveObjMethod(
724 boost::bind(&CSMDrawManager::removeObjFromDrawer
,
725 static_cast<CSMDrawManager
*>(this), _1
));
726 returnValue
->setClearMethod(
727 boost::bind(&CSMDrawManager::clearDrawer
,
728 static_cast<CSMDrawManager
*>(this)));
730 editMField(DrawerFieldMask
, _mfDrawer
);
735 GetFieldHandlePtr
CSMDrawManagerBase::getHandleParallel (void) const
737 SFBool::GetHandlePtr
returnValue(
738 new SFBool::GetHandle(
740 this->getType().getFieldDesc(ParallelFieldId
),
741 const_cast<CSMDrawManagerBase
*>(this)));
746 EditFieldHandlePtr
CSMDrawManagerBase::editHandleParallel (void)
748 SFBool::EditHandlePtr
returnValue(
749 new SFBool::EditHandle(
751 this->getType().getFieldDesc(ParallelFieldId
),
755 editSField(ParallelFieldMask
);
760 GetFieldHandlePtr
CSMDrawManagerBase::getHandleSyncBarrierName (void) const
762 SFString::GetHandlePtr
returnValue(
763 new SFString::GetHandle(
765 this->getType().getFieldDesc(SyncBarrierNameFieldId
),
766 const_cast<CSMDrawManagerBase
*>(this)));
771 EditFieldHandlePtr
CSMDrawManagerBase::editHandleSyncBarrierName(void)
773 SFString::EditHandlePtr
returnValue(
774 new SFString::EditHandle(
776 this->getType().getFieldDesc(SyncBarrierNameFieldId
),
780 editSField(SyncBarrierNameFieldMask
);
785 GetFieldHandlePtr
CSMDrawManagerBase::getHandleSwapBarrierName (void) const
787 SFString::GetHandlePtr
returnValue(
788 new SFString::GetHandle(
790 this->getType().getFieldDesc(SwapBarrierNameFieldId
),
791 const_cast<CSMDrawManagerBase
*>(this)));
796 EditFieldHandlePtr
CSMDrawManagerBase::editHandleSwapBarrierName(void)
798 SFString::EditHandlePtr
returnValue(
799 new SFString::EditHandle(
801 this->getType().getFieldDesc(SwapBarrierNameFieldId
),
805 editSField(SwapBarrierNameFieldMask
);
811 #ifdef OSG_MT_CPTR_ASPECT
812 void CSMDrawManagerBase::execSyncV( FieldContainer
&oFrom
,
813 ConstFieldMaskArg whichField
,
814 AspectOffsetStore
&oOffsets
,
815 ConstFieldMaskArg syncMode
,
816 const UInt32 uiSyncInfo
)
818 CSMDrawManager
*pThis
= static_cast<CSMDrawManager
*>(this);
820 pThis
->execSync(static_cast<CSMDrawManager
*>(&oFrom
),
829 #ifdef OSG_MT_CPTR_ASPECT
830 FieldContainer
*CSMDrawManagerBase::createAspectCopy(
831 const FieldContainer
*pRefAspect
) const
833 CSMDrawManager
*returnValue
;
835 newAspectCopy(returnValue
,
836 dynamic_cast<const CSMDrawManager
*>(pRefAspect
),
837 dynamic_cast<const CSMDrawManager
*>(this));
843 void CSMDrawManagerBase::resolveLinks(void)
845 Inherited::resolveLinks();
847 static_cast<CSMDrawManager
*>(this)->setAppDrawer(NULL
);
849 static_cast<CSMDrawManager
*>(this)->clearDrawer();