fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGDoubleTransformBase.cpp
blobef79e144e9e8377ccc03640d4abec93c7dd41c4e
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 DoubleTransform!
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 "OSGDoubleTransformBase.h"
67 #include "OSGDoubleTransform.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::DoubleTransform
78 The basic Transformation class. Just keeps a single matrix. For more complex
79 behaviour, see its descendents.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Matrix4d DoubleTransformBase::_sfMatrix
87 The transformation matrix.
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits<DoubleTransform *, nsOSG>::_type(
97 "DoubleTransformPtr",
98 "GroupPtr",
99 DoubleTransform::getClassType(),
100 nsOSG);
101 #endif
103 OSG_FIELDTRAITS_GETTYPE_NS(DoubleTransform *, nsOSG)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
106 DoubleTransform *,
107 nsOSG)
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
110 DoubleTransform *,
111 nsOSG)
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void DoubleTransformBase::classDescInserter(TypeObject &oType)
119 FieldDescriptionBase *pDesc = NULL;
122 pDesc = new SFMatrix4d::Description(
123 SFMatrix4d::getClassType(),
124 "matrix",
125 "The transformation matrix.\n",
126 MatrixFieldId, MatrixFieldMask,
127 false,
128 (Field::SFDefaultFlags | Field::FStdAccess),
129 static_cast<FieldEditMethodSig>(&DoubleTransform::editHandleMatrix),
130 static_cast<FieldGetMethodSig >(&DoubleTransform::getHandleMatrix));
132 oType.addInitialDesc(pDesc);
136 DoubleTransformBase::TypeObject DoubleTransformBase::_type(
137 DoubleTransformBase::getClassname(),
138 Inherited::getClassname(),
139 "NULL",
140 nsOSG, //Namespace
141 reinterpret_cast<PrototypeCreateF>(&DoubleTransformBase::createEmptyLocal),
142 reinterpret_cast<InitContainerF>(&DoubleTransform::initMethod),
143 reinterpret_cast<ExitContainerF>(&DoubleTransform::exitMethod),
144 reinterpret_cast<InitalInsertDescFunc>(
145 reinterpret_cast<void *>(&DoubleTransform::classDescInserter)),
146 false,
148 "<?xml version=\"1.0\" ?>\n"
149 "\n"
150 "<FieldContainer\n"
151 " name=\"DoubleTransform\"\n"
152 " parent=\"Group\"\n"
153 " library=\"Group\"\n"
154 " structure=\"concrete\"\n"
155 " pointerfieldtypes=\"both\"\n"
156 " systemcomponent=\"true\"\n"
157 " parentsystemcomponent=\"true\"\n"
158 " isNodeCore=\"true\"\n"
159 " docGroupBase=\"GrpGroupMisc\"\n"
160 " >\n"
161 " The basic Transformation class. Just keeps a single matrix. For more complex\n"
162 " behaviour, see its descendents.\n"
163 " <Field\n"
164 "\t name=\"matrix\"\n"
165 "\t type=\"Matrix4d\"\n"
166 "\t cardinality=\"single\"\n"
167 "\t visibility=\"external\"\n"
168 "\t >\n"
169 "\tThe transformation matrix.\n"
170 " </Field>\n"
171 "</FieldContainer>\n",
172 "The basic Transformation class. Just keeps a single matrix. For more complex\n"
173 "behaviour, see its descendents.\n"
176 /*------------------------------ get -----------------------------------*/
178 FieldContainerType &DoubleTransformBase::getType(void)
180 return _type;
183 const FieldContainerType &DoubleTransformBase::getType(void) const
185 return _type;
188 UInt32 DoubleTransformBase::getContainerSize(void) const
190 return sizeof(DoubleTransform);
193 /*------------------------- decorator get ------------------------------*/
196 SFMatrix4d *DoubleTransformBase::editSFMatrix(void)
198 editSField(MatrixFieldMask);
200 return &_sfMatrix;
203 const SFMatrix4d *DoubleTransformBase::getSFMatrix(void) const
205 return &_sfMatrix;
213 /*------------------------------ access -----------------------------------*/
215 SizeT DoubleTransformBase::getBinSize(ConstFieldMaskArg whichField)
217 SizeT returnValue = Inherited::getBinSize(whichField);
219 if(FieldBits::NoField != (MatrixFieldMask & whichField))
221 returnValue += _sfMatrix.getBinSize();
224 return returnValue;
227 void DoubleTransformBase::copyToBin(BinaryDataHandler &pMem,
228 ConstFieldMaskArg whichField)
230 Inherited::copyToBin(pMem, whichField);
232 if(FieldBits::NoField != (MatrixFieldMask & whichField))
234 _sfMatrix.copyToBin(pMem);
238 void DoubleTransformBase::copyFromBin(BinaryDataHandler &pMem,
239 ConstFieldMaskArg whichField)
241 Inherited::copyFromBin(pMem, whichField);
243 if(FieldBits::NoField != (MatrixFieldMask & whichField))
245 editSField(MatrixFieldMask);
246 _sfMatrix.copyFromBin(pMem);
250 //! create a new instance of the class
251 DoubleTransformTransitPtr DoubleTransformBase::createLocal(BitVector bFlags)
253 DoubleTransformTransitPtr fc;
255 if(getClassType().getPrototype() != NULL)
257 FieldContainerTransitPtr tmpPtr =
258 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
260 fc = dynamic_pointer_cast<DoubleTransform>(tmpPtr);
263 return fc;
266 //! create a new instance of the class, copy the container flags
267 DoubleTransformTransitPtr DoubleTransformBase::createDependent(BitVector bFlags)
269 DoubleTransformTransitPtr fc;
271 if(getClassType().getPrototype() != NULL)
273 FieldContainerTransitPtr tmpPtr =
274 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
276 fc = dynamic_pointer_cast<DoubleTransform>(tmpPtr);
279 return fc;
282 //! create a new instance of the class
283 DoubleTransformTransitPtr DoubleTransformBase::create(void)
285 DoubleTransformTransitPtr fc;
287 if(getClassType().getPrototype() != NULL)
289 FieldContainerTransitPtr tmpPtr =
290 getClassType().getPrototype()-> shallowCopy();
292 fc = dynamic_pointer_cast<DoubleTransform>(tmpPtr);
295 return fc;
298 DoubleTransform *DoubleTransformBase::createEmptyLocal(BitVector bFlags)
300 DoubleTransform *returnValue;
302 newPtr<DoubleTransform>(returnValue, bFlags);
304 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
306 return returnValue;
309 //! create an empty new instance of the class, do not copy the prototype
310 DoubleTransform *DoubleTransformBase::createEmpty(void)
312 DoubleTransform *returnValue;
314 newPtr<DoubleTransform>(returnValue, Thread::getCurrentLocalFlags());
316 returnValue->_pFieldFlags->_bNamespaceMask &=
317 ~Thread::getCurrentLocalFlags();
319 return returnValue;
323 FieldContainerTransitPtr DoubleTransformBase::shallowCopyLocal(
324 BitVector bFlags) const
326 DoubleTransform *tmpPtr;
328 newPtr(tmpPtr, dynamic_cast<const DoubleTransform *>(this), bFlags);
330 FieldContainerTransitPtr returnValue(tmpPtr);
332 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
334 return returnValue;
337 FieldContainerTransitPtr DoubleTransformBase::shallowCopyDependent(
338 BitVector bFlags) const
340 DoubleTransform *tmpPtr;
342 newPtr(tmpPtr, dynamic_cast<const DoubleTransform *>(this), ~bFlags);
344 FieldContainerTransitPtr returnValue(tmpPtr);
346 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
348 return returnValue;
351 FieldContainerTransitPtr DoubleTransformBase::shallowCopy(void) const
353 DoubleTransform *tmpPtr;
355 newPtr(tmpPtr,
356 dynamic_cast<const DoubleTransform *>(this),
357 Thread::getCurrentLocalFlags());
359 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
361 FieldContainerTransitPtr returnValue(tmpPtr);
363 return returnValue;
369 /*------------------------- constructors ----------------------------------*/
371 DoubleTransformBase::DoubleTransformBase(void) :
372 Inherited(),
373 _sfMatrix ()
377 DoubleTransformBase::DoubleTransformBase(const DoubleTransformBase &source) :
378 Inherited(source),
379 _sfMatrix (source._sfMatrix )
384 /*-------------------------- destructors ----------------------------------*/
386 DoubleTransformBase::~DoubleTransformBase(void)
391 GetFieldHandlePtr DoubleTransformBase::getHandleMatrix (void) const
393 SFMatrix4d::GetHandlePtr returnValue(
394 new SFMatrix4d::GetHandle(
395 &_sfMatrix,
396 this->getType().getFieldDesc(MatrixFieldId),
397 const_cast<DoubleTransformBase *>(this)));
399 return returnValue;
402 EditFieldHandlePtr DoubleTransformBase::editHandleMatrix (void)
404 SFMatrix4d::EditHandlePtr returnValue(
405 new SFMatrix4d::EditHandle(
406 &_sfMatrix,
407 this->getType().getFieldDesc(MatrixFieldId),
408 this));
411 editSField(MatrixFieldMask);
413 return returnValue;
417 #ifdef OSG_MT_CPTR_ASPECT
418 void DoubleTransformBase::execSyncV( FieldContainer &oFrom,
419 ConstFieldMaskArg whichField,
420 AspectOffsetStore &oOffsets,
421 ConstFieldMaskArg syncMode,
422 const UInt32 uiSyncInfo)
424 DoubleTransform *pThis = static_cast<DoubleTransform *>(this);
426 pThis->execSync(static_cast<DoubleTransform *>(&oFrom),
427 whichField,
428 oOffsets,
429 syncMode,
430 uiSyncInfo);
432 #endif
435 #ifdef OSG_MT_CPTR_ASPECT
436 FieldContainer *DoubleTransformBase::createAspectCopy(
437 const FieldContainer *pRefAspect) const
439 DoubleTransform *returnValue;
441 newAspectCopy(returnValue,
442 dynamic_cast<const DoubleTransform *>(pRefAspect),
443 dynamic_cast<const DoubleTransform *>(this));
445 return returnValue;
447 #endif
449 void DoubleTransformBase::resolveLinks(void)
451 Inherited::resolveLinks();
457 OSG_END_NAMESPACE