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 "OSGCSMWindow.h" // Windows Class
67 #include "OSGCSMDrawerBase.h"
68 #include "OSGCSMDrawer.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::CSMDrawer
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var CSMWindow * CSMDrawerBase::_mfWindows
90 /*! \var std::string CSMDrawerBase::_sfDisplayString
94 /*! \var AspectId CSMDrawerBase::_sfAspect
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits
<CSMDrawer
*, nsOSG
>::_type(
106 "AttachmentContainerPtr",
107 CSMDrawer::getClassType(),
111 OSG_FIELDTRAITS_GETTYPE_NS(CSMDrawer
*, nsOSG
)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
121 DataType
&FieldTraits
<CSMDrawer
*, nsOSG
+ 1 >::getType(void)
123 return FieldTraits
<CSMDrawer
*, nsOSG
>::getType();
127 OSG_SFIELDTYPE_INST(ParentPointerSField
,
132 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField
,
138 /***************************************************************************\
139 * Field Description *
140 \***************************************************************************/
142 void CSMDrawerBase::classDescInserter(TypeObject
&oType
)
144 FieldDescriptionBase
*pDesc
= NULL
;
147 pDesc
= new MFUnrecChildCSMWindowPtr::Description(
148 MFUnrecChildCSMWindowPtr::getClassType(),
151 WindowsFieldId
, WindowsFieldMask
,
153 (Field::MFDefaultFlags
| Field::FStdAccess
),
154 static_cast<FieldEditMethodSig
>(&CSMDrawer::editHandleWindows
),
155 static_cast<FieldGetMethodSig
>(&CSMDrawer::getHandleWindows
));
157 oType
.addInitialDesc(pDesc
);
159 pDesc
= new SFString::Description(
160 SFString::getClassType(),
163 DisplayStringFieldId
, DisplayStringFieldMask
,
165 (Field::SFDefaultFlags
| Field::FStdAccess
),
166 static_cast<FieldEditMethodSig
>(&CSMDrawer::editHandleDisplayString
),
167 static_cast<FieldGetMethodSig
>(&CSMDrawer::getHandleDisplayString
));
169 oType
.addInitialDesc(pDesc
);
171 pDesc
= new SFAspectId::Description(
172 SFAspectId::getClassType(),
175 AspectFieldId
, AspectFieldMask
,
177 (Field::SFDefaultFlags
| Field::FStdAccess
),
178 static_cast<FieldEditMethodSig
>(&CSMDrawer::editHandleAspect
),
179 static_cast<FieldGetMethodSig
>(&CSMDrawer::getHandleAspect
));
181 oType
.addInitialDesc(pDesc
);
185 CSMDrawerBase::TypeObject
CSMDrawerBase::_type(
186 CSMDrawerBase::getClassname(),
187 Inherited::getClassname(),
190 reinterpret_cast<PrototypeCreateF
>(&CSMDrawerBase::createEmptyLocal
),
191 reinterpret_cast<InitContainerF
>(&CSMDrawer::initMethod
),
192 reinterpret_cast<ExitContainerF
>(&CSMDrawer::exitMethod
),
193 reinterpret_cast<InitalInsertDescFunc
>(
194 reinterpret_cast<void *>(&CSMDrawer::classDescInserter
)),
197 "<?xml version=\"1.0\"?>\n"
200 " name=\"CSMDrawer\"\n"
201 " parent=\"AttachmentContainer\"\n"
202 " library=\"ContribCSM\"\n"
203 " pointerfieldtypes=\"both\"\n"
204 " structure=\"concrete\"\n"
205 " systemcomponent=\"true\"\n"
206 " parentsystemcomponent=\"true\"\n"
207 " decoratable=\"false\"\n"
208 " useLocalIncludes=\"false\"\n"
209 " isNodeCore=\"false\"\n"
210 " isBundle=\"true\"\n"
211 " parentFields=\"single\"\n"
214 "\t\tname=\"windows\"\n"
215 "\t\ttype=\"CSMWindow\"\n"
216 "\t\tcardinality=\"multi\"\n"
217 "\t\tvisibility=\"external\"\n"
218 "\t\taccess=\"public\"\n"
219 " category=\"childpointer\"\n"
220 " childParentType=\"CSMDrawer\"\n"
221 " linkParentField=\"Parent\"\n"
225 "\t\tname=\"displayString\"\n"
226 "\t\ttype=\"std::string\"\n"
227 "\t\tcardinality=\"single\"\n"
228 "\t\tvisibility=\"internal\"\n"
229 "\t\taccess=\"public\"\n"
234 " type=\"AspectId\"\n"
235 " cardinality=\"single\"\n"
236 " visibility=\"external\"\n"
237 " access=\"public\"\n"
238 " defaultValue=\"1\"\n"
241 "</FieldContainer>\n",
245 /*------------------------------ get -----------------------------------*/
247 FieldContainerType
&CSMDrawerBase::getType(void)
252 const FieldContainerType
&CSMDrawerBase::getType(void) const
257 UInt32
CSMDrawerBase::getContainerSize(void) const
259 return sizeof(CSMDrawer
);
262 /*------------------------- decorator get ------------------------------*/
265 //! Get the CSMDrawer::_mfWindows field.
266 const MFUnrecChildCSMWindowPtr
*CSMDrawerBase::getMFWindows(void) const
271 MFUnrecChildCSMWindowPtr
*CSMDrawerBase::editMFWindows (void)
273 editMField(WindowsFieldMask
, _mfWindows
);
277 CSMWindow
* CSMDrawerBase::getWindows(const UInt32 index
) const
279 return _mfWindows
[index
];
282 SFString
*CSMDrawerBase::editSFDisplayString(void)
284 editSField(DisplayStringFieldMask
);
286 return &_sfDisplayString
;
289 const SFString
*CSMDrawerBase::getSFDisplayString(void) const
291 return &_sfDisplayString
;
295 SFAspectId
*CSMDrawerBase::editSFAspect(void)
297 editSField(AspectFieldMask
);
302 const SFAspectId
*CSMDrawerBase::getSFAspect(void) const
310 void CSMDrawerBase::pushToWindows(CSMWindow
* const value
)
312 editMField(WindowsFieldMask
, _mfWindows
);
314 _mfWindows
.push_back(value
);
317 void CSMDrawerBase::assignWindows (const MFUnrecChildCSMWindowPtr
&value
)
319 MFUnrecChildCSMWindowPtr::const_iterator elemIt
=
321 MFUnrecChildCSMWindowPtr::const_iterator elemEnd
=
324 static_cast<CSMDrawer
*>(this)->clearWindows();
326 while(elemIt
!= elemEnd
)
328 this->pushToWindows(*elemIt
);
334 void CSMDrawerBase::removeFromWindows(UInt32 uiIndex
)
336 if(uiIndex
< _mfWindows
.size())
338 editMField(WindowsFieldMask
, _mfWindows
);
340 _mfWindows
.erase(uiIndex
);
344 void CSMDrawerBase::removeObjFromWindows(CSMWindow
* const value
)
346 Int32 iElemIdx
= _mfWindows
.findIndex(value
);
350 editMField(WindowsFieldMask
, _mfWindows
);
352 _mfWindows
.erase(iElemIdx
);
355 void CSMDrawerBase::clearWindows(void)
357 editMField(WindowsFieldMask
, _mfWindows
);
365 /*------------------------------ access -----------------------------------*/
367 SizeT
CSMDrawerBase::getBinSize(ConstFieldMaskArg whichField
)
369 SizeT returnValue
= Inherited::getBinSize(whichField
);
371 if(FieldBits::NoField
!= (WindowsFieldMask
& whichField
))
373 returnValue
+= _mfWindows
.getBinSize();
375 if(FieldBits::NoField
!= (DisplayStringFieldMask
& whichField
))
377 returnValue
+= _sfDisplayString
.getBinSize();
379 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
381 returnValue
+= _sfAspect
.getBinSize();
387 void CSMDrawerBase::copyToBin(BinaryDataHandler
&pMem
,
388 ConstFieldMaskArg whichField
)
390 Inherited::copyToBin(pMem
, whichField
);
392 if(FieldBits::NoField
!= (WindowsFieldMask
& whichField
))
394 _mfWindows
.copyToBin(pMem
);
396 if(FieldBits::NoField
!= (DisplayStringFieldMask
& whichField
))
398 _sfDisplayString
.copyToBin(pMem
);
400 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
402 _sfAspect
.copyToBin(pMem
);
406 void CSMDrawerBase::copyFromBin(BinaryDataHandler
&pMem
,
407 ConstFieldMaskArg whichField
)
409 Inherited::copyFromBin(pMem
, whichField
);
411 if(FieldBits::NoField
!= (WindowsFieldMask
& whichField
))
413 editMField(WindowsFieldMask
, _mfWindows
);
414 _mfWindows
.copyFromBin(pMem
);
416 if(FieldBits::NoField
!= (DisplayStringFieldMask
& whichField
))
418 editSField(DisplayStringFieldMask
);
419 _sfDisplayString
.copyFromBin(pMem
);
421 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
423 editSField(AspectFieldMask
);
424 _sfAspect
.copyFromBin(pMem
);
428 //! create a new instance of the class
429 CSMDrawerTransitPtr
CSMDrawerBase::createLocal(BitVector bFlags
)
431 CSMDrawerTransitPtr fc
;
433 if(getClassType().getPrototype() != NULL
)
435 FieldContainerTransitPtr tmpPtr
=
436 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
438 fc
= dynamic_pointer_cast
<CSMDrawer
>(tmpPtr
);
444 //! create a new instance of the class, copy the container flags
445 CSMDrawerTransitPtr
CSMDrawerBase::createDependent(BitVector bFlags
)
447 CSMDrawerTransitPtr fc
;
449 if(getClassType().getPrototype() != NULL
)
451 FieldContainerTransitPtr tmpPtr
=
452 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
454 fc
= dynamic_pointer_cast
<CSMDrawer
>(tmpPtr
);
460 //! create a new instance of the class
461 CSMDrawerTransitPtr
CSMDrawerBase::create(void)
463 return createLocal();
466 CSMDrawer
*CSMDrawerBase::createEmptyLocal(BitVector bFlags
)
468 CSMDrawer
*returnValue
;
470 newPtr
<CSMDrawer
>(returnValue
, bFlags
);
472 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
477 //! create an empty new instance of the class, do not copy the prototype
478 CSMDrawer
*CSMDrawerBase::createEmpty(void)
480 return createEmptyLocal();
484 FieldContainerTransitPtr
CSMDrawerBase::shallowCopyLocal(
485 BitVector bFlags
) const
489 newPtr(tmpPtr
, dynamic_cast<const CSMDrawer
*>(this), bFlags
);
491 FieldContainerTransitPtr
returnValue(tmpPtr
);
493 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
498 FieldContainerTransitPtr
CSMDrawerBase::shallowCopyDependent(
499 BitVector bFlags
) const
503 newPtr(tmpPtr
, dynamic_cast<const CSMDrawer
*>(this), ~bFlags
);
505 FieldContainerTransitPtr
returnValue(tmpPtr
);
507 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
512 FieldContainerTransitPtr
CSMDrawerBase::shallowCopy(void) const
514 return shallowCopyLocal();
520 /*------------------------- constructors ----------------------------------*/
522 CSMDrawerBase::CSMDrawerBase(void) :
526 CSMWindow::ParentFieldId
),
528 _sfAspect (AspectId(1))
532 CSMDrawerBase::CSMDrawerBase(const CSMDrawerBase
&source
) :
536 CSMWindow::ParentFieldId
),
537 _sfDisplayString (source
._sfDisplayString
),
538 _sfAspect (source
._sfAspect
)
543 /*-------------------------- destructors ----------------------------------*/
545 CSMDrawerBase::~CSMDrawerBase(void)
549 /*-------------------------------------------------------------------------*/
552 bool CSMDrawerBase::unlinkChild(
553 FieldContainer
* const pChild
,
554 UInt16
const childFieldId
)
556 if(childFieldId
== WindowsFieldId
)
558 CSMWindow
* pTypedChild
=
559 dynamic_cast<CSMWindow
*>(pChild
);
561 if(pTypedChild
!= NULL
)
563 Int32 iChildIdx
= _mfWindows
.findIndex(pTypedChild
);
567 editMField(WindowsFieldMask
, _mfWindows
);
569 _mfWindows
.erase(iChildIdx
);
574 SWARNING
<< "Parent ([" << this
575 << "] id [" << this->getId()
576 << "] type [" << this->getType().getCName()
577 << "] childFieldId [" << childFieldId
578 << "]) - Child ([" << pChild
579 << "] id [" << pChild
->getId()
580 << "] type [" << pChild
->getType().getCName()
581 << "]): link inconsistent!"
591 return Inherited::unlinkChild(pChild
, childFieldId
);
594 void CSMDrawerBase::onCreate(const CSMDrawer
*source
)
596 Inherited::onCreate(source
);
600 CSMDrawer
*pThis
= static_cast<CSMDrawer
*>(this);
602 MFUnrecChildCSMWindowPtr::const_iterator WindowsIt
=
603 source
->_mfWindows
.begin();
604 MFUnrecChildCSMWindowPtr::const_iterator WindowsEnd
=
605 source
->_mfWindows
.end ();
607 while(WindowsIt
!= WindowsEnd
)
609 pThis
->pushToWindows(*WindowsIt
);
616 GetFieldHandlePtr
CSMDrawerBase::getHandleWindows (void) const
618 MFUnrecChildCSMWindowPtr::GetHandlePtr
returnValue(
619 new MFUnrecChildCSMWindowPtr::GetHandle(
621 this->getType().getFieldDesc(WindowsFieldId
),
622 const_cast<CSMDrawerBase
*>(this)));
627 EditFieldHandlePtr
CSMDrawerBase::editHandleWindows (void)
629 MFUnrecChildCSMWindowPtr::EditHandlePtr
returnValue(
630 new MFUnrecChildCSMWindowPtr::EditHandle(
632 this->getType().getFieldDesc(WindowsFieldId
),
635 returnValue
->setAddMethod(
636 boost::bind(&CSMDrawer::pushToWindows
,
637 static_cast<CSMDrawer
*>(this), _1
));
638 returnValue
->setRemoveMethod(
639 boost::bind(&CSMDrawer::removeFromWindows
,
640 static_cast<CSMDrawer
*>(this), _1
));
641 returnValue
->setRemoveObjMethod(
642 boost::bind(&CSMDrawer::removeObjFromWindows
,
643 static_cast<CSMDrawer
*>(this), _1
));
644 returnValue
->setClearMethod(
645 boost::bind(&CSMDrawer::clearWindows
,
646 static_cast<CSMDrawer
*>(this)));
648 editMField(WindowsFieldMask
, _mfWindows
);
653 GetFieldHandlePtr
CSMDrawerBase::getHandleDisplayString (void) const
655 SFString::GetHandlePtr
returnValue(
656 new SFString::GetHandle(
658 this->getType().getFieldDesc(DisplayStringFieldId
),
659 const_cast<CSMDrawerBase
*>(this)));
664 EditFieldHandlePtr
CSMDrawerBase::editHandleDisplayString (void)
666 SFString::EditHandlePtr
returnValue(
667 new SFString::EditHandle(
669 this->getType().getFieldDesc(DisplayStringFieldId
),
673 editSField(DisplayStringFieldMask
);
678 GetFieldHandlePtr
CSMDrawerBase::getHandleAspect (void) const
680 SFAspectId::GetHandlePtr
returnValue(
681 new SFAspectId::GetHandle(
683 this->getType().getFieldDesc(AspectFieldId
),
684 const_cast<CSMDrawerBase
*>(this)));
689 EditFieldHandlePtr
CSMDrawerBase::editHandleAspect (void)
691 SFAspectId::EditHandlePtr
returnValue(
692 new SFAspectId::EditHandle(
694 this->getType().getFieldDesc(AspectFieldId
),
698 editSField(AspectFieldMask
);
704 #ifdef OSG_MT_CPTR_ASPECT
705 void CSMDrawerBase::execSyncV( FieldContainer
&oFrom
,
706 ConstFieldMaskArg whichField
,
707 AspectOffsetStore
&oOffsets
,
708 ConstFieldMaskArg syncMode
,
709 const UInt32 uiSyncInfo
)
711 CSMDrawer
*pThis
= static_cast<CSMDrawer
*>(this);
713 pThis
->execSync(static_cast<CSMDrawer
*>(&oFrom
),
722 #ifdef OSG_MT_CPTR_ASPECT
723 FieldContainer
*CSMDrawerBase::createAspectCopy(
724 const FieldContainer
*pRefAspect
) const
726 CSMDrawer
*returnValue
;
728 newAspectCopy(returnValue
,
729 dynamic_cast<const CSMDrawer
*>(pRefAspect
),
730 dynamic_cast<const CSMDrawer
*>(this));
736 void CSMDrawerBase::resolveLinks(void)
738 Inherited::resolveLinks();
740 static_cast<CSMDrawer
*>(this)->clearWindows();