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 CallbackAlgorithmForeground!
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 "OSGCallbackAlgorithm.h" // CallbackAlgorithm Class
67 #include "OSGCallbackAlgorithmForegroundBase.h"
68 #include "OSGCallbackAlgorithmForeground.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::CallbackAlgorithmForeground
79 The CallbackAlgorithmForeground provides a callback for rendering arbitrary stuff.
81 This foreground was created in order to conveniently use the AntTweakBar GUI
82 library together with OpenSG. The example tonemapping uses the forground for this purpose.
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var CallbackAlgorithm * CallbackAlgorithmForegroundBase::_sfCallbackAlgorithm
90 A CallbackAlgorithm object that is executed on drawing of the forground.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits
<CallbackAlgorithmForeground
*, nsOSG
>::_type(
100 "CallbackAlgorithmForegroundPtr",
102 CallbackAlgorithmForeground::getClassType(),
106 OSG_FIELDTRAITS_GETTYPE_NS(CallbackAlgorithmForeground
*, nsOSG
)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
109 CallbackAlgorithmForeground
*,
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
113 CallbackAlgorithmForeground
*,
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void CallbackAlgorithmForegroundBase::classDescInserter(TypeObject
&oType
)
122 FieldDescriptionBase
*pDesc
= NULL
;
125 pDesc
= new SFUnrecCallbackAlgorithmPtr::Description(
126 SFUnrecCallbackAlgorithmPtr::getClassType(),
128 "A CallbackAlgorithm object that is executed on drawing of the forground.\n",
129 CallbackAlgorithmFieldId
, CallbackAlgorithmFieldMask
,
131 (Field::SFDefaultFlags
| Field::FStdAccess
),
132 static_cast<FieldEditMethodSig
>(&CallbackAlgorithmForeground::editHandleCallbackAlgorithm
),
133 static_cast<FieldGetMethodSig
>(&CallbackAlgorithmForeground::getHandleCallbackAlgorithm
));
135 oType
.addInitialDesc(pDesc
);
139 CallbackAlgorithmForegroundBase::TypeObject
CallbackAlgorithmForegroundBase::_type(
140 CallbackAlgorithmForegroundBase::getClassname(),
141 Inherited::getClassname(),
144 reinterpret_cast<PrototypeCreateF
>(&CallbackAlgorithmForegroundBase::createEmptyLocal
),
145 reinterpret_cast<InitContainerF
>(&CallbackAlgorithmForeground::initMethod
),
146 reinterpret_cast<ExitContainerF
>(&CallbackAlgorithmForeground::exitMethod
),
147 reinterpret_cast<InitalInsertDescFunc
>(
148 reinterpret_cast<void *>(&CallbackAlgorithmForeground::classDescInserter
)),
151 "<?xml version=\"1.0\"?>\n"
154 " name=\"CallbackAlgorithmForeground\"\n"
155 " parent=\"Foreground\"\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 " useLocalIncludes=\"false\"\n"
163 " docGroupBase=\"GrpWindowForeground\"\n"
165 " The CallbackAlgorithmForeground provides a callback for rendering arbitrary stuff.\n"
167 " This foreground was created in order to conveniently use the AntTweakBar GUI\n"
168 " library together with OpenSG. The example tonemapping uses the forground for this purpose.\n"
170 "\t name=\"callbackAlgorithm\"\n"
171 "\t type=\"CallbackAlgorithm\"\n"
172 "\t cardinality=\"single\"\n"
173 "\t visibility=\"external\"\n"
174 "\t defaultValue=\"NULL\"\n"
175 "\t access=\"public\"\n"
176 " category=\"pointer\"\n"
178 "\tA CallbackAlgorithm object that is executed on drawing of the forground.\n"
180 "</FieldContainer>\n",
181 "The CallbackAlgorithmForeground provides a callback for rendering arbitrary stuff.\n"
183 "This foreground was created in order to conveniently use the AntTweakBar GUI\n"
184 "library together with OpenSG. The example tonemapping uses the forground for this purpose.\n"
187 /*------------------------------ get -----------------------------------*/
189 FieldContainerType
&CallbackAlgorithmForegroundBase::getType(void)
194 const FieldContainerType
&CallbackAlgorithmForegroundBase::getType(void) const
199 UInt32
CallbackAlgorithmForegroundBase::getContainerSize(void) const
201 return sizeof(CallbackAlgorithmForeground
);
204 /*------------------------- decorator get ------------------------------*/
207 //! Get the CallbackAlgorithmForeground::_sfCallbackAlgorithm field.
208 const SFUnrecCallbackAlgorithmPtr
*CallbackAlgorithmForegroundBase::getSFCallbackAlgorithm(void) const
210 return &_sfCallbackAlgorithm
;
213 SFUnrecCallbackAlgorithmPtr
*CallbackAlgorithmForegroundBase::editSFCallbackAlgorithm(void)
215 editSField(CallbackAlgorithmFieldMask
);
217 return &_sfCallbackAlgorithm
;
220 //! Get the value of the CallbackAlgorithmForeground::_sfCallbackAlgorithm field.
221 CallbackAlgorithm
* CallbackAlgorithmForegroundBase::getCallbackAlgorithm(void) const
223 return _sfCallbackAlgorithm
.getValue();
226 //! Set the value of the CallbackAlgorithmForeground::_sfCallbackAlgorithm field.
227 void CallbackAlgorithmForegroundBase::setCallbackAlgorithm(CallbackAlgorithm
* const value
)
229 editSField(CallbackAlgorithmFieldMask
);
231 _sfCallbackAlgorithm
.setValue(value
);
239 /*------------------------------ access -----------------------------------*/
241 SizeT
CallbackAlgorithmForegroundBase::getBinSize(ConstFieldMaskArg whichField
)
243 SizeT returnValue
= Inherited::getBinSize(whichField
);
245 if(FieldBits::NoField
!= (CallbackAlgorithmFieldMask
& whichField
))
247 returnValue
+= _sfCallbackAlgorithm
.getBinSize();
253 void CallbackAlgorithmForegroundBase::copyToBin(BinaryDataHandler
&pMem
,
254 ConstFieldMaskArg whichField
)
256 Inherited::copyToBin(pMem
, whichField
);
258 if(FieldBits::NoField
!= (CallbackAlgorithmFieldMask
& whichField
))
260 _sfCallbackAlgorithm
.copyToBin(pMem
);
264 void CallbackAlgorithmForegroundBase::copyFromBin(BinaryDataHandler
&pMem
,
265 ConstFieldMaskArg whichField
)
267 Inherited::copyFromBin(pMem
, whichField
);
269 if(FieldBits::NoField
!= (CallbackAlgorithmFieldMask
& whichField
))
271 editSField(CallbackAlgorithmFieldMask
);
272 _sfCallbackAlgorithm
.copyFromBin(pMem
);
276 //! create a new instance of the class
277 CallbackAlgorithmForegroundTransitPtr
CallbackAlgorithmForegroundBase::createLocal(BitVector bFlags
)
279 CallbackAlgorithmForegroundTransitPtr fc
;
281 if(getClassType().getPrototype() != NULL
)
283 FieldContainerTransitPtr tmpPtr
=
284 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
286 fc
= dynamic_pointer_cast
<CallbackAlgorithmForeground
>(tmpPtr
);
292 //! create a new instance of the class, copy the container flags
293 CallbackAlgorithmForegroundTransitPtr
CallbackAlgorithmForegroundBase::createDependent(BitVector bFlags
)
295 CallbackAlgorithmForegroundTransitPtr fc
;
297 if(getClassType().getPrototype() != NULL
)
299 FieldContainerTransitPtr tmpPtr
=
300 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
302 fc
= dynamic_pointer_cast
<CallbackAlgorithmForeground
>(tmpPtr
);
308 //! create a new instance of the class
309 CallbackAlgorithmForegroundTransitPtr
CallbackAlgorithmForegroundBase::create(void)
311 CallbackAlgorithmForegroundTransitPtr fc
;
313 if(getClassType().getPrototype() != NULL
)
315 FieldContainerTransitPtr tmpPtr
=
316 getClassType().getPrototype()-> shallowCopy();
318 fc
= dynamic_pointer_cast
<CallbackAlgorithmForeground
>(tmpPtr
);
324 CallbackAlgorithmForeground
*CallbackAlgorithmForegroundBase::createEmptyLocal(BitVector bFlags
)
326 CallbackAlgorithmForeground
*returnValue
;
328 newPtr
<CallbackAlgorithmForeground
>(returnValue
, bFlags
);
330 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
335 //! create an empty new instance of the class, do not copy the prototype
336 CallbackAlgorithmForeground
*CallbackAlgorithmForegroundBase::createEmpty(void)
338 CallbackAlgorithmForeground
*returnValue
;
340 newPtr
<CallbackAlgorithmForeground
>(returnValue
, Thread::getCurrentLocalFlags());
342 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
343 ~Thread::getCurrentLocalFlags();
349 FieldContainerTransitPtr
CallbackAlgorithmForegroundBase::shallowCopyLocal(
350 BitVector bFlags
) const
352 CallbackAlgorithmForeground
*tmpPtr
;
354 newPtr(tmpPtr
, dynamic_cast<const CallbackAlgorithmForeground
*>(this), bFlags
);
356 FieldContainerTransitPtr
returnValue(tmpPtr
);
358 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
363 FieldContainerTransitPtr
CallbackAlgorithmForegroundBase::shallowCopyDependent(
364 BitVector bFlags
) const
366 CallbackAlgorithmForeground
*tmpPtr
;
368 newPtr(tmpPtr
, dynamic_cast<const CallbackAlgorithmForeground
*>(this), ~bFlags
);
370 FieldContainerTransitPtr
returnValue(tmpPtr
);
372 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
377 FieldContainerTransitPtr
CallbackAlgorithmForegroundBase::shallowCopy(void) const
379 CallbackAlgorithmForeground
*tmpPtr
;
382 dynamic_cast<const CallbackAlgorithmForeground
*>(this),
383 Thread::getCurrentLocalFlags());
385 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
387 FieldContainerTransitPtr
returnValue(tmpPtr
);
395 /*------------------------- constructors ----------------------------------*/
397 CallbackAlgorithmForegroundBase::CallbackAlgorithmForegroundBase(void) :
399 _sfCallbackAlgorithm (NULL
)
403 CallbackAlgorithmForegroundBase::CallbackAlgorithmForegroundBase(const CallbackAlgorithmForegroundBase
&source
) :
405 _sfCallbackAlgorithm (NULL
)
410 /*-------------------------- destructors ----------------------------------*/
412 CallbackAlgorithmForegroundBase::~CallbackAlgorithmForegroundBase(void)
416 void CallbackAlgorithmForegroundBase::onCreate(const CallbackAlgorithmForeground
*source
)
418 Inherited::onCreate(source
);
422 CallbackAlgorithmForeground
*pThis
= static_cast<CallbackAlgorithmForeground
*>(this);
424 pThis
->setCallbackAlgorithm(source
->getCallbackAlgorithm());
428 GetFieldHandlePtr
CallbackAlgorithmForegroundBase::getHandleCallbackAlgorithm (void) const
430 SFUnrecCallbackAlgorithmPtr::GetHandlePtr
returnValue(
431 new SFUnrecCallbackAlgorithmPtr::GetHandle(
432 &_sfCallbackAlgorithm
,
433 this->getType().getFieldDesc(CallbackAlgorithmFieldId
),
434 const_cast<CallbackAlgorithmForegroundBase
*>(this)));
439 EditFieldHandlePtr
CallbackAlgorithmForegroundBase::editHandleCallbackAlgorithm(void)
441 SFUnrecCallbackAlgorithmPtr::EditHandlePtr
returnValue(
442 new SFUnrecCallbackAlgorithmPtr::EditHandle(
443 &_sfCallbackAlgorithm
,
444 this->getType().getFieldDesc(CallbackAlgorithmFieldId
),
447 returnValue
->setSetMethod(
448 boost::bind(&CallbackAlgorithmForeground::setCallbackAlgorithm
,
449 static_cast<CallbackAlgorithmForeground
*>(this), _1
));
451 editSField(CallbackAlgorithmFieldMask
);
457 #ifdef OSG_MT_CPTR_ASPECT
458 void CallbackAlgorithmForegroundBase::execSyncV( FieldContainer
&oFrom
,
459 ConstFieldMaskArg whichField
,
460 AspectOffsetStore
&oOffsets
,
461 ConstFieldMaskArg syncMode
,
462 const UInt32 uiSyncInfo
)
464 CallbackAlgorithmForeground
*pThis
= static_cast<CallbackAlgorithmForeground
*>(this);
466 pThis
->execSync(static_cast<CallbackAlgorithmForeground
*>(&oFrom
),
475 #ifdef OSG_MT_CPTR_ASPECT
476 FieldContainer
*CallbackAlgorithmForegroundBase::createAspectCopy(
477 const FieldContainer
*pRefAspect
) const
479 CallbackAlgorithmForeground
*returnValue
;
481 newAspectCopy(returnValue
,
482 dynamic_cast<const CallbackAlgorithmForeground
*>(pRefAspect
),
483 dynamic_cast<const CallbackAlgorithmForeground
*>(this));
489 void CallbackAlgorithmForegroundBase::resolveLinks(void)
491 Inherited::resolveLinks();
493 static_cast<CallbackAlgorithmForeground
*>(this)->setCallbackAlgorithm(NULL
);