fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComputeBase / Base / OSGComputeCallbackAlgorithmBase.cpp
blob5d4c700a9397205062ba3eee96ed3efd79989c32
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ComputeCallbackAlgorithm!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGComputeCallbackAlgorithmBase.h"
67 #include "OSGComputeCallbackAlgorithm.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ComputeCallbackAlgorithm
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var ComputeFunctorCallback ComputeCallbackAlgorithmBase::_sfCallback
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<ComputeCallbackAlgorithm *, nsOSG>::_type(
96 "ComputeCallbackAlgorithmPtr",
97 "ComputeAlgorithmPtr",
98 ComputeCallbackAlgorithm::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(ComputeCallbackAlgorithm *, nsOSG)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
105 ComputeCallbackAlgorithm *,
106 nsOSG)
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
109 ComputeCallbackAlgorithm *,
110 nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void ComputeCallbackAlgorithmBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new SFComputeFunctorCallback::Description(
122 SFComputeFunctorCallback::getClassType(),
123 "callback",
125 CallbackFieldId, CallbackFieldMask,
126 false,
127 (Field::SFDefaultFlags | Field::FStdAccess),
128 static_cast <FieldEditMethodSig>(&ComputeCallbackAlgorithm::invalidEditField),
129 static_cast <FieldGetMethodSig >(&ComputeCallbackAlgorithm::invalidGetField));
131 oType.addInitialDesc(pDesc);
135 ComputeCallbackAlgorithmBase::TypeObject ComputeCallbackAlgorithmBase::_type(
136 ComputeCallbackAlgorithmBase::getClassname(),
137 Inherited::getClassname(),
138 "NULL",
139 nsOSG, //Namespace
140 reinterpret_cast<PrototypeCreateF>(&ComputeCallbackAlgorithmBase::createEmptyLocal),
141 reinterpret_cast<InitContainerF>(&ComputeCallbackAlgorithm::initMethod),
142 reinterpret_cast<ExitContainerF>(&ComputeCallbackAlgorithm::exitMethod),
143 reinterpret_cast<InitalInsertDescFunc>(
144 reinterpret_cast<void *>(&ComputeCallbackAlgorithm::classDescInserter)),
145 false,
147 "<?xml version=\"1.0\"?>\n"
148 "\n"
149 "<FieldContainer\n"
150 " name=\"ComputeCallbackAlgorithm\"\n"
151 " parent=\"ComputeAlgorithm\"\n"
152 " library=\"ContribComputeBase\"\n"
153 " pointerfieldtypes=\"both\"\n"
154 " structure=\"concrete\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " decoratable=\"false\"\n"
158 " useLocalIncludes=\"false\"\n"
159 " isNodeCore=\"false\"\n"
160 " >\n"
161 " <Field\n"
162 " name=\"callback\"\n"
163 " type=\"ComputeFunctorCallback\"\n"
164 " cardinality=\"single\"\n"
165 " visibility=\"external\"\n"
166 " access=\"none\"\n"
167 " >\n"
168 " </Field>\n"
169 "</FieldContainer>\n",
173 /*------------------------------ get -----------------------------------*/
175 FieldContainerType &ComputeCallbackAlgorithmBase::getType(void)
177 return _type;
180 const FieldContainerType &ComputeCallbackAlgorithmBase::getType(void) const
182 return _type;
185 UInt32 ComputeCallbackAlgorithmBase::getContainerSize(void) const
187 return sizeof(ComputeCallbackAlgorithm);
190 /*------------------------- decorator get ------------------------------*/
198 /*------------------------------ access -----------------------------------*/
200 SizeT ComputeCallbackAlgorithmBase::getBinSize(ConstFieldMaskArg whichField)
202 SizeT returnValue = Inherited::getBinSize(whichField);
204 if(FieldBits::NoField != (CallbackFieldMask & whichField))
206 returnValue += _sfCallback.getBinSize();
209 return returnValue;
212 void ComputeCallbackAlgorithmBase::copyToBin(BinaryDataHandler &pMem,
213 ConstFieldMaskArg whichField)
215 Inherited::copyToBin(pMem, whichField);
217 if(FieldBits::NoField != (CallbackFieldMask & whichField))
219 _sfCallback.copyToBin(pMem);
223 void ComputeCallbackAlgorithmBase::copyFromBin(BinaryDataHandler &pMem,
224 ConstFieldMaskArg whichField)
226 Inherited::copyFromBin(pMem, whichField);
228 if(FieldBits::NoField != (CallbackFieldMask & whichField))
230 editSField(CallbackFieldMask);
231 _sfCallback.copyFromBin(pMem);
235 //! create a new instance of the class
236 ComputeCallbackAlgorithmTransitPtr ComputeCallbackAlgorithmBase::createLocal(BitVector bFlags)
238 ComputeCallbackAlgorithmTransitPtr fc;
240 if(getClassType().getPrototype() != NULL)
242 FieldContainerTransitPtr tmpPtr =
243 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
245 fc = dynamic_pointer_cast<ComputeCallbackAlgorithm>(tmpPtr);
248 return fc;
251 //! create a new instance of the class, copy the container flags
252 ComputeCallbackAlgorithmTransitPtr ComputeCallbackAlgorithmBase::createDependent(BitVector bFlags)
254 ComputeCallbackAlgorithmTransitPtr fc;
256 if(getClassType().getPrototype() != NULL)
258 FieldContainerTransitPtr tmpPtr =
259 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
261 fc = dynamic_pointer_cast<ComputeCallbackAlgorithm>(tmpPtr);
264 return fc;
267 //! create a new instance of the class
268 ComputeCallbackAlgorithmTransitPtr ComputeCallbackAlgorithmBase::create(void)
270 ComputeCallbackAlgorithmTransitPtr fc;
272 if(getClassType().getPrototype() != NULL)
274 FieldContainerTransitPtr tmpPtr =
275 getClassType().getPrototype()-> shallowCopy();
277 fc = dynamic_pointer_cast<ComputeCallbackAlgorithm>(tmpPtr);
280 return fc;
283 ComputeCallbackAlgorithm *ComputeCallbackAlgorithmBase::createEmptyLocal(BitVector bFlags)
285 ComputeCallbackAlgorithm *returnValue;
287 newPtr<ComputeCallbackAlgorithm>(returnValue, bFlags);
289 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
291 return returnValue;
294 //! create an empty new instance of the class, do not copy the prototype
295 ComputeCallbackAlgorithm *ComputeCallbackAlgorithmBase::createEmpty(void)
297 ComputeCallbackAlgorithm *returnValue;
299 newPtr<ComputeCallbackAlgorithm>(returnValue, Thread::getCurrentLocalFlags());
301 returnValue->_pFieldFlags->_bNamespaceMask &=
302 ~Thread::getCurrentLocalFlags();
304 return returnValue;
308 FieldContainerTransitPtr ComputeCallbackAlgorithmBase::shallowCopyLocal(
309 BitVector bFlags) const
311 ComputeCallbackAlgorithm *tmpPtr;
313 newPtr(tmpPtr, dynamic_cast<const ComputeCallbackAlgorithm *>(this), bFlags);
315 FieldContainerTransitPtr returnValue(tmpPtr);
317 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
319 return returnValue;
322 FieldContainerTransitPtr ComputeCallbackAlgorithmBase::shallowCopyDependent(
323 BitVector bFlags) const
325 ComputeCallbackAlgorithm *tmpPtr;
327 newPtr(tmpPtr, dynamic_cast<const ComputeCallbackAlgorithm *>(this), ~bFlags);
329 FieldContainerTransitPtr returnValue(tmpPtr);
331 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
333 return returnValue;
336 FieldContainerTransitPtr ComputeCallbackAlgorithmBase::shallowCopy(void) const
338 ComputeCallbackAlgorithm *tmpPtr;
340 newPtr(tmpPtr,
341 dynamic_cast<const ComputeCallbackAlgorithm *>(this),
342 Thread::getCurrentLocalFlags());
344 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
346 FieldContainerTransitPtr returnValue(tmpPtr);
348 return returnValue;
354 /*------------------------- constructors ----------------------------------*/
356 ComputeCallbackAlgorithmBase::ComputeCallbackAlgorithmBase(void) :
357 Inherited(),
358 _sfCallback ()
362 ComputeCallbackAlgorithmBase::ComputeCallbackAlgorithmBase(const ComputeCallbackAlgorithmBase &source) :
363 Inherited(source),
364 _sfCallback (source._sfCallback )
369 /*-------------------------- destructors ----------------------------------*/
371 ComputeCallbackAlgorithmBase::~ComputeCallbackAlgorithmBase(void)
376 GetFieldHandlePtr ComputeCallbackAlgorithmBase::getHandleCallback (void) const
378 SFComputeFunctorCallback::GetHandlePtr returnValue;
380 return returnValue;
383 EditFieldHandlePtr ComputeCallbackAlgorithmBase::editHandleCallback (void)
385 EditFieldHandlePtr returnValue;
387 return returnValue;
391 #ifdef OSG_MT_CPTR_ASPECT
392 void ComputeCallbackAlgorithmBase::execSyncV( FieldContainer &oFrom,
393 ConstFieldMaskArg whichField,
394 AspectOffsetStore &oOffsets,
395 ConstFieldMaskArg syncMode,
396 const UInt32 uiSyncInfo)
398 ComputeCallbackAlgorithm *pThis = static_cast<ComputeCallbackAlgorithm *>(this);
400 pThis->execSync(static_cast<ComputeCallbackAlgorithm *>(&oFrom),
401 whichField,
402 oOffsets,
403 syncMode,
404 uiSyncInfo);
406 #endif
409 #ifdef OSG_MT_CPTR_ASPECT
410 FieldContainer *ComputeCallbackAlgorithmBase::createAspectCopy(
411 const FieldContainer *pRefAspect) const
413 ComputeCallbackAlgorithm *returnValue;
415 newAspectCopy(returnValue,
416 dynamic_cast<const ComputeCallbackAlgorithm *>(pRefAspect),
417 dynamic_cast<const ComputeCallbackAlgorithm *>(this));
419 return returnValue;
421 #endif
423 void ComputeCallbackAlgorithmBase::resolveLinks(void)
425 Inherited::resolveLinks();
431 OSG_END_NAMESPACE