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
>(&CSMDrawer::classDescInserter
),
196 "<?xml version=\"1.0\"?>\n"
199 " name=\"CSMDrawer\"\n"
200 " parent=\"AttachmentContainer\"\n"
201 " library=\"ContribCSM\"\n"
202 " pointerfieldtypes=\"both\"\n"
203 " structure=\"concrete\"\n"
204 " systemcomponent=\"true\"\n"
205 " parentsystemcomponent=\"true\"\n"
206 " decoratable=\"false\"\n"
207 " useLocalIncludes=\"false\"\n"
208 " isNodeCore=\"false\"\n"
209 " isBundle=\"true\"\n"
210 " parentFields=\"single\"\n"
213 "\t\tname=\"windows\"\n"
214 "\t\ttype=\"CSMWindow\"\n"
215 "\t\tcardinality=\"multi\"\n"
216 "\t\tvisibility=\"external\"\n"
217 "\t\taccess=\"public\"\n"
218 " category=\"childpointer\"\n"
219 " childParentType=\"CSMDrawer\"\n"
220 " linkParentField=\"Parent\"\n"
224 "\t\tname=\"displayString\"\n"
225 "\t\ttype=\"std::string\"\n"
226 "\t\tcardinality=\"single\"\n"
227 "\t\tvisibility=\"internal\"\n"
228 "\t\taccess=\"public\"\n"
233 " type=\"AspectId\"\n"
234 " cardinality=\"single\"\n"
235 " visibility=\"external\"\n"
236 " access=\"public\"\n"
237 " defaultValue=\"1\"\n"
240 "</FieldContainer>\n",
244 /*------------------------------ get -----------------------------------*/
246 FieldContainerType
&CSMDrawerBase::getType(void)
251 const FieldContainerType
&CSMDrawerBase::getType(void) const
256 UInt32
CSMDrawerBase::getContainerSize(void) const
258 return sizeof(CSMDrawer
);
261 /*------------------------- decorator get ------------------------------*/
264 //! Get the CSMDrawer::_mfWindows field.
265 const MFUnrecChildCSMWindowPtr
*CSMDrawerBase::getMFWindows(void) const
270 MFUnrecChildCSMWindowPtr
*CSMDrawerBase::editMFWindows (void)
272 editMField(WindowsFieldMask
, _mfWindows
);
276 CSMWindow
* CSMDrawerBase::getWindows(const UInt32 index
) const
278 return _mfWindows
[index
];
281 SFString
*CSMDrawerBase::editSFDisplayString(void)
283 editSField(DisplayStringFieldMask
);
285 return &_sfDisplayString
;
288 const SFString
*CSMDrawerBase::getSFDisplayString(void) const
290 return &_sfDisplayString
;
294 SFAspectId
*CSMDrawerBase::editSFAspect(void)
296 editSField(AspectFieldMask
);
301 const SFAspectId
*CSMDrawerBase::getSFAspect(void) const
309 void CSMDrawerBase::pushToWindows(CSMWindow
* const value
)
311 editMField(WindowsFieldMask
, _mfWindows
);
313 _mfWindows
.push_back(value
);
316 void CSMDrawerBase::assignWindows (const MFUnrecChildCSMWindowPtr
&value
)
318 MFUnrecChildCSMWindowPtr::const_iterator elemIt
=
320 MFUnrecChildCSMWindowPtr::const_iterator elemEnd
=
323 static_cast<CSMDrawer
*>(this)->clearWindows();
325 while(elemIt
!= elemEnd
)
327 this->pushToWindows(*elemIt
);
333 void CSMDrawerBase::removeFromWindows(UInt32 uiIndex
)
335 if(uiIndex
< _mfWindows
.size())
337 editMField(WindowsFieldMask
, _mfWindows
);
339 _mfWindows
.erase(uiIndex
);
343 void CSMDrawerBase::removeObjFromWindows(CSMWindow
* const value
)
345 Int32 iElemIdx
= _mfWindows
.findIndex(value
);
349 editMField(WindowsFieldMask
, _mfWindows
);
351 _mfWindows
.erase(iElemIdx
);
354 void CSMDrawerBase::clearWindows(void)
356 editMField(WindowsFieldMask
, _mfWindows
);
364 /*------------------------------ access -----------------------------------*/
366 SizeT
CSMDrawerBase::getBinSize(ConstFieldMaskArg whichField
)
368 SizeT returnValue
= Inherited::getBinSize(whichField
);
370 if(FieldBits::NoField
!= (WindowsFieldMask
& whichField
))
372 returnValue
+= _mfWindows
.getBinSize();
374 if(FieldBits::NoField
!= (DisplayStringFieldMask
& whichField
))
376 returnValue
+= _sfDisplayString
.getBinSize();
378 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
380 returnValue
+= _sfAspect
.getBinSize();
386 void CSMDrawerBase::copyToBin(BinaryDataHandler
&pMem
,
387 ConstFieldMaskArg whichField
)
389 Inherited::copyToBin(pMem
, whichField
);
391 if(FieldBits::NoField
!= (WindowsFieldMask
& whichField
))
393 _mfWindows
.copyToBin(pMem
);
395 if(FieldBits::NoField
!= (DisplayStringFieldMask
& whichField
))
397 _sfDisplayString
.copyToBin(pMem
);
399 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
401 _sfAspect
.copyToBin(pMem
);
405 void CSMDrawerBase::copyFromBin(BinaryDataHandler
&pMem
,
406 ConstFieldMaskArg whichField
)
408 Inherited::copyFromBin(pMem
, whichField
);
410 if(FieldBits::NoField
!= (WindowsFieldMask
& whichField
))
412 editMField(WindowsFieldMask
, _mfWindows
);
413 _mfWindows
.copyFromBin(pMem
);
415 if(FieldBits::NoField
!= (DisplayStringFieldMask
& whichField
))
417 editSField(DisplayStringFieldMask
);
418 _sfDisplayString
.copyFromBin(pMem
);
420 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
422 editSField(AspectFieldMask
);
423 _sfAspect
.copyFromBin(pMem
);
427 //! create a new instance of the class
428 CSMDrawerTransitPtr
CSMDrawerBase::createLocal(BitVector bFlags
)
430 CSMDrawerTransitPtr fc
;
432 if(getClassType().getPrototype() != NULL
)
434 FieldContainerTransitPtr tmpPtr
=
435 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
437 fc
= dynamic_pointer_cast
<CSMDrawer
>(tmpPtr
);
443 //! create a new instance of the class, copy the container flags
444 CSMDrawerTransitPtr
CSMDrawerBase::createDependent(BitVector bFlags
)
446 CSMDrawerTransitPtr fc
;
448 if(getClassType().getPrototype() != NULL
)
450 FieldContainerTransitPtr tmpPtr
=
451 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
453 fc
= dynamic_pointer_cast
<CSMDrawer
>(tmpPtr
);
459 //! create a new instance of the class
460 CSMDrawerTransitPtr
CSMDrawerBase::create(void)
462 return createLocal();
465 CSMDrawer
*CSMDrawerBase::createEmptyLocal(BitVector bFlags
)
467 CSMDrawer
*returnValue
;
469 newPtr
<CSMDrawer
>(returnValue
, bFlags
);
471 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
476 //! create an empty new instance of the class, do not copy the prototype
477 CSMDrawer
*CSMDrawerBase::createEmpty(void)
479 return createEmptyLocal();
483 FieldContainerTransitPtr
CSMDrawerBase::shallowCopyLocal(
484 BitVector bFlags
) const
488 newPtr(tmpPtr
, dynamic_cast<const CSMDrawer
*>(this), bFlags
);
490 FieldContainerTransitPtr
returnValue(tmpPtr
);
492 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
497 FieldContainerTransitPtr
CSMDrawerBase::shallowCopyDependent(
498 BitVector bFlags
) const
502 newPtr(tmpPtr
, dynamic_cast<const CSMDrawer
*>(this), ~bFlags
);
504 FieldContainerTransitPtr
returnValue(tmpPtr
);
506 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
511 FieldContainerTransitPtr
CSMDrawerBase::shallowCopy(void) const
513 return shallowCopyLocal();
519 /*------------------------- constructors ----------------------------------*/
521 CSMDrawerBase::CSMDrawerBase(void) :
525 CSMWindow::ParentFieldId
),
527 _sfAspect (AspectId(1))
531 CSMDrawerBase::CSMDrawerBase(const CSMDrawerBase
&source
) :
535 CSMWindow::ParentFieldId
),
536 _sfDisplayString (source
._sfDisplayString
),
537 _sfAspect (source
._sfAspect
)
542 /*-------------------------- destructors ----------------------------------*/
544 CSMDrawerBase::~CSMDrawerBase(void)
548 /*-------------------------------------------------------------------------*/
551 bool CSMDrawerBase::unlinkChild(
552 FieldContainer
* const pChild
,
553 UInt16
const childFieldId
)
555 if(childFieldId
== WindowsFieldId
)
557 CSMWindow
* pTypedChild
=
558 dynamic_cast<CSMWindow
*>(pChild
);
560 if(pTypedChild
!= NULL
)
562 Int32 iChildIdx
= _mfWindows
.findIndex(pTypedChild
);
566 editMField(WindowsFieldMask
, _mfWindows
);
568 _mfWindows
.erase(iChildIdx
);
573 SWARNING
<< "Parent ([" << this
574 << "] id [" << this->getId()
575 << "] type [" << this->getType().getCName()
576 << "] childFieldId [" << childFieldId
577 << "]) - Child ([" << pChild
578 << "] id [" << pChild
->getId()
579 << "] type [" << pChild
->getType().getCName()
580 << "]): link inconsistent!"
590 return Inherited::unlinkChild(pChild
, childFieldId
);
593 void CSMDrawerBase::onCreate(const CSMDrawer
*source
)
595 Inherited::onCreate(source
);
599 CSMDrawer
*pThis
= static_cast<CSMDrawer
*>(this);
601 MFUnrecChildCSMWindowPtr::const_iterator WindowsIt
=
602 source
->_mfWindows
.begin();
603 MFUnrecChildCSMWindowPtr::const_iterator WindowsEnd
=
604 source
->_mfWindows
.end ();
606 while(WindowsIt
!= WindowsEnd
)
608 pThis
->pushToWindows(*WindowsIt
);
615 GetFieldHandlePtr
CSMDrawerBase::getHandleWindows (void) const
617 MFUnrecChildCSMWindowPtr::GetHandlePtr
returnValue(
618 new MFUnrecChildCSMWindowPtr::GetHandle(
620 this->getType().getFieldDesc(WindowsFieldId
),
621 const_cast<CSMDrawerBase
*>(this)));
626 EditFieldHandlePtr
CSMDrawerBase::editHandleWindows (void)
628 MFUnrecChildCSMWindowPtr::EditHandlePtr
returnValue(
629 new MFUnrecChildCSMWindowPtr::EditHandle(
631 this->getType().getFieldDesc(WindowsFieldId
),
634 returnValue
->setAddMethod(
635 boost::bind(&CSMDrawer::pushToWindows
,
636 static_cast<CSMDrawer
*>(this), _1
));
637 returnValue
->setRemoveMethod(
638 boost::bind(&CSMDrawer::removeFromWindows
,
639 static_cast<CSMDrawer
*>(this), _1
));
640 returnValue
->setRemoveObjMethod(
641 boost::bind(&CSMDrawer::removeObjFromWindows
,
642 static_cast<CSMDrawer
*>(this), _1
));
643 returnValue
->setClearMethod(
644 boost::bind(&CSMDrawer::clearWindows
,
645 static_cast<CSMDrawer
*>(this)));
647 editMField(WindowsFieldMask
, _mfWindows
);
652 GetFieldHandlePtr
CSMDrawerBase::getHandleDisplayString (void) const
654 SFString::GetHandlePtr
returnValue(
655 new SFString::GetHandle(
657 this->getType().getFieldDesc(DisplayStringFieldId
),
658 const_cast<CSMDrawerBase
*>(this)));
663 EditFieldHandlePtr
CSMDrawerBase::editHandleDisplayString (void)
665 SFString::EditHandlePtr
returnValue(
666 new SFString::EditHandle(
668 this->getType().getFieldDesc(DisplayStringFieldId
),
672 editSField(DisplayStringFieldMask
);
677 GetFieldHandlePtr
CSMDrawerBase::getHandleAspect (void) const
679 SFAspectId::GetHandlePtr
returnValue(
680 new SFAspectId::GetHandle(
682 this->getType().getFieldDesc(AspectFieldId
),
683 const_cast<CSMDrawerBase
*>(this)));
688 EditFieldHandlePtr
CSMDrawerBase::editHandleAspect (void)
690 SFAspectId::EditHandlePtr
returnValue(
691 new SFAspectId::EditHandle(
693 this->getType().getFieldDesc(AspectFieldId
),
697 editSField(AspectFieldMask
);
703 #ifdef OSG_MT_CPTR_ASPECT
704 void CSMDrawerBase::execSyncV( FieldContainer
&oFrom
,
705 ConstFieldMaskArg whichField
,
706 AspectOffsetStore
&oOffsets
,
707 ConstFieldMaskArg syncMode
,
708 const UInt32 uiSyncInfo
)
710 CSMDrawer
*pThis
= static_cast<CSMDrawer
*>(this);
712 pThis
->execSync(static_cast<CSMDrawer
*>(&oFrom
),
721 #ifdef OSG_MT_CPTR_ASPECT
722 FieldContainer
*CSMDrawerBase::createAspectCopy(
723 const FieldContainer
*pRefAspect
) const
725 CSMDrawer
*returnValue
;
727 newAspectCopy(returnValue
,
728 dynamic_cast<const CSMDrawer
*>(pRefAspect
),
729 dynamic_cast<const CSMDrawer
*>(this));
735 void CSMDrawerBase::resolveLinks(void)
737 Inherited::resolveLinks();
739 static_cast<CSMDrawer
*>(this)->clearWindows();