1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 FCDSParTestFC!
50 *****************************************************************************
51 \*****************************************************************************/
56 #include "OSGConfig.h"
60 #include "OSGFieldContainer.h" // Parent Class
62 #include "OSGFCDSParTestFCBase.h"
63 #include "OSGFCDSParTestFC.h"
65 #include <boost/bind.hpp>
67 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
68 #pragma warning(disable:4355)
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::FCDSParTestFC
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var FieldContainer * FCDSParTestFCBase::_sfParent
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits
<FCDSParTestFC
*, nsOSG
>::_type(
97 "AttachmentContainerPtr",
98 FCDSParTestFC::getClassType(),
102 OSG_FIELDTRAITS_GETTYPE_NS(FCDSParTestFC
*, nsOSG
)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
112 DataType
&FieldTraits
< FCDSParTestFC
*, nsOSG
+ 1 >::getType(void)
114 return FieldTraits
<FCDSParTestFC
*, nsOSG
>::getType();
118 OSG_EXPORT_PTR_SFIELD(ChildPointerSField
,
120 UnrecordedRefCountPolicy
,
124 OSG_EXPORT_PTR_MFIELD(ChildPointerMField
,
126 UnrecordedRefCountPolicy
,
130 /***************************************************************************\
131 * Field Description *
132 \***************************************************************************/
134 void FCDSParTestFCBase::classDescInserter(TypeObject
&oType
)
136 FieldDescriptionBase
*pDesc
= NULL
;
139 pDesc
= new SFParentFieldContainerPtr::Description(
140 SFParentFieldContainerPtr::getClassType(),
143 ParentFieldId
, ParentFieldMask
,
145 (Field::SFDefaultFlags
| Field::FStdAccess
),
146 static_cast <FieldEditMethodSig
>(&FCDSParTestFC::invalidEditField
),
147 static_cast <FieldGetMethodSig
>(&FCDSParTestFC::invalidGetField
));
149 oType
.addInitialDesc(pDesc
);
153 FCDSParTestFCBase::TypeObject
FCDSParTestFCBase::_type(
154 FCDSParTestFCBase::getClassname(),
155 Inherited::getClassname(),
158 reinterpret_cast<PrototypeCreateF
>(&FCDSParTestFCBase::createEmptyLocal
),
159 FCDSParTestFC::initMethod
,
160 FCDSParTestFC::exitMethod
,
161 reinterpret_cast<InitalInsertDescFunc
>(&FCDSParTestFC::classDescInserter
),
164 "<?xml version=\"1.0\" ?>\n"
167 "\tname=\"FCDSParTestFC\"\n"
168 "\tparent=\"AttachmentContainer\"\n"
169 "\tlibrary=\"System\"\n"
170 "\tstructure=\"concrete\"\n"
171 "\tpointerfieldtypes=\"both\"\n"
172 "\tsystemcomponent=\"true\"\n"
173 "\tparentsystemcomponent=\"true\"\n"
174 " isNodeCore=\"false\"\n"
175 " childFields=\"both\"\n"
178 "\t\tname=\"parent\"\n"
179 "\t\ttype=\"FieldContainer\"\n"
180 "\t\tcardinality=\"single\"\n"
181 "\t\tvisibility=\"internal\"\n"
182 "\t\taccess=\"none\"\n"
183 " category=\"parentpointer\"\n"
186 "</FieldContainer>\n",
190 /*------------------------------ get -----------------------------------*/
192 FieldContainerType
&FCDSParTestFCBase::getType(void)
197 const FieldContainerType
&FCDSParTestFCBase::getType(void) const
202 UInt32
FCDSParTestFCBase::getContainerSize(void) const
204 return sizeof(FCDSParTestFC
);
207 /*------------------------- decorator get ------------------------------*/
215 /*------------------------------ access -----------------------------------*/
217 SizeT
FCDSParTestFCBase::getBinSize(ConstFieldMaskArg whichField
)
219 SizeT returnValue
= Inherited::getBinSize(whichField
);
221 if(FieldBits::NoField
!= (ParentFieldMask
& whichField
))
223 returnValue
+= _sfParent
.getBinSize();
229 void FCDSParTestFCBase::copyToBin(BinaryDataHandler
&pMem
,
230 ConstFieldMaskArg whichField
)
232 Inherited::copyToBin(pMem
, whichField
);
234 if(FieldBits::NoField
!= (ParentFieldMask
& whichField
))
236 _sfParent
.copyToBin(pMem
);
240 void FCDSParTestFCBase::copyFromBin(BinaryDataHandler
&pMem
,
241 ConstFieldMaskArg whichField
)
243 Inherited::copyFromBin(pMem
, whichField
);
245 if(FieldBits::NoField
!= (ParentFieldMask
& whichField
))
247 editSField(ParentFieldMask
);
248 _sfParent
.copyFromBin(pMem
);
252 //! create a new instance of the class
253 FCDSParTestFCTransitPtr
FCDSParTestFCBase::createLocal(BitVector bFlags
)
255 FCDSParTestFCTransitPtr fc
;
257 if(getClassType().getPrototype() != NULL
)
259 FieldContainerTransitPtr tmpPtr
=
260 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
262 fc
= dynamic_pointer_cast
<FCDSParTestFC
>(tmpPtr
);
268 //! create a new instance of the class, copy the container flags
269 FCDSParTestFCTransitPtr
FCDSParTestFCBase::createDependent(BitVector bFlags
)
271 FCDSParTestFCTransitPtr fc
;
273 if(getClassType().getPrototype() != NULL
)
275 FieldContainerTransitPtr tmpPtr
=
276 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
278 fc
= dynamic_pointer_cast
<FCDSParTestFC
>(tmpPtr
);
284 //! create a new instance of the class
285 FCDSParTestFCTransitPtr
FCDSParTestFCBase::create(void)
287 FCDSParTestFCTransitPtr fc
;
289 if(getClassType().getPrototype() != NULL
)
291 FieldContainerTransitPtr tmpPtr
=
292 getClassType().getPrototype()-> shallowCopy();
294 fc
= dynamic_pointer_cast
<FCDSParTestFC
>(tmpPtr
);
300 FCDSParTestFC
*FCDSParTestFCBase::createEmptyLocal(BitVector bFlags
)
302 FCDSParTestFC
*returnValue
;
304 newPtr
<FCDSParTestFC
>(returnValue
, bFlags
);
306 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
311 //! create an empty new instance of the class, do not copy the prototype
312 FCDSParTestFC
*FCDSParTestFCBase::createEmpty(void)
314 FCDSParTestFC
*returnValue
;
316 newPtr
<FCDSParTestFC
>(returnValue
, Thread::getCurrentLocalFlags());
318 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
319 ~Thread::getCurrentLocalFlags();
325 FieldContainerTransitPtr
FCDSParTestFCBase::shallowCopyLocal(
326 BitVector bFlags
) const
328 FCDSParTestFC
*tmpPtr
;
330 newPtr(tmpPtr
, dynamic_cast<const FCDSParTestFC
*>(this), bFlags
);
332 FieldContainerTransitPtr
returnValue(tmpPtr
);
334 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
339 FieldContainerTransitPtr
FCDSParTestFCBase::shallowCopyDependent(
340 BitVector bFlags
) const
342 FCDSParTestFC
*tmpPtr
;
344 newPtr(tmpPtr
, dynamic_cast<const FCDSParTestFC
*>(this), ~bFlags
);
346 FieldContainerTransitPtr
returnValue(tmpPtr
);
348 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
353 FieldContainerTransitPtr
FCDSParTestFCBase::shallowCopy(void) const
355 FCDSParTestFC
*tmpPtr
;
358 dynamic_cast<const FCDSParTestFC
*>(this),
359 Thread::getCurrentLocalFlags());
361 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
363 FieldContainerTransitPtr
returnValue(tmpPtr
);
371 /*------------------------- constructors ----------------------------------*/
373 FCDSParTestFCBase::FCDSParTestFCBase(void) :
379 FCDSParTestFCBase::FCDSParTestFCBase(const FCDSParTestFCBase
&source
) :
386 /*-------------------------- destructors ----------------------------------*/
388 FCDSParTestFCBase::~FCDSParTestFCBase(void)
391 /*-------------------------------------------------------------------------*/
394 bool FCDSParTestFCBase::linkParent(
395 FieldContainer
* const pParent
,
396 UInt16
const childFieldId
,
397 UInt16
const parentFieldId
)
399 if(parentFieldId
== ParentFieldId
)
401 FieldContainer
* pTypedParent
=
402 dynamic_cast< FieldContainer
* >(pParent
);
404 if(pTypedParent
!= NULL
)
406 FieldContainer
*pOldParent
=
407 _sfParent
.getValue ();
409 UInt16 oldChildFieldId
=
410 _sfParent
.getParentFieldPos();
412 if(pOldParent
!= NULL
)
414 pOldParent
->unlinkChild(this, oldChildFieldId
);
417 editSField(ParentFieldMask
);
419 _sfParent
.setValue(static_cast<FieldContainer
*>(pParent
), childFieldId
);
427 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
430 bool FCDSParTestFCBase::unlinkParent(
431 FieldContainer
* const pParent
,
432 UInt16
const parentFieldId
)
434 if(parentFieldId
== ParentFieldId
)
436 FieldContainer
* pTypedParent
=
437 dynamic_cast< FieldContainer
* >(pParent
);
439 if(pTypedParent
!= NULL
)
441 if(_sfParent
.getValue() == pTypedParent
)
443 editSField(ParentFieldMask
);
445 _sfParent
.setValue(NULL
, 0xFFFF);
450 SWARNING
<< "Child ([" << this
451 << "] id [" << this->getId()
452 << "] type [" << this->getType().getCName()
453 << "] parentFieldId [" << parentFieldId
454 << "]) - Parent ([" << pParent
455 << "] id [" << pParent
->getId()
456 << "] type [" << pParent
->getType().getCName()
457 << "]): link inconsistent!"
466 return Inherited::unlinkParent(pParent
, parentFieldId
);
471 GetFieldHandlePtr
FCDSParTestFCBase::getHandleParent (void) const
473 SFParentFieldContainerPtr::GetHandlePtr returnValue
;
478 EditFieldHandlePtr
FCDSParTestFCBase::editHandleParent (void)
480 EditFieldHandlePtr returnValue
;
486 #ifdef OSG_MT_CPTR_ASPECT
487 void FCDSParTestFCBase::execSyncV( FieldContainer
&oFrom
,
488 ConstFieldMaskArg whichField
,
489 AspectOffsetStore
&oOffsets
,
490 ConstFieldMaskArg syncMode
,
491 const UInt32 uiSyncInfo
)
493 FCDSParTestFC
*pThis
= static_cast<FCDSParTestFC
*>(this);
495 pThis
->execSync(static_cast<FCDSParTestFC
*>(&oFrom
),
504 #ifdef OSG_MT_CPTR_ASPECT
505 FieldContainer
*FCDSParTestFCBase::createAspectCopy(
506 const FieldContainer
*pRefAspect
) const
508 FCDSParTestFC
*returnValue
;
510 newAspectCopy(returnValue
,
511 dynamic_cast<const FCDSParTestFC
*>(pRefAspect
),
512 dynamic_cast<const FCDSParTestFC
*>(this));
518 void FCDSParTestFCBase::resolveLinks(void)
520 Inherited::resolveLinks();