changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGTransformBase.cpp
blobd2b8780b1c0f0c57ea539e71537045e0093cf21a
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 Transform!
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 "OSGTransformBase.h"
67 #include "OSGTransform.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::Transform
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 Matrix TransformBase::_sfMatrix
87 The transformation matrix.
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits<Transform *, nsOSG>::_type(
97 "TransformPtr",
98 "GroupPtr",
99 Transform::getClassType(),
100 nsOSG);
101 #endif
103 OSG_FIELDTRAITS_GETTYPE_NS(Transform *, nsOSG)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
106 Transform *,
107 nsOSG)
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
110 Transform *,
111 nsOSG)
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void TransformBase::classDescInserter(TypeObject &oType)
119 FieldDescriptionBase *pDesc = NULL;
122 pDesc = new SFMatrix::Description(
123 SFMatrix::getClassType(),
124 "matrix",
125 "The transformation matrix.\n",
126 MatrixFieldId, MatrixFieldMask,
127 false,
128 (Field::SFDefaultFlags | Field::FStdAccess),
129 static_cast<FieldEditMethodSig>(&Transform::editHandleMatrix),
130 static_cast<FieldGetMethodSig >(&Transform::getHandleMatrix));
132 oType.addInitialDesc(pDesc);
136 TransformBase::TypeObject TransformBase::_type(
137 TransformBase::getClassname(),
138 Inherited::getClassname(),
139 "NULL",
140 nsOSG, //Namespace
141 reinterpret_cast<PrototypeCreateF>(&TransformBase::createEmptyLocal),
142 reinterpret_cast<InitContainerF>(&Transform::initMethod),
143 reinterpret_cast<ExitContainerF>(&Transform::exitMethod),
144 reinterpret_cast<InitalInsertDescFunc>(
145 reinterpret_cast<void *>(&Transform::classDescInserter)),
146 false,
148 "<?xml version=\"1.0\" ?>\n"
149 "\n"
150 "<FieldContainer\n"
151 " name=\"Transform\"\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=\"Matrix\"\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 &TransformBase::getType(void)
180 return _type;
183 const FieldContainerType &TransformBase::getType(void) const
185 return _type;
188 UInt32 TransformBase::getContainerSize(void) const
190 return sizeof(Transform);
193 /*------------------------- decorator get ------------------------------*/
196 SFMatrix *TransformBase::editSFMatrix(void)
198 editSField(MatrixFieldMask);
200 return &_sfMatrix;
203 const SFMatrix *TransformBase::getSFMatrix(void) const
205 return &_sfMatrix;
213 /*------------------------------ access -----------------------------------*/
215 SizeT TransformBase::getBinSize(ConstFieldMaskArg whichField)
217 SizeT returnValue = Inherited::getBinSize(whichField);
219 if(FieldBits::NoField != (MatrixFieldMask & whichField))
221 returnValue += _sfMatrix.getBinSize();
224 return returnValue;
227 void TransformBase::copyToBin(BinaryDataHandler &pMem,
228 ConstFieldMaskArg whichField)
230 Inherited::copyToBin(pMem, whichField);
232 if(FieldBits::NoField != (MatrixFieldMask & whichField))
234 _sfMatrix.copyToBin(pMem);
238 void TransformBase::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 TransformTransitPtr TransformBase::createLocal(BitVector bFlags)
253 TransformTransitPtr fc;
255 if(getClassType().getPrototype() != NULL)
257 FieldContainerTransitPtr tmpPtr =
258 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
260 fc = dynamic_pointer_cast<Transform>(tmpPtr);
263 return fc;
266 //! create a new instance of the class, copy the container flags
267 TransformTransitPtr TransformBase::createDependent(BitVector bFlags)
269 TransformTransitPtr fc;
271 if(getClassType().getPrototype() != NULL)
273 FieldContainerTransitPtr tmpPtr =
274 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
276 fc = dynamic_pointer_cast<Transform>(tmpPtr);
279 return fc;
282 //! create a new instance of the class
283 TransformTransitPtr TransformBase::create(void)
285 TransformTransitPtr fc;
287 if(getClassType().getPrototype() != NULL)
289 FieldContainerTransitPtr tmpPtr =
290 getClassType().getPrototype()-> shallowCopy();
292 fc = dynamic_pointer_cast<Transform>(tmpPtr);
295 return fc;
298 Transform *TransformBase::createEmptyLocal(BitVector bFlags)
300 Transform *returnValue;
302 newPtr<Transform>(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 Transform *TransformBase::createEmpty(void)
312 Transform *returnValue;
314 newPtr<Transform>(returnValue, Thread::getCurrentLocalFlags());
316 returnValue->_pFieldFlags->_bNamespaceMask &=
317 ~Thread::getCurrentLocalFlags();
319 return returnValue;
323 FieldContainerTransitPtr TransformBase::shallowCopyLocal(
324 BitVector bFlags) const
326 Transform *tmpPtr;
328 newPtr(tmpPtr, dynamic_cast<const Transform *>(this), bFlags);
330 FieldContainerTransitPtr returnValue(tmpPtr);
332 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
334 return returnValue;
337 FieldContainerTransitPtr TransformBase::shallowCopyDependent(
338 BitVector bFlags) const
340 Transform *tmpPtr;
342 newPtr(tmpPtr, dynamic_cast<const Transform *>(this), ~bFlags);
344 FieldContainerTransitPtr returnValue(tmpPtr);
346 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
348 return returnValue;
351 FieldContainerTransitPtr TransformBase::shallowCopy(void) const
353 Transform *tmpPtr;
355 newPtr(tmpPtr,
356 dynamic_cast<const Transform *>(this),
357 Thread::getCurrentLocalFlags());
359 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
361 FieldContainerTransitPtr returnValue(tmpPtr);
363 return returnValue;
369 /*------------------------- constructors ----------------------------------*/
371 TransformBase::TransformBase(void) :
372 Inherited(),
373 _sfMatrix ()
377 TransformBase::TransformBase(const TransformBase &source) :
378 Inherited(source),
379 _sfMatrix (source._sfMatrix )
384 /*-------------------------- destructors ----------------------------------*/
386 TransformBase::~TransformBase(void)
391 GetFieldHandlePtr TransformBase::getHandleMatrix (void) const
393 SFMatrix::GetHandlePtr returnValue(
394 new SFMatrix::GetHandle(
395 &_sfMatrix,
396 this->getType().getFieldDesc(MatrixFieldId),
397 const_cast<TransformBase *>(this)));
399 return returnValue;
402 EditFieldHandlePtr TransformBase::editHandleMatrix (void)
404 SFMatrix::EditHandlePtr returnValue(
405 new SFMatrix::EditHandle(
406 &_sfMatrix,
407 this->getType().getFieldDesc(MatrixFieldId),
408 this));
411 editSField(MatrixFieldMask);
413 return returnValue;
417 #ifdef OSG_MT_CPTR_ASPECT
418 void TransformBase::execSyncV( FieldContainer &oFrom,
419 ConstFieldMaskArg whichField,
420 AspectOffsetStore &oOffsets,
421 ConstFieldMaskArg syncMode,
422 const UInt32 uiSyncInfo)
424 Transform *pThis = static_cast<Transform *>(this);
426 pThis->execSync(static_cast<Transform *>(&oFrom),
427 whichField,
428 oOffsets,
429 syncMode,
430 uiSyncInfo);
432 #endif
435 #ifdef OSG_MT_CPTR_ASPECT
436 FieldContainer *TransformBase::createAspectCopy(
437 const FieldContainer *pRefAspect) const
439 Transform *returnValue;
441 newAspectCopy(returnValue,
442 dynamic_cast<const Transform *>(pRefAspect),
443 dynamic_cast<const Transform *>(this));
445 return returnValue;
447 #endif
449 void TransformBase::resolveLinks(void)
451 Inherited::resolveLinks();
457 OSG_END_NAMESPACE