changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGReplicateTransformBase.cpp
bloba0854db1f23cc834c85f8043fbec9607e6d88636
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 ReplicateTransform!
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"
65 #include "OSGNode.h" // Target Class
67 #include "OSGReplicateTransformBase.h"
68 #include "OSGReplicateTransform.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::ReplicateTransform
79 This core replicates the to world transformation of the target node attached
80 to it. This means that when this core accumulates it's transform with it's
81 parent, that it overwrites it instead of multiplying with it.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var Node * ReplicateTransformBase::_sfTarget
89 The target node. The to world transformation will be replicated by this
90 core.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<ReplicateTransform *, nsOSG>::_type(
100 "ReplicateTransformPtr",
101 "GroupPtr",
102 ReplicateTransform::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(ReplicateTransform *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 ReplicateTransform *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 ReplicateTransform *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void ReplicateTransformBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFUnrecNodePtr::Description(
126 SFUnrecNodePtr::getClassType(),
127 "Target",
128 "The target node. The to world transformation will be replicated by this\n"
129 "core. \n",
130 TargetFieldId, TargetFieldMask,
131 false,
132 (Field::SFDefaultFlags | Field::FStdAccess),
133 static_cast<FieldEditMethodSig>(&ReplicateTransform::editHandleTarget),
134 static_cast<FieldGetMethodSig >(&ReplicateTransform::getHandleTarget));
136 oType.addInitialDesc(pDesc);
140 ReplicateTransformBase::TypeObject ReplicateTransformBase::_type(
141 ReplicateTransformBase::getClassname(),
142 Inherited::getClassname(),
143 "NULL",
144 nsOSG, //Namespace
145 reinterpret_cast<PrototypeCreateF>(&ReplicateTransformBase::createEmptyLocal),
146 reinterpret_cast<InitContainerF>(&ReplicateTransform::initMethod),
147 reinterpret_cast<ExitContainerF>(&ReplicateTransform::exitMethod),
148 reinterpret_cast<InitalInsertDescFunc>(
149 reinterpret_cast<void *>(&ReplicateTransform::classDescInserter)),
150 false,
152 "<?xml version=\"1.0\" ?>\n"
153 "\n"
154 "<FieldContainer\n"
155 " name=\"ReplicateTransform\"\n"
156 " parent=\"Group\"\n"
157 " library=\"Group\"\n"
158 " structure=\"concrete\"\n"
159 " pointerfieldtypes=\"both\"\n"
160 " systemcomponent=\"true\"\n"
161 " parentsystemcomponent=\"true\"\n"
162 " isNodeCore=\"true\"\n"
163 " >\n"
164 " This core replicates the to world transformation of the target node attached\n"
165 " to it. This means that when this core accumulates it's transform with it's\n"
166 " parent, that it overwrites it instead of multiplying with it.\n"
167 " <Field\n"
168 " name=\"Target\"\n"
169 " type=\"Node\"\n"
170 " category=\"pointer\"\n"
171 " cardinality=\"single\"\n"
172 " visibility=\"external\"\n"
173 " >\n"
174 " The target node. The to world transformation will be replicated by this\n"
175 " core. \n"
176 " </Field>\n"
177 "</FieldContainer>\n",
178 "This core replicates the to world transformation of the target node attached\n"
179 "to it. This means that when this core accumulates it's transform with it's\n"
180 "parent, that it overwrites it instead of multiplying with it.\n"
183 /*------------------------------ get -----------------------------------*/
185 FieldContainerType &ReplicateTransformBase::getType(void)
187 return _type;
190 const FieldContainerType &ReplicateTransformBase::getType(void) const
192 return _type;
195 UInt32 ReplicateTransformBase::getContainerSize(void) const
197 return sizeof(ReplicateTransform);
200 /*------------------------- decorator get ------------------------------*/
203 //! Get the ReplicateTransform::_sfTarget field.
204 const SFUnrecNodePtr *ReplicateTransformBase::getSFTarget(void) const
206 return &_sfTarget;
209 SFUnrecNodePtr *ReplicateTransformBase::editSFTarget (void)
211 editSField(TargetFieldMask);
213 return &_sfTarget;
216 //! Get the value of the ReplicateTransform::_sfTarget field.
217 Node * ReplicateTransformBase::getTarget(void) const
219 return _sfTarget.getValue();
222 //! Set the value of the ReplicateTransform::_sfTarget field.
223 void ReplicateTransformBase::setTarget(Node * const value)
225 editSField(TargetFieldMask);
227 _sfTarget.setValue(value);
235 /*------------------------------ access -----------------------------------*/
237 SizeT ReplicateTransformBase::getBinSize(ConstFieldMaskArg whichField)
239 SizeT returnValue = Inherited::getBinSize(whichField);
241 if(FieldBits::NoField != (TargetFieldMask & whichField))
243 returnValue += _sfTarget.getBinSize();
246 return returnValue;
249 void ReplicateTransformBase::copyToBin(BinaryDataHandler &pMem,
250 ConstFieldMaskArg whichField)
252 Inherited::copyToBin(pMem, whichField);
254 if(FieldBits::NoField != (TargetFieldMask & whichField))
256 _sfTarget.copyToBin(pMem);
260 void ReplicateTransformBase::copyFromBin(BinaryDataHandler &pMem,
261 ConstFieldMaskArg whichField)
263 Inherited::copyFromBin(pMem, whichField);
265 if(FieldBits::NoField != (TargetFieldMask & whichField))
267 editSField(TargetFieldMask);
268 _sfTarget.copyFromBin(pMem);
272 //! create a new instance of the class
273 ReplicateTransformTransitPtr ReplicateTransformBase::createLocal(BitVector bFlags)
275 ReplicateTransformTransitPtr fc;
277 if(getClassType().getPrototype() != NULL)
279 FieldContainerTransitPtr tmpPtr =
280 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
282 fc = dynamic_pointer_cast<ReplicateTransform>(tmpPtr);
285 return fc;
288 //! create a new instance of the class, copy the container flags
289 ReplicateTransformTransitPtr ReplicateTransformBase::createDependent(BitVector bFlags)
291 ReplicateTransformTransitPtr fc;
293 if(getClassType().getPrototype() != NULL)
295 FieldContainerTransitPtr tmpPtr =
296 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
298 fc = dynamic_pointer_cast<ReplicateTransform>(tmpPtr);
301 return fc;
304 //! create a new instance of the class
305 ReplicateTransformTransitPtr ReplicateTransformBase::create(void)
307 ReplicateTransformTransitPtr fc;
309 if(getClassType().getPrototype() != NULL)
311 FieldContainerTransitPtr tmpPtr =
312 getClassType().getPrototype()-> shallowCopy();
314 fc = dynamic_pointer_cast<ReplicateTransform>(tmpPtr);
317 return fc;
320 ReplicateTransform *ReplicateTransformBase::createEmptyLocal(BitVector bFlags)
322 ReplicateTransform *returnValue;
324 newPtr<ReplicateTransform>(returnValue, bFlags);
326 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
328 return returnValue;
331 //! create an empty new instance of the class, do not copy the prototype
332 ReplicateTransform *ReplicateTransformBase::createEmpty(void)
334 ReplicateTransform *returnValue;
336 newPtr<ReplicateTransform>(returnValue, Thread::getCurrentLocalFlags());
338 returnValue->_pFieldFlags->_bNamespaceMask &=
339 ~Thread::getCurrentLocalFlags();
341 return returnValue;
345 FieldContainerTransitPtr ReplicateTransformBase::shallowCopyLocal(
346 BitVector bFlags) const
348 ReplicateTransform *tmpPtr;
350 newPtr(tmpPtr, dynamic_cast<const ReplicateTransform *>(this), bFlags);
352 FieldContainerTransitPtr returnValue(tmpPtr);
354 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
356 return returnValue;
359 FieldContainerTransitPtr ReplicateTransformBase::shallowCopyDependent(
360 BitVector bFlags) const
362 ReplicateTransform *tmpPtr;
364 newPtr(tmpPtr, dynamic_cast<const ReplicateTransform *>(this), ~bFlags);
366 FieldContainerTransitPtr returnValue(tmpPtr);
368 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
370 return returnValue;
373 FieldContainerTransitPtr ReplicateTransformBase::shallowCopy(void) const
375 ReplicateTransform *tmpPtr;
377 newPtr(tmpPtr,
378 dynamic_cast<const ReplicateTransform *>(this),
379 Thread::getCurrentLocalFlags());
381 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
383 FieldContainerTransitPtr returnValue(tmpPtr);
385 return returnValue;
391 /*------------------------- constructors ----------------------------------*/
393 ReplicateTransformBase::ReplicateTransformBase(void) :
394 Inherited(),
395 _sfTarget (NULL)
399 ReplicateTransformBase::ReplicateTransformBase(const ReplicateTransformBase &source) :
400 Inherited(source),
401 _sfTarget (NULL)
406 /*-------------------------- destructors ----------------------------------*/
408 ReplicateTransformBase::~ReplicateTransformBase(void)
412 void ReplicateTransformBase::onCreate(const ReplicateTransform *source)
414 Inherited::onCreate(source);
416 if(source != NULL)
418 ReplicateTransform *pThis = static_cast<ReplicateTransform *>(this);
420 pThis->setTarget(source->getTarget());
424 GetFieldHandlePtr ReplicateTransformBase::getHandleTarget (void) const
426 SFUnrecNodePtr::GetHandlePtr returnValue(
427 new SFUnrecNodePtr::GetHandle(
428 &_sfTarget,
429 this->getType().getFieldDesc(TargetFieldId),
430 const_cast<ReplicateTransformBase *>(this)));
432 return returnValue;
435 EditFieldHandlePtr ReplicateTransformBase::editHandleTarget (void)
437 SFUnrecNodePtr::EditHandlePtr returnValue(
438 new SFUnrecNodePtr::EditHandle(
439 &_sfTarget,
440 this->getType().getFieldDesc(TargetFieldId),
441 this));
443 returnValue->setSetMethod(
444 boost::bind(&ReplicateTransform::setTarget,
445 static_cast<ReplicateTransform *>(this), _1));
447 editSField(TargetFieldMask);
449 return returnValue;
453 #ifdef OSG_MT_CPTR_ASPECT
454 void ReplicateTransformBase::execSyncV( FieldContainer &oFrom,
455 ConstFieldMaskArg whichField,
456 AspectOffsetStore &oOffsets,
457 ConstFieldMaskArg syncMode,
458 const UInt32 uiSyncInfo)
460 ReplicateTransform *pThis = static_cast<ReplicateTransform *>(this);
462 pThis->execSync(static_cast<ReplicateTransform *>(&oFrom),
463 whichField,
464 oOffsets,
465 syncMode,
466 uiSyncInfo);
468 #endif
471 #ifdef OSG_MT_CPTR_ASPECT
472 FieldContainer *ReplicateTransformBase::createAspectCopy(
473 const FieldContainer *pRefAspect) const
475 ReplicateTransform *returnValue;
477 newAspectCopy(returnValue,
478 dynamic_cast<const ReplicateTransform *>(pRefAspect),
479 dynamic_cast<const ReplicateTransform *>(this));
481 return returnValue;
483 #endif
485 void ReplicateTransformBase::resolveLinks(void)
487 Inherited::resolveLinks();
489 static_cast<ReplicateTransform *>(this)->setTarget(NULL);
495 OSG_END_NAMESPACE