fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComplexSceneManager / Sensor / InterfaceSensors / OSGMouseDataInterfaceSensorBase.cpp
blobf4919ad824677db95bc1598108f7558e83430bac
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 MouseDataInterfaceSensor!
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 "OSGMouseDataInterfaceSensorBase.h"
67 #include "OSGMouseDataInterfaceSensor.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::MouseDataInterfaceSensor
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var MouseData MouseDataInterfaceSensorBase::_sfMouseData
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<MouseDataInterfaceSensor *, nsOSG>::_type(
96 "MouseDataInterfaceSensorPtr",
97 "DeviceInterfaceSensorPtr",
98 MouseDataInterfaceSensor::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(MouseDataInterfaceSensor *, nsOSG)
104 /***************************************************************************\
105 * Field Description *
106 \***************************************************************************/
108 void MouseDataInterfaceSensorBase::classDescInserter(TypeObject &oType)
110 FieldDescriptionBase *pDesc = NULL;
113 pDesc = new SFMouseData::Description(
114 SFMouseData::getClassType(),
115 "mouseData",
117 MouseDataFieldId, MouseDataFieldMask,
118 true,
119 (Field::SFDefaultFlags | Field::FStdAccess),
120 static_cast<FieldEditMethodSig>(&MouseDataInterfaceSensor::editHandleMouseData),
121 static_cast<FieldGetMethodSig >(&MouseDataInterfaceSensor::getHandleMouseData));
123 oType.addInitialDesc(pDesc);
127 MouseDataInterfaceSensorBase::TypeObject MouseDataInterfaceSensorBase::_type(
128 MouseDataInterfaceSensorBase::getClassname(),
129 Inherited::getClassname(),
130 "NULL",
131 nsOSG, //Namespace
132 reinterpret_cast<PrototypeCreateF>(&MouseDataInterfaceSensorBase::createEmptyLocal),
133 reinterpret_cast<InitContainerF>(&MouseDataInterfaceSensor::initMethod),
134 reinterpret_cast<ExitContainerF>(&MouseDataInterfaceSensor::exitMethod),
135 reinterpret_cast<InitalInsertDescFunc>(
136 reinterpret_cast<void *>(&MouseDataInterfaceSensor::classDescInserter)),
137 false,
139 "<?xml version=\"1.0\"?>\n"
140 "\n"
141 "<FieldContainer\n"
142 " name=\"MouseDataInterfaceSensor\"\n"
143 " parent=\"DeviceInterfaceSensor\"\n"
144 " library=\"ContribCSM\"\n"
145 " pointerfieldtypes=\"none\"\n"
146 " structure=\"concrete\"\n"
147 " systemcomponent=\"true\"\n"
148 " parentsystemcomponent=\"true\"\n"
149 " decoratable=\"false\"\n"
150 " useLocalIncludes=\"false\"\n"
151 " isNodeCore=\"false\"\n"
152 " isBundle=\"false\"\n"
153 " parentFields=\"none\"\n"
154 ">\n"
155 "\t<Field\n"
156 "\t\tname=\"mouseData\"\n"
157 "\t\ttype=\"MouseData\"\n"
158 "\t\tcardinality=\"single\"\n"
159 "\t\tvisibility=\"internal\"\n"
160 "\t\taccess=\"public\"\n"
161 "\t>\n"
162 "\t</Field>\n"
163 "</FieldContainer>\n",
167 /*------------------------------ get -----------------------------------*/
169 FieldContainerType &MouseDataInterfaceSensorBase::getType(void)
171 return _type;
174 const FieldContainerType &MouseDataInterfaceSensorBase::getType(void) const
176 return _type;
179 UInt32 MouseDataInterfaceSensorBase::getContainerSize(void) const
181 return sizeof(MouseDataInterfaceSensor);
184 /*------------------------- decorator get ------------------------------*/
187 SFMouseData *MouseDataInterfaceSensorBase::editSFMouseData(void)
189 editSField(MouseDataFieldMask);
191 return &_sfMouseData;
194 const SFMouseData *MouseDataInterfaceSensorBase::getSFMouseData(void) const
196 return &_sfMouseData;
204 /*------------------------------ access -----------------------------------*/
206 SizeT MouseDataInterfaceSensorBase::getBinSize(ConstFieldMaskArg whichField)
208 SizeT returnValue = Inherited::getBinSize(whichField);
210 if(FieldBits::NoField != (MouseDataFieldMask & whichField))
212 returnValue += _sfMouseData.getBinSize();
215 return returnValue;
218 void MouseDataInterfaceSensorBase::copyToBin(BinaryDataHandler &pMem,
219 ConstFieldMaskArg whichField)
221 Inherited::copyToBin(pMem, whichField);
223 if(FieldBits::NoField != (MouseDataFieldMask & whichField))
225 _sfMouseData.copyToBin(pMem);
229 void MouseDataInterfaceSensorBase::copyFromBin(BinaryDataHandler &pMem,
230 ConstFieldMaskArg whichField)
232 Inherited::copyFromBin(pMem, whichField);
234 if(FieldBits::NoField != (MouseDataFieldMask & whichField))
236 editSField(MouseDataFieldMask);
237 _sfMouseData.copyFromBin(pMem);
241 //! create a new instance of the class
242 MouseDataInterfaceSensorTransitPtr MouseDataInterfaceSensorBase::createLocal(BitVector bFlags)
244 MouseDataInterfaceSensorTransitPtr fc;
246 if(getClassType().getPrototype() != NULL)
248 FieldContainerTransitPtr tmpPtr =
249 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
251 fc = dynamic_pointer_cast<MouseDataInterfaceSensor>(tmpPtr);
254 return fc;
257 //! create a new instance of the class, copy the container flags
258 MouseDataInterfaceSensorTransitPtr MouseDataInterfaceSensorBase::createDependent(BitVector bFlags)
260 MouseDataInterfaceSensorTransitPtr fc;
262 if(getClassType().getPrototype() != NULL)
264 FieldContainerTransitPtr tmpPtr =
265 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
267 fc = dynamic_pointer_cast<MouseDataInterfaceSensor>(tmpPtr);
270 return fc;
273 //! create a new instance of the class
274 MouseDataInterfaceSensorTransitPtr MouseDataInterfaceSensorBase::create(void)
276 MouseDataInterfaceSensorTransitPtr fc;
278 if(getClassType().getPrototype() != NULL)
280 FieldContainerTransitPtr tmpPtr =
281 getClassType().getPrototype()-> shallowCopy();
283 fc = dynamic_pointer_cast<MouseDataInterfaceSensor>(tmpPtr);
286 return fc;
289 MouseDataInterfaceSensor *MouseDataInterfaceSensorBase::createEmptyLocal(BitVector bFlags)
291 MouseDataInterfaceSensor *returnValue;
293 newPtr<MouseDataInterfaceSensor>(returnValue, bFlags);
295 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
297 return returnValue;
300 //! create an empty new instance of the class, do not copy the prototype
301 MouseDataInterfaceSensor *MouseDataInterfaceSensorBase::createEmpty(void)
303 MouseDataInterfaceSensor *returnValue;
305 newPtr<MouseDataInterfaceSensor>(returnValue, Thread::getCurrentLocalFlags());
307 returnValue->_pFieldFlags->_bNamespaceMask &=
308 ~Thread::getCurrentLocalFlags();
310 return returnValue;
314 FieldContainerTransitPtr MouseDataInterfaceSensorBase::shallowCopyLocal(
315 BitVector bFlags) const
317 MouseDataInterfaceSensor *tmpPtr;
319 newPtr(tmpPtr, dynamic_cast<const MouseDataInterfaceSensor *>(this), bFlags);
321 FieldContainerTransitPtr returnValue(tmpPtr);
323 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
325 return returnValue;
328 FieldContainerTransitPtr MouseDataInterfaceSensorBase::shallowCopyDependent(
329 BitVector bFlags) const
331 MouseDataInterfaceSensor *tmpPtr;
333 newPtr(tmpPtr, dynamic_cast<const MouseDataInterfaceSensor *>(this), ~bFlags);
335 FieldContainerTransitPtr returnValue(tmpPtr);
337 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
339 return returnValue;
342 FieldContainerTransitPtr MouseDataInterfaceSensorBase::shallowCopy(void) const
344 MouseDataInterfaceSensor *tmpPtr;
346 newPtr(tmpPtr,
347 dynamic_cast<const MouseDataInterfaceSensor *>(this),
348 Thread::getCurrentLocalFlags());
350 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
352 FieldContainerTransitPtr returnValue(tmpPtr);
354 return returnValue;
360 /*------------------------- constructors ----------------------------------*/
362 MouseDataInterfaceSensorBase::MouseDataInterfaceSensorBase(void) :
363 Inherited(),
364 _sfMouseData ()
368 MouseDataInterfaceSensorBase::MouseDataInterfaceSensorBase(const MouseDataInterfaceSensorBase &source) :
369 Inherited(source),
370 _sfMouseData (source._sfMouseData )
375 /*-------------------------- destructors ----------------------------------*/
377 MouseDataInterfaceSensorBase::~MouseDataInterfaceSensorBase(void)
382 GetFieldHandlePtr MouseDataInterfaceSensorBase::getHandleMouseData (void) const
384 SFMouseData::GetHandlePtr returnValue(
385 new SFMouseData::GetHandle(
386 &_sfMouseData,
387 this->getType().getFieldDesc(MouseDataFieldId),
388 const_cast<MouseDataInterfaceSensorBase *>(this)));
390 return returnValue;
393 EditFieldHandlePtr MouseDataInterfaceSensorBase::editHandleMouseData (void)
395 SFMouseData::EditHandlePtr returnValue(
396 new SFMouseData::EditHandle(
397 &_sfMouseData,
398 this->getType().getFieldDesc(MouseDataFieldId),
399 this));
402 editSField(MouseDataFieldMask);
404 return returnValue;
408 #ifdef OSG_MT_CPTR_ASPECT
409 void MouseDataInterfaceSensorBase::execSyncV( FieldContainer &oFrom,
410 ConstFieldMaskArg whichField,
411 AspectOffsetStore &oOffsets,
412 ConstFieldMaskArg syncMode,
413 const UInt32 uiSyncInfo)
415 MouseDataInterfaceSensor *pThis = static_cast<MouseDataInterfaceSensor *>(this);
417 pThis->execSync(static_cast<MouseDataInterfaceSensor *>(&oFrom),
418 whichField,
419 oOffsets,
420 syncMode,
421 uiSyncInfo);
423 #endif
426 #ifdef OSG_MT_CPTR_ASPECT
427 FieldContainer *MouseDataInterfaceSensorBase::createAspectCopy(
428 const FieldContainer *pRefAspect) const
430 MouseDataInterfaceSensor *returnValue;
432 newAspectCopy(returnValue,
433 dynamic_cast<const MouseDataInterfaceSensor *>(pRefAspect),
434 dynamic_cast<const MouseDataInterfaceSensor *>(this));
436 return returnValue;
438 #endif
440 void MouseDataInterfaceSensorBase::resolveLinks(void)
442 Inherited::resolveLinks();
448 OSG_END_NAMESPACE