1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class DeviceInterfaceSensor!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGInterfaceOptions.h" // Options Class
67 #include "OSGDeviceInterfaceSensorBase.h"
68 #include "OSGDeviceInterfaceSensor.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::DeviceInterfaceSensor
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var std::string DeviceInterfaceSensorBase::_sfInterfaceName
90 /*! \var InterfaceOptions * DeviceInterfaceSensorBase::_sfOptions
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits
<DeviceInterfaceSensor
*, nsOSG
>::_type(
101 "DeviceInterfaceSensorPtr",
103 DeviceInterfaceSensor::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(DeviceInterfaceSensor
*, nsOSG
)
109 DataType
&FieldTraits
<DeviceInterfaceSensor
*, nsOSG
+ 1 >::getType(void)
111 return FieldTraits
<DeviceInterfaceSensor
*, nsOSG
>::getType();
115 OSG_SFIELDTYPE_INST(ParentPointerSField
,
116 DeviceInterfaceSensor
*,
120 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField
,
121 DeviceInterfaceSensor
*,
126 /***************************************************************************\
127 * Field Description *
128 \***************************************************************************/
130 void DeviceInterfaceSensorBase::classDescInserter(TypeObject
&oType
)
132 Inherited::classDescInserter(oType
);
134 FieldDescriptionBase
*pDesc
= NULL
;
137 pDesc
= new SFString::Description(
138 SFString::getClassType(),
141 InterfaceNameFieldId
, InterfaceNameFieldMask
,
143 (Field::FStdAccess
| Field::FThreadLocal
),
144 static_cast<FieldEditMethodSig
>(&DeviceInterfaceSensor::editHandleInterfaceName
),
145 static_cast<FieldGetMethodSig
>(&DeviceInterfaceSensor::getHandleInterfaceName
));
147 oType
.addInitialDesc(pDesc
);
149 pDesc
= new SFUnrecChildInterfaceOptionsPtr::Description(
150 SFUnrecChildInterfaceOptionsPtr::getClassType(),
153 OptionsFieldId
, OptionsFieldMask
,
155 (Field::SFDefaultFlags
| Field::FStdAccess
),
156 static_cast<FieldEditMethodSig
>(&DeviceInterfaceSensor::editHandleOptions
),
157 static_cast<FieldGetMethodSig
>(&DeviceInterfaceSensor::getHandleOptions
));
159 oType
.addInitialDesc(pDesc
);
163 DeviceInterfaceSensorBase::TypeObject
DeviceInterfaceSensorBase::_type(
164 DeviceInterfaceSensorBase::getClassname(),
165 Inherited::getClassname(),
169 reinterpret_cast<InitContainerF
>(&DeviceInterfaceSensor::initMethod
),
170 reinterpret_cast<ExitContainerF
>(&DeviceInterfaceSensor::exitMethod
),
171 reinterpret_cast<InitalInsertDescFunc
>(
172 reinterpret_cast<void *>(&DeviceInterfaceSensor::classDescInserter
)),
175 "<?xml version=\"1.0\"?>\n"
178 " name=\"DeviceInterfaceSensor\"\n"
179 " parent=\"NodeCore\"\n"
180 " mixinparent=\"NodeCoreSensorParent\"\n"
181 " library=\"ContribCSM\"\n"
182 " pointerfieldtypes=\"none\"\n"
183 " structure=\"abstract\"\n"
184 " systemcomponent=\"true\"\n"
185 " parentsystemcomponent=\"true\"\n"
186 " decoratable=\"false\"\n"
187 " useLocalIncludes=\"false\"\n"
188 " isNodeCore=\"false\"\n"
189 " isBundle=\"false\"\n"
190 " parentFields=\"single\"\n"
193 " name=\"interfaceName\"\n"
194 " type=\"std::string\"\n"
195 " cardinality=\"single\"\n"
196 " visibility=\"internal\"\n"
197 " access=\"public\"\n"
198 " defaultValue=\"\"\n"
199 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
203 " name=\"options\"\n"
204 " type=\"InterfaceOptions\"\n"
205 " cardinality=\"single\"\n"
206 " visibility=\"external\"\n"
207 " access=\"public\"\n"
208 " category=\"childpointer\"\n"
209 " childParentType=\"DeviceInterfaceSensor\"\n"
210 " linkParentField=\"Parent\"\n"
213 "</FieldContainer>\n",
217 /*------------------------------ get -----------------------------------*/
219 FieldContainerType
&DeviceInterfaceSensorBase::getType(void)
224 const FieldContainerType
&DeviceInterfaceSensorBase::getType(void) const
229 UInt32
DeviceInterfaceSensorBase::getContainerSize(void) const
231 return sizeof(DeviceInterfaceSensor
);
234 /*------------------------- decorator get ------------------------------*/
237 SFString
*DeviceInterfaceSensorBase::editSFInterfaceName(void)
239 editSField(InterfaceNameFieldMask
);
241 return &_sfInterfaceName
;
244 const SFString
*DeviceInterfaceSensorBase::getSFInterfaceName(void) const
246 return &_sfInterfaceName
;
250 //! Get the DeviceInterfaceSensor::_sfOptions field.
251 const SFUnrecChildInterfaceOptionsPtr
*DeviceInterfaceSensorBase::getSFOptions(void) const
256 SFUnrecChildInterfaceOptionsPtr
*DeviceInterfaceSensorBase::editSFOptions (void)
258 editSField(OptionsFieldMask
);
263 //! Get the value of the DeviceInterfaceSensor::_sfOptions field.
264 InterfaceOptions
* DeviceInterfaceSensorBase::getOptions(void) const
266 return _sfOptions
.getValue();
269 //! Set the value of the DeviceInterfaceSensor::_sfOptions field.
270 void DeviceInterfaceSensorBase::setOptions(InterfaceOptions
* const value
)
272 editSField(OptionsFieldMask
);
274 _sfOptions
.setValue(value
);
282 /*------------------------------ access -----------------------------------*/
284 SizeT
DeviceInterfaceSensorBase::getBinSize(ConstFieldMaskArg whichField
)
286 SizeT returnValue
= Inherited::getBinSize(whichField
);
288 if(FieldBits::NoField
!= (InterfaceNameFieldMask
& whichField
))
290 returnValue
+= _sfInterfaceName
.getBinSize();
292 if(FieldBits::NoField
!= (OptionsFieldMask
& whichField
))
294 returnValue
+= _sfOptions
.getBinSize();
300 void DeviceInterfaceSensorBase::copyToBin(BinaryDataHandler
&pMem
,
301 ConstFieldMaskArg whichField
)
303 Inherited::copyToBin(pMem
, whichField
);
305 if(FieldBits::NoField
!= (InterfaceNameFieldMask
& whichField
))
307 _sfInterfaceName
.copyToBin(pMem
);
309 if(FieldBits::NoField
!= (OptionsFieldMask
& whichField
))
311 _sfOptions
.copyToBin(pMem
);
315 void DeviceInterfaceSensorBase::copyFromBin(BinaryDataHandler
&pMem
,
316 ConstFieldMaskArg whichField
)
318 Inherited::copyFromBin(pMem
, whichField
);
320 if(FieldBits::NoField
!= (InterfaceNameFieldMask
& whichField
))
322 editSField(InterfaceNameFieldMask
);
323 _sfInterfaceName
.copyFromBin(pMem
);
325 if(FieldBits::NoField
!= (OptionsFieldMask
& whichField
))
327 editSField(OptionsFieldMask
);
328 _sfOptions
.copyFromBin(pMem
);
335 /*------------------------- constructors ----------------------------------*/
337 DeviceInterfaceSensorBase::DeviceInterfaceSensorBase(void) :
342 InterfaceOptions::ParentFieldId
)
346 DeviceInterfaceSensorBase::DeviceInterfaceSensorBase(const DeviceInterfaceSensorBase
&source
) :
348 _sfInterfaceName (source
._sfInterfaceName
),
351 InterfaceOptions::ParentFieldId
)
356 /*-------------------------- destructors ----------------------------------*/
358 DeviceInterfaceSensorBase::~DeviceInterfaceSensorBase(void)
362 /*-------------------------------------------------------------------------*/
365 bool DeviceInterfaceSensorBase::unlinkChild(
366 FieldContainer
* const pChild
,
367 UInt16
const childFieldId
)
369 if(childFieldId
== OptionsFieldId
)
371 InterfaceOptions
* pTypedChild
=
372 dynamic_cast<InterfaceOptions
*>(pChild
);
374 if(pTypedChild
!= NULL
)
376 if(_sfOptions
.getValue() == pTypedChild
)
378 editSField(OptionsFieldMask
);
380 _sfOptions
.setValue(NULL
);
385 SWARNING
<< "Parent ([" << this
386 << "] id [" << this->getId()
387 << "] type [" << this->getType().getCName()
388 << "] childFieldId [" << childFieldId
389 << "]) - Child ([" << pChild
390 << "] id [" << pChild
->getId()
391 << "] type [" << pChild
->getType().getCName()
392 << "]): link inconsistent!"
402 return Inherited::unlinkChild(pChild
, childFieldId
);
405 void DeviceInterfaceSensorBase::onCreate(const DeviceInterfaceSensor
*source
)
407 Inherited::onCreate(source
);
411 DeviceInterfaceSensor
*pThis
= static_cast<DeviceInterfaceSensor
*>(this);
413 pThis
->setOptions(source
->getOptions());
417 GetFieldHandlePtr
DeviceInterfaceSensorBase::getHandleInterfaceName (void) const
419 SFString::GetHandlePtr
returnValue(
420 new SFString::GetHandle(
422 this->getType().getFieldDesc(InterfaceNameFieldId
),
423 const_cast<DeviceInterfaceSensorBase
*>(this)));
428 EditFieldHandlePtr
DeviceInterfaceSensorBase::editHandleInterfaceName (void)
430 SFString::EditHandlePtr
returnValue(
431 new SFString::EditHandle(
433 this->getType().getFieldDesc(InterfaceNameFieldId
),
437 editSField(InterfaceNameFieldMask
);
442 GetFieldHandlePtr
DeviceInterfaceSensorBase::getHandleOptions (void) const
444 SFUnrecChildInterfaceOptionsPtr::GetHandlePtr
returnValue(
445 new SFUnrecChildInterfaceOptionsPtr::GetHandle(
447 this->getType().getFieldDesc(OptionsFieldId
),
448 const_cast<DeviceInterfaceSensorBase
*>(this)));
453 EditFieldHandlePtr
DeviceInterfaceSensorBase::editHandleOptions (void)
455 SFUnrecChildInterfaceOptionsPtr::EditHandlePtr
returnValue(
456 new SFUnrecChildInterfaceOptionsPtr::EditHandle(
458 this->getType().getFieldDesc(OptionsFieldId
),
461 returnValue
->setSetMethod(
462 boost::bind(&DeviceInterfaceSensor::setOptions
,
463 static_cast<DeviceInterfaceSensor
*>(this), _1
));
465 editSField(OptionsFieldMask
);
471 #ifdef OSG_MT_CPTR_ASPECT
472 void DeviceInterfaceSensorBase::execSyncV( FieldContainer
&oFrom
,
473 ConstFieldMaskArg whichField
,
474 AspectOffsetStore
&oOffsets
,
475 ConstFieldMaskArg syncMode
,
476 const UInt32 uiSyncInfo
)
478 DeviceInterfaceSensor
*pThis
= static_cast<DeviceInterfaceSensor
*>(this);
480 pThis
->execSync(static_cast<DeviceInterfaceSensor
*>(&oFrom
),
490 void DeviceInterfaceSensorBase::resolveLinks(void)
492 Inherited::resolveLinks();
494 static_cast<DeviceInterfaceSensor
*>(this)->setOptions(NULL
);