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" // Parents Class
67 #include "OSGNodeCoreBase.h"
68 #include "OSGNodeCore.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::NodeCore
79 Abstract base type for all cores, which define the behavior (semantics) of
80 the node(s) they belong to.
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var FieldContainer * NodeCoreBase::_mfParents
88 Parents of this core. Cores can have more than one parent, i.e. in general
89 they may be used in more than one place in the scenegraph.
93 /***************************************************************************\
94 * FieldType/FieldTrait Instantiation *
95 \***************************************************************************/
97 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
98 PointerType FieldTraits
<NodeCore
*, nsOSG
>::_type(
100 "AttachmentContainerPtr",
101 NodeCore::getClassType(),
105 OSG_FIELDTRAITS_GETTYPE_NS(NodeCore
*, nsOSG
)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
115 DataType
&FieldTraits
< NodeCore
*, nsOSG
+ 1 >::getType(void)
117 return FieldTraits
<NodeCore
*, nsOSG
>::getType();
121 OSG_EXPORT_PTR_SFIELD(ChildPointerSField
,
123 UnrecordedRefCountPolicy
,
127 OSG_EXPORT_PTR_MFIELD(ChildPointerMField
,
129 UnrecordedRefCountPolicy
,
133 DataType
&FieldTraits
<NodeCore
*, nsOSG
+ 2 >::getType(void)
135 return FieldTraits
<NodeCore
*, nsOSG
>::getType();
139 OSG_SFIELDTYPE_INST(ParentPointerSField
,
144 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField
,
150 OSG_MFIELDTYPE_INST(ParentPointerMField
,
155 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerMField
,
161 /***************************************************************************\
162 * Field Description *
163 \***************************************************************************/
165 void NodeCoreBase::classDescInserter(TypeObject
&oType
)
167 FieldDescriptionBase
*pDesc
= NULL
;
170 pDesc
= new MFParentFieldContainerPtr::Description(
171 MFParentFieldContainerPtr::getClassType(),
173 "Parents of this core. Cores can have more than one parent, i.e. in general\n"
174 "they may be used in more than one place in the scenegraph.\n",
175 ParentsFieldId
, ParentsFieldMask
,
177 (Field::MFDefaultFlags
| Field::FStdAccess
),
178 static_cast <FieldEditMethodSig
>(&NodeCore::invalidEditField
),
179 static_cast <FieldGetMethodSig
>(&NodeCore::invalidGetField
));
181 oType
.addInitialDesc(pDesc
);
185 NodeCoreBase::TypeObject
NodeCoreBase::_type(
186 NodeCoreBase::getClassname(),
187 Inherited::getClassname(),
191 reinterpret_cast<InitContainerF
>(&NodeCore::initMethod
),
192 reinterpret_cast<ExitContainerF
>(&NodeCore::exitMethod
),
193 reinterpret_cast<InitalInsertDescFunc
>(
194 reinterpret_cast<void *>(&NodeCore::classDescInserter
)),
197 "<?xml version=\"1.0\" ?>\n"
200 " name=\"NodeCore\"\n"
201 " parent=\"AttachmentContainer\"\n"
202 " library=\"Base\"\n"
203 " structure=\"abstract\"\n"
204 " group=\"NodeCore\"\n"
205 " pointerfieldtypes=\"both\"\n"
206 " parentFields=\"both\"\n"
207 " childFields=\"both\"\n"
208 " systemcomponent=\"true\"\n"
209 " parentsystemcomponent=\"true\"\n"
210 " isNodeCore=\"true\"\n"
211 " docGroupBase=\"GrpBaseFieldContainer\"\n"
213 " Abstract base type for all cores, which define the behavior (semantics) of\n"
214 " the node(s) they belong to.\n"
217 " name=\"Parents\"\n"
218 " category=\"parentpointer\"\n"
219 " type=\"FieldContainer\"\n"
220 " cardinality=\"multi\"\n"
222 " visibility=\"internal\"\n"
224 " Parents of this core. Cores can have more than one parent, i.e. in general\n"
225 " they may be used in more than one place in the scenegraph.\n"
227 "</FieldContainer>\n",
228 "Abstract base type for all cores, which define the behavior (semantics) of\n"
229 "the node(s) they belong to.\n"
232 /*------------------------------ get -----------------------------------*/
234 FieldContainerType
&NodeCoreBase::getType(void)
239 const FieldContainerType
&NodeCoreBase::getType(void) const
244 UInt32
NodeCoreBase::getContainerSize(void) const
246 return sizeof(NodeCore
);
249 /*------------------------- decorator get ------------------------------*/
257 /*------------------------------ access -----------------------------------*/
259 SizeT
NodeCoreBase::getBinSize(ConstFieldMaskArg whichField
)
261 SizeT returnValue
= Inherited::getBinSize(whichField
);
263 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
265 returnValue
+= _mfParents
.getBinSize();
271 void NodeCoreBase::copyToBin(BinaryDataHandler
&pMem
,
272 ConstFieldMaskArg whichField
)
274 Inherited::copyToBin(pMem
, whichField
);
276 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
278 _mfParents
.copyToBin(pMem
);
282 void NodeCoreBase::copyFromBin(BinaryDataHandler
&pMem
,
283 ConstFieldMaskArg whichField
)
285 Inherited::copyFromBin(pMem
, whichField
);
287 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
289 editMField(ParentsFieldMask
, _mfParents
);
290 _mfParents
.copyFromBin(pMem
);
297 /*------------------------- constructors ----------------------------------*/
299 NodeCoreBase::NodeCoreBase(void) :
305 NodeCoreBase::NodeCoreBase(const NodeCoreBase
&source
) :
312 /*-------------------------- destructors ----------------------------------*/
314 NodeCoreBase::~NodeCoreBase(void)
317 /*-------------------------------------------------------------------------*/
320 bool NodeCoreBase::linkParent(
321 FieldContainer
* const pParent
,
322 UInt16
const childFieldId
,
323 UInt16
const parentFieldId
)
325 if(parentFieldId
== ParentsFieldId
)
327 FieldContainer
* pTypedParent
=
328 dynamic_cast< FieldContainer
* >(pParent
);
330 if(pTypedParent
!= NULL
)
332 editMField(ParentsFieldMask
, _mfParents
);
334 _mfParents
.push_back(pTypedParent
, childFieldId
);
342 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
345 bool NodeCoreBase::unlinkParent(
346 FieldContainer
* const pParent
,
347 UInt16
const parentFieldId
)
349 if(parentFieldId
== ParentsFieldId
)
351 FieldContainer
* pTypedParent
=
352 dynamic_cast< FieldContainer
* >(pParent
);
354 if(pTypedParent
!= NULL
)
356 Int32 iParentIdx
= _mfParents
.findIndex(pTypedParent
);
360 editMField(ParentsFieldMask
, _mfParents
);
362 _mfParents
.erase(iParentIdx
);
367 SWARNING
<< "Child ([" << this
368 << "] id [" << this->getId()
369 << "] type [" << this->getType().getCName()
370 << "] parentFieldId [" << parentFieldId
371 << "]) - Parent ([" << pParent
372 << "] id [" << pParent
->getId()
373 << "] type [" << pParent
->getType().getCName()
374 << "]): link inconsistent!"
383 return Inherited::unlinkParent(pParent
, parentFieldId
);
388 GetFieldHandlePtr
NodeCoreBase::getHandleParents (void) const
390 MFParentFieldContainerPtr::GetHandlePtr returnValue
;
395 EditFieldHandlePtr
NodeCoreBase::editHandleParents (void)
397 EditFieldHandlePtr returnValue
;
403 #ifdef OSG_MT_CPTR_ASPECT
404 void NodeCoreBase::execSyncV( FieldContainer
&oFrom
,
405 ConstFieldMaskArg whichField
,
406 AspectOffsetStore
&oOffsets
,
407 ConstFieldMaskArg syncMode
,
408 const UInt32 uiSyncInfo
)
410 NodeCore
*pThis
= static_cast<NodeCore
*>(this);
412 pThis
->execSync(static_cast<NodeCore
*>(&oFrom
),
422 void NodeCoreBase::resolveLinks(void)
424 Inherited::resolveLinks();