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 ComputeElement!
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"
66 #include "OSGComputeElementBase.h"
67 #include "OSGComputeElement.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ComputeElement
78 Base of compute elements.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
86 /***************************************************************************\
87 * FieldType/FieldTrait Instantiation *
88 \***************************************************************************/
90 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
91 PointerType FieldTraits
<ComputeElement
*, nsOSG
>::_type(
94 ComputeElement::getClassType(),
98 OSG_FIELDTRAITS_GETTYPE_NS(ComputeElement
*, nsOSG
)
100 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
104 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
108 /***************************************************************************\
109 * Field Description *
110 \***************************************************************************/
112 void ComputeElementBase::classDescInserter(TypeObject
&oType
)
114 Inherited::classDescInserter(oType
);
119 ComputeElementBase::TypeObject
ComputeElementBase::_type(
120 ComputeElementBase::getClassname(),
121 Inherited::getClassname(),
124 reinterpret_cast<PrototypeCreateF
>(&ComputeElementBase::createEmptyLocal
),
125 reinterpret_cast<InitContainerF
>(&ComputeElement::initMethod
),
126 reinterpret_cast<ExitContainerF
>(&ComputeElement::exitMethod
),
127 reinterpret_cast<InitalInsertDescFunc
>(
128 reinterpret_cast<void *>(&ComputeElement::classDescInserter
)),
131 "<?xml version=\"1.0\"?>\n"
134 " name=\"ComputeElement\"\n"
135 " parent=\"Group\"\n"
136 " mixinparent=\"ComputeElementParent\"\n"
137 " library=\"ContribComputeBase\"\n"
138 " pointerfieldtypes=\"both\"\n"
139 " structure=\"concrete\"\n"
140 " systemcomponent=\"true\"\n"
141 " parentsystemcomponent=\"true\"\n"
142 " decoratable=\"false\"\n"
143 " useLocalIncludes=\"false\"\n"
144 " isNodeCore=\"true\"\n"
146 " Base of compute elements. \n"
147 "</FieldContainer>\n",
148 "Base of compute elements. \n"
151 /*------------------------------ get -----------------------------------*/
153 FieldContainerType
&ComputeElementBase::getType(void)
158 const FieldContainerType
&ComputeElementBase::getType(void) const
163 UInt32
ComputeElementBase::getContainerSize(void) const
165 return sizeof(ComputeElement
);
168 /*------------------------- decorator get ------------------------------*/
175 /*------------------------------ access -----------------------------------*/
177 SizeT
ComputeElementBase::getBinSize(ConstFieldMaskArg whichField
)
179 SizeT returnValue
= Inherited::getBinSize(whichField
);
185 void ComputeElementBase::copyToBin(BinaryDataHandler
&pMem
,
186 ConstFieldMaskArg whichField
)
188 Inherited::copyToBin(pMem
, whichField
);
192 void ComputeElementBase::copyFromBin(BinaryDataHandler
&pMem
,
193 ConstFieldMaskArg whichField
)
195 Inherited::copyFromBin(pMem
, whichField
);
199 //! create a new instance of the class
200 ComputeElementTransitPtr
ComputeElementBase::createLocal(BitVector bFlags
)
202 ComputeElementTransitPtr fc
;
204 if(getClassType().getPrototype() != NULL
)
206 FieldContainerTransitPtr tmpPtr
=
207 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
209 fc
= dynamic_pointer_cast
<ComputeElement
>(tmpPtr
);
215 //! create a new instance of the class, copy the container flags
216 ComputeElementTransitPtr
ComputeElementBase::createDependent(BitVector bFlags
)
218 ComputeElementTransitPtr fc
;
220 if(getClassType().getPrototype() != NULL
)
222 FieldContainerTransitPtr tmpPtr
=
223 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
225 fc
= dynamic_pointer_cast
<ComputeElement
>(tmpPtr
);
231 //! create a new instance of the class
232 ComputeElementTransitPtr
ComputeElementBase::create(void)
234 ComputeElementTransitPtr fc
;
236 if(getClassType().getPrototype() != NULL
)
238 FieldContainerTransitPtr tmpPtr
=
239 getClassType().getPrototype()-> shallowCopy();
241 fc
= dynamic_pointer_cast
<ComputeElement
>(tmpPtr
);
247 ComputeElement
*ComputeElementBase::createEmptyLocal(BitVector bFlags
)
249 ComputeElement
*returnValue
;
251 newPtr
<ComputeElement
>(returnValue
, bFlags
);
253 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
258 //! create an empty new instance of the class, do not copy the prototype
259 ComputeElement
*ComputeElementBase::createEmpty(void)
261 ComputeElement
*returnValue
;
263 newPtr
<ComputeElement
>(returnValue
, Thread::getCurrentLocalFlags());
265 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
266 ~Thread::getCurrentLocalFlags();
272 FieldContainerTransitPtr
ComputeElementBase::shallowCopyLocal(
273 BitVector bFlags
) const
275 ComputeElement
*tmpPtr
;
277 newPtr(tmpPtr
, dynamic_cast<const ComputeElement
*>(this), bFlags
);
279 FieldContainerTransitPtr
returnValue(tmpPtr
);
281 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
286 FieldContainerTransitPtr
ComputeElementBase::shallowCopyDependent(
287 BitVector bFlags
) const
289 ComputeElement
*tmpPtr
;
291 newPtr(tmpPtr
, dynamic_cast<const ComputeElement
*>(this), ~bFlags
);
293 FieldContainerTransitPtr
returnValue(tmpPtr
);
295 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
300 FieldContainerTransitPtr
ComputeElementBase::shallowCopy(void) const
302 ComputeElement
*tmpPtr
;
305 dynamic_cast<const ComputeElement
*>(this),
306 Thread::getCurrentLocalFlags());
308 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
310 FieldContainerTransitPtr
returnValue(tmpPtr
);
318 /*------------------------- constructors ----------------------------------*/
320 ComputeElementBase::ComputeElementBase(void) :
325 ComputeElementBase::ComputeElementBase(const ComputeElementBase
&source
) :
331 /*-------------------------- destructors ----------------------------------*/
333 ComputeElementBase::~ComputeElementBase(void)
339 #ifdef OSG_MT_CPTR_ASPECT
340 void ComputeElementBase::execSyncV( FieldContainer
&oFrom
,
341 ConstFieldMaskArg whichField
,
342 AspectOffsetStore
&oOffsets
,
343 ConstFieldMaskArg syncMode
,
344 const UInt32 uiSyncInfo
)
346 ComputeElement
*pThis
= static_cast<ComputeElement
*>(this);
348 pThis
->execSync(static_cast<ComputeElement
*>(&oFrom
),
357 #ifdef OSG_MT_CPTR_ASPECT
358 FieldContainer
*ComputeElementBase::createAspectCopy(
359 const FieldContainer
*pRefAspect
) const
361 ComputeElement
*returnValue
;
363 newAspectCopy(returnValue
,
364 dynamic_cast<const ComputeElement
*>(pRefAspect
),
365 dynamic_cast<const ComputeElement
*>(this));
371 void ComputeElementBase::resolveLinks(void)
373 Inherited::resolveLinks();