fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Window / Camera / OSGHeadTrackedStereoCameraDecoratorBase.cpp
blob95d0060163d98aff0ee60857189704a51140a16c
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 HeadTrackedStereoCameraDecorator!
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" // User Class
67 #include "OSGHeadTrackedStereoCameraDecoratorBase.h"
68 #include "OSGHeadTrackedStereoCameraDecorator.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::HeadTrackedStereoCameraDecorator
79 The decorator for tracked stereo projections (e.g. HMD's), see \ref
80 PageSystemWindowCameraDecoratorsStereoProjection for a description.
82 The parameters are defined by the _sfUser field.
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var Node * HeadTrackedStereoCameraDecoratorBase::_sfUser
90 The coordinate system relative to the camera.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<HeadTrackedStereoCameraDecorator *, nsOSG>::_type(
100 "HeadTrackedStereoCameraDecoratorPtr",
101 "StereoCameraDecoratorPtr",
102 HeadTrackedStereoCameraDecorator::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(HeadTrackedStereoCameraDecorator *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 HeadTrackedStereoCameraDecorator *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 HeadTrackedStereoCameraDecorator *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void HeadTrackedStereoCameraDecoratorBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFUnrecNodePtr::Description(
126 SFUnrecNodePtr::getClassType(),
127 "user",
128 "The coordinate system relative to the camera.\n",
129 UserFieldId, UserFieldMask,
130 false,
131 (Field::SFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&HeadTrackedStereoCameraDecorator::editHandleUser),
133 static_cast<FieldGetMethodSig >(&HeadTrackedStereoCameraDecorator::getHandleUser));
135 oType.addInitialDesc(pDesc);
139 HeadTrackedStereoCameraDecoratorBase::TypeObject HeadTrackedStereoCameraDecoratorBase::_type(
140 HeadTrackedStereoCameraDecoratorBase::getClassname(),
141 Inherited::getClassname(),
142 "NULL",
143 nsOSG, //Namespace
144 reinterpret_cast<PrototypeCreateF>(&HeadTrackedStereoCameraDecoratorBase::createEmptyLocal),
145 reinterpret_cast<InitContainerF>(&HeadTrackedStereoCameraDecorator::initMethod),
146 reinterpret_cast<ExitContainerF>(&HeadTrackedStereoCameraDecorator::exitMethod),
147 reinterpret_cast<InitalInsertDescFunc>(
148 reinterpret_cast<void *>(&HeadTrackedStereoCameraDecorator::classDescInserter)),
149 false,
151 "<?xml version=\"1.0\"?>\n"
152 "\n"
153 "<FieldContainer\n"
154 " name=\"HeadTrackedStereoCameraDecorator\"\n"
155 " parent=\"StereoCameraDecorator\"\n"
156 " library=\"Window\"\n"
157 " pointerfieldtypes=\"both\"\n"
158 " structure=\"concrete\"\n"
159 " systemcomponent=\"true\"\n"
160 " parentsystemcomponent=\"true\"\n"
161 " decoratable=\"false\"\n"
162 " docGroupBase=\"GrpWindowCamera\"\n"
163 " >\n"
164 " The decorator for tracked stereo projections (e.g. HMD's), see \\ref\n"
165 " PageSystemWindowCameraDecoratorsStereoProjection for a description.\n"
166 "\n"
167 " The parameters are defined by the _sfUser field.\n"
168 "\n"
169 " <Field\n"
170 "\t name=\"user\"\n"
171 "\t type=\"NodePtr\"\n"
172 "\t cardinality=\"single\"\n"
173 "\t visibility=\"external\"\n"
174 "\t access=\"public\"\n"
175 "\t >\n"
176 "\tThe coordinate system relative to the camera.\n"
177 " </Field>\n"
178 "</FieldContainer>\n",
179 "The decorator for tracked stereo projections (e.g. HMD's), see \\ref\n"
180 "PageSystemWindowCameraDecoratorsStereoProjection for a description.\n"
181 "\n"
182 "The parameters are defined by the _sfUser field.\n"
185 /*------------------------------ get -----------------------------------*/
187 FieldContainerType &HeadTrackedStereoCameraDecoratorBase::getType(void)
189 return _type;
192 const FieldContainerType &HeadTrackedStereoCameraDecoratorBase::getType(void) const
194 return _type;
197 UInt32 HeadTrackedStereoCameraDecoratorBase::getContainerSize(void) const
199 return sizeof(HeadTrackedStereoCameraDecorator);
202 /*------------------------- decorator get ------------------------------*/
205 //! Get the HeadTrackedStereoCameraDecorator::_sfUser field.
206 const SFUnrecNodePtr *HeadTrackedStereoCameraDecoratorBase::getSFUser(void) const
208 return &_sfUser;
211 SFUnrecNodePtr *HeadTrackedStereoCameraDecoratorBase::editSFUser (void)
213 editSField(UserFieldMask);
215 return &_sfUser;
218 //! Get the value of the HeadTrackedStereoCameraDecorator::_sfUser field.
219 Node * HeadTrackedStereoCameraDecoratorBase::getUser(void) const
221 return _sfUser.getValue();
224 //! Set the value of the HeadTrackedStereoCameraDecorator::_sfUser field.
225 void HeadTrackedStereoCameraDecoratorBase::setUser(Node * const value)
227 editSField(UserFieldMask);
229 _sfUser.setValue(value);
237 /*------------------------------ access -----------------------------------*/
239 SizeT HeadTrackedStereoCameraDecoratorBase::getBinSize(ConstFieldMaskArg whichField)
241 SizeT returnValue = Inherited::getBinSize(whichField);
243 if(FieldBits::NoField != (UserFieldMask & whichField))
245 returnValue += _sfUser.getBinSize();
248 return returnValue;
251 void HeadTrackedStereoCameraDecoratorBase::copyToBin(BinaryDataHandler &pMem,
252 ConstFieldMaskArg whichField)
254 Inherited::copyToBin(pMem, whichField);
256 if(FieldBits::NoField != (UserFieldMask & whichField))
258 _sfUser.copyToBin(pMem);
262 void HeadTrackedStereoCameraDecoratorBase::copyFromBin(BinaryDataHandler &pMem,
263 ConstFieldMaskArg whichField)
265 Inherited::copyFromBin(pMem, whichField);
267 if(FieldBits::NoField != (UserFieldMask & whichField))
269 editSField(UserFieldMask);
270 _sfUser.copyFromBin(pMem);
274 //! create a new instance of the class
275 HeadTrackedStereoCameraDecoratorTransitPtr HeadTrackedStereoCameraDecoratorBase::createLocal(BitVector bFlags)
277 HeadTrackedStereoCameraDecoratorTransitPtr fc;
279 if(getClassType().getPrototype() != NULL)
281 FieldContainerTransitPtr tmpPtr =
282 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
284 fc = dynamic_pointer_cast<HeadTrackedStereoCameraDecorator>(tmpPtr);
287 return fc;
290 //! create a new instance of the class, copy the container flags
291 HeadTrackedStereoCameraDecoratorTransitPtr HeadTrackedStereoCameraDecoratorBase::createDependent(BitVector bFlags)
293 HeadTrackedStereoCameraDecoratorTransitPtr fc;
295 if(getClassType().getPrototype() != NULL)
297 FieldContainerTransitPtr tmpPtr =
298 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
300 fc = dynamic_pointer_cast<HeadTrackedStereoCameraDecorator>(tmpPtr);
303 return fc;
306 //! create a new instance of the class
307 HeadTrackedStereoCameraDecoratorTransitPtr HeadTrackedStereoCameraDecoratorBase::create(void)
309 HeadTrackedStereoCameraDecoratorTransitPtr fc;
311 if(getClassType().getPrototype() != NULL)
313 FieldContainerTransitPtr tmpPtr =
314 getClassType().getPrototype()-> shallowCopy();
316 fc = dynamic_pointer_cast<HeadTrackedStereoCameraDecorator>(tmpPtr);
319 return fc;
322 HeadTrackedStereoCameraDecorator *HeadTrackedStereoCameraDecoratorBase::createEmptyLocal(BitVector bFlags)
324 HeadTrackedStereoCameraDecorator *returnValue;
326 newPtr<HeadTrackedStereoCameraDecorator>(returnValue, bFlags);
328 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
330 return returnValue;
333 //! create an empty new instance of the class, do not copy the prototype
334 HeadTrackedStereoCameraDecorator *HeadTrackedStereoCameraDecoratorBase::createEmpty(void)
336 HeadTrackedStereoCameraDecorator *returnValue;
338 newPtr<HeadTrackedStereoCameraDecorator>(returnValue, Thread::getCurrentLocalFlags());
340 returnValue->_pFieldFlags->_bNamespaceMask &=
341 ~Thread::getCurrentLocalFlags();
343 return returnValue;
347 FieldContainerTransitPtr HeadTrackedStereoCameraDecoratorBase::shallowCopyLocal(
348 BitVector bFlags) const
350 HeadTrackedStereoCameraDecorator *tmpPtr;
352 newPtr(tmpPtr, dynamic_cast<const HeadTrackedStereoCameraDecorator *>(this), bFlags);
354 FieldContainerTransitPtr returnValue(tmpPtr);
356 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
358 return returnValue;
361 FieldContainerTransitPtr HeadTrackedStereoCameraDecoratorBase::shallowCopyDependent(
362 BitVector bFlags) const
364 HeadTrackedStereoCameraDecorator *tmpPtr;
366 newPtr(tmpPtr, dynamic_cast<const HeadTrackedStereoCameraDecorator *>(this), ~bFlags);
368 FieldContainerTransitPtr returnValue(tmpPtr);
370 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
372 return returnValue;
375 FieldContainerTransitPtr HeadTrackedStereoCameraDecoratorBase::shallowCopy(void) const
377 HeadTrackedStereoCameraDecorator *tmpPtr;
379 newPtr(tmpPtr,
380 dynamic_cast<const HeadTrackedStereoCameraDecorator *>(this),
381 Thread::getCurrentLocalFlags());
383 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
385 FieldContainerTransitPtr returnValue(tmpPtr);
387 return returnValue;
393 /*------------------------- constructors ----------------------------------*/
395 HeadTrackedStereoCameraDecoratorBase::HeadTrackedStereoCameraDecoratorBase(void) :
396 Inherited(),
397 _sfUser (NULL)
401 HeadTrackedStereoCameraDecoratorBase::HeadTrackedStereoCameraDecoratorBase(const HeadTrackedStereoCameraDecoratorBase &source) :
402 Inherited(source),
403 _sfUser (NULL)
408 /*-------------------------- destructors ----------------------------------*/
410 HeadTrackedStereoCameraDecoratorBase::~HeadTrackedStereoCameraDecoratorBase(void)
414 void HeadTrackedStereoCameraDecoratorBase::onCreate(const HeadTrackedStereoCameraDecorator *source)
416 Inherited::onCreate(source);
418 if(source != NULL)
420 HeadTrackedStereoCameraDecorator *pThis = static_cast<HeadTrackedStereoCameraDecorator *>(this);
422 pThis->setUser(source->getUser());
426 GetFieldHandlePtr HeadTrackedStereoCameraDecoratorBase::getHandleUser (void) const
428 SFUnrecNodePtr::GetHandlePtr returnValue(
429 new SFUnrecNodePtr::GetHandle(
430 &_sfUser,
431 this->getType().getFieldDesc(UserFieldId),
432 const_cast<HeadTrackedStereoCameraDecoratorBase *>(this)));
434 return returnValue;
437 EditFieldHandlePtr HeadTrackedStereoCameraDecoratorBase::editHandleUser (void)
439 SFUnrecNodePtr::EditHandlePtr returnValue(
440 new SFUnrecNodePtr::EditHandle(
441 &_sfUser,
442 this->getType().getFieldDesc(UserFieldId),
443 this));
445 returnValue->setSetMethod(
446 boost::bind(&HeadTrackedStereoCameraDecorator::setUser,
447 static_cast<HeadTrackedStereoCameraDecorator *>(this), _1));
449 editSField(UserFieldMask);
451 return returnValue;
455 #ifdef OSG_MT_CPTR_ASPECT
456 void HeadTrackedStereoCameraDecoratorBase::execSyncV( FieldContainer &oFrom,
457 ConstFieldMaskArg whichField,
458 AspectOffsetStore &oOffsets,
459 ConstFieldMaskArg syncMode,
460 const UInt32 uiSyncInfo)
462 HeadTrackedStereoCameraDecorator *pThis = static_cast<HeadTrackedStereoCameraDecorator *>(this);
464 pThis->execSync(static_cast<HeadTrackedStereoCameraDecorator *>(&oFrom),
465 whichField,
466 oOffsets,
467 syncMode,
468 uiSyncInfo);
470 #endif
473 #ifdef OSG_MT_CPTR_ASPECT
474 FieldContainer *HeadTrackedStereoCameraDecoratorBase::createAspectCopy(
475 const FieldContainer *pRefAspect) const
477 HeadTrackedStereoCameraDecorator *returnValue;
479 newAspectCopy(returnValue,
480 dynamic_cast<const HeadTrackedStereoCameraDecorator *>(pRefAspect),
481 dynamic_cast<const HeadTrackedStereoCameraDecorator *>(this));
483 return returnValue;
485 #endif
487 void HeadTrackedStereoCameraDecoratorBase::resolveLinks(void)
489 Inherited::resolveLinks();
491 static_cast<HeadTrackedStereoCameraDecorator *>(this)->setUser(NULL);
497 OSG_END_NAMESPACE