changed: gcc8 base update
[opensg.git] / Source / System / Window / Background / OSGFBOBackgroundBase.cpp
blob47a4ee97ff8e1a37613dacc7ba3aa5b231cf3b05
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 FBOBackground!
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 "OSGFrameBufferObject.h" // FrameBufferObject Class
67 #include "OSGFBOBackgroundBase.h"
68 #include "OSGFBOBackground.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::FBOBackground
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var FrameBufferObject * FBOBackgroundBase::_sfFrameBufferObject
87 The FramebufferObject to clear from.
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits<FBOBackground *, nsOSG>::_type(
97 "FBOBackgroundPtr",
98 "BackgroundPtr",
99 FBOBackground::getClassType(),
100 nsOSG);
101 #endif
103 OSG_FIELDTRAITS_GETTYPE_NS(FBOBackground *, nsOSG)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
106 FBOBackground *,
107 nsOSG)
110 /***************************************************************************\
111 * Field Description *
112 \***************************************************************************/
114 void FBOBackgroundBase::classDescInserter(TypeObject &oType)
116 FieldDescriptionBase *pDesc = NULL;
119 pDesc = new SFUnrecFrameBufferObjectPtr::Description(
120 SFUnrecFrameBufferObjectPtr::getClassType(),
121 "frameBufferObject",
122 "The FramebufferObject to clear from.\n",
123 FrameBufferObjectFieldId, FrameBufferObjectFieldMask,
124 false,
125 (Field::SFDefaultFlags | Field::FStdAccess),
126 static_cast<FieldEditMethodSig>(&FBOBackground::editHandleFrameBufferObject),
127 static_cast<FieldGetMethodSig >(&FBOBackground::getHandleFrameBufferObject));
129 oType.addInitialDesc(pDesc);
133 FBOBackgroundBase::TypeObject FBOBackgroundBase::_type(
134 FBOBackgroundBase::getClassname(),
135 Inherited::getClassname(),
136 "NULL",
137 nsOSG, //Namespace
138 reinterpret_cast<PrototypeCreateF>(&FBOBackgroundBase::createEmptyLocal),
139 reinterpret_cast<InitContainerF>(&FBOBackground::initMethod),
140 reinterpret_cast<ExitContainerF>(&FBOBackground::exitMethod),
141 reinterpret_cast<InitalInsertDescFunc>(
142 reinterpret_cast<void *>(&FBOBackground::classDescInserter)),
143 false,
145 "<?xml version=\"1.0\" ?>\n"
146 "\n"
147 "<FieldContainer\n"
148 " name=\"FBOBackground\"\n"
149 " parent=\"Background\"\n"
150 " library=\"Window\"\n"
151 " structure=\"concrete\"\n"
152 " pointerfieldtypes=\"single\"\n"
153 " systemcomponent=\"true\"\n"
154 " parentsystemcomponent=\"true\"\n"
155 " docGroupBase=\"GrpWindowPassive\"\n"
156 " >\n"
157 " <Field\n"
158 "\t name=\"frameBufferObject\"\n"
159 "\t type=\"FrameBufferObjectPtr\"\n"
160 "\t cardinality=\"single\"\n"
161 "\t visibility=\"external\"\n"
162 "\t access=\"public\"\n"
163 "\t >\n"
164 " The FramebufferObject to clear from.\n"
165 " </Field>\n"
166 "</FieldContainer>\n",
170 /*------------------------------ get -----------------------------------*/
172 FieldContainerType &FBOBackgroundBase::getType(void)
174 return _type;
177 const FieldContainerType &FBOBackgroundBase::getType(void) const
179 return _type;
182 UInt32 FBOBackgroundBase::getContainerSize(void) const
184 return sizeof(FBOBackground);
187 /*------------------------- decorator get ------------------------------*/
190 //! Get the FBOBackground::_sfFrameBufferObject field.
191 const SFUnrecFrameBufferObjectPtr *FBOBackgroundBase::getSFFrameBufferObject(void) const
193 return &_sfFrameBufferObject;
196 SFUnrecFrameBufferObjectPtr *FBOBackgroundBase::editSFFrameBufferObject(void)
198 editSField(FrameBufferObjectFieldMask);
200 return &_sfFrameBufferObject;
203 //! Get the value of the FBOBackground::_sfFrameBufferObject field.
204 FrameBufferObject * FBOBackgroundBase::getFrameBufferObject(void) const
206 return _sfFrameBufferObject.getValue();
209 //! Set the value of the FBOBackground::_sfFrameBufferObject field.
210 void FBOBackgroundBase::setFrameBufferObject(FrameBufferObject * const value)
212 editSField(FrameBufferObjectFieldMask);
214 _sfFrameBufferObject.setValue(value);
222 /*------------------------------ access -----------------------------------*/
224 SizeT FBOBackgroundBase::getBinSize(ConstFieldMaskArg whichField)
226 SizeT returnValue = Inherited::getBinSize(whichField);
228 if(FieldBits::NoField != (FrameBufferObjectFieldMask & whichField))
230 returnValue += _sfFrameBufferObject.getBinSize();
233 return returnValue;
236 void FBOBackgroundBase::copyToBin(BinaryDataHandler &pMem,
237 ConstFieldMaskArg whichField)
239 Inherited::copyToBin(pMem, whichField);
241 if(FieldBits::NoField != (FrameBufferObjectFieldMask & whichField))
243 _sfFrameBufferObject.copyToBin(pMem);
247 void FBOBackgroundBase::copyFromBin(BinaryDataHandler &pMem,
248 ConstFieldMaskArg whichField)
250 Inherited::copyFromBin(pMem, whichField);
252 if(FieldBits::NoField != (FrameBufferObjectFieldMask & whichField))
254 editSField(FrameBufferObjectFieldMask);
255 _sfFrameBufferObject.copyFromBin(pMem);
259 //! create a new instance of the class
260 FBOBackgroundTransitPtr FBOBackgroundBase::createLocal(BitVector bFlags)
262 FBOBackgroundTransitPtr fc;
264 if(getClassType().getPrototype() != NULL)
266 FieldContainerTransitPtr tmpPtr =
267 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
269 fc = dynamic_pointer_cast<FBOBackground>(tmpPtr);
272 return fc;
275 //! create a new instance of the class, copy the container flags
276 FBOBackgroundTransitPtr FBOBackgroundBase::createDependent(BitVector bFlags)
278 FBOBackgroundTransitPtr fc;
280 if(getClassType().getPrototype() != NULL)
282 FieldContainerTransitPtr tmpPtr =
283 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
285 fc = dynamic_pointer_cast<FBOBackground>(tmpPtr);
288 return fc;
291 //! create a new instance of the class
292 FBOBackgroundTransitPtr FBOBackgroundBase::create(void)
294 FBOBackgroundTransitPtr fc;
296 if(getClassType().getPrototype() != NULL)
298 FieldContainerTransitPtr tmpPtr =
299 getClassType().getPrototype()-> shallowCopy();
301 fc = dynamic_pointer_cast<FBOBackground>(tmpPtr);
304 return fc;
307 FBOBackground *FBOBackgroundBase::createEmptyLocal(BitVector bFlags)
309 FBOBackground *returnValue;
311 newPtr<FBOBackground>(returnValue, bFlags);
313 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
315 return returnValue;
318 //! create an empty new instance of the class, do not copy the prototype
319 FBOBackground *FBOBackgroundBase::createEmpty(void)
321 FBOBackground *returnValue;
323 newPtr<FBOBackground>(returnValue, Thread::getCurrentLocalFlags());
325 returnValue->_pFieldFlags->_bNamespaceMask &=
326 ~Thread::getCurrentLocalFlags();
328 return returnValue;
332 FieldContainerTransitPtr FBOBackgroundBase::shallowCopyLocal(
333 BitVector bFlags) const
335 FBOBackground *tmpPtr;
337 newPtr(tmpPtr, dynamic_cast<const FBOBackground *>(this), bFlags);
339 FieldContainerTransitPtr returnValue(tmpPtr);
341 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
343 return returnValue;
346 FieldContainerTransitPtr FBOBackgroundBase::shallowCopyDependent(
347 BitVector bFlags) const
349 FBOBackground *tmpPtr;
351 newPtr(tmpPtr, dynamic_cast<const FBOBackground *>(this), ~bFlags);
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
357 return returnValue;
360 FieldContainerTransitPtr FBOBackgroundBase::shallowCopy(void) const
362 FBOBackground *tmpPtr;
364 newPtr(tmpPtr,
365 dynamic_cast<const FBOBackground *>(this),
366 Thread::getCurrentLocalFlags());
368 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr returnValue(tmpPtr);
372 return returnValue;
378 /*------------------------- constructors ----------------------------------*/
380 FBOBackgroundBase::FBOBackgroundBase(void) :
381 Inherited(),
382 _sfFrameBufferObject (NULL)
386 FBOBackgroundBase::FBOBackgroundBase(const FBOBackgroundBase &source) :
387 Inherited(source),
388 _sfFrameBufferObject (NULL)
393 /*-------------------------- destructors ----------------------------------*/
395 FBOBackgroundBase::~FBOBackgroundBase(void)
399 void FBOBackgroundBase::onCreate(const FBOBackground *source)
401 Inherited::onCreate(source);
403 if(source != NULL)
405 FBOBackground *pThis = static_cast<FBOBackground *>(this);
407 pThis->setFrameBufferObject(source->getFrameBufferObject());
411 GetFieldHandlePtr FBOBackgroundBase::getHandleFrameBufferObject (void) const
413 SFUnrecFrameBufferObjectPtr::GetHandlePtr returnValue(
414 new SFUnrecFrameBufferObjectPtr::GetHandle(
415 &_sfFrameBufferObject,
416 this->getType().getFieldDesc(FrameBufferObjectFieldId),
417 const_cast<FBOBackgroundBase *>(this)));
419 return returnValue;
422 EditFieldHandlePtr FBOBackgroundBase::editHandleFrameBufferObject(void)
424 SFUnrecFrameBufferObjectPtr::EditHandlePtr returnValue(
425 new SFUnrecFrameBufferObjectPtr::EditHandle(
426 &_sfFrameBufferObject,
427 this->getType().getFieldDesc(FrameBufferObjectFieldId),
428 this));
430 returnValue->setSetMethod(
431 boost::bind(&FBOBackground::setFrameBufferObject,
432 static_cast<FBOBackground *>(this), _1));
434 editSField(FrameBufferObjectFieldMask);
436 return returnValue;
440 #ifdef OSG_MT_CPTR_ASPECT
441 void FBOBackgroundBase::execSyncV( FieldContainer &oFrom,
442 ConstFieldMaskArg whichField,
443 AspectOffsetStore &oOffsets,
444 ConstFieldMaskArg syncMode,
445 const UInt32 uiSyncInfo)
447 FBOBackground *pThis = static_cast<FBOBackground *>(this);
449 pThis->execSync(static_cast<FBOBackground *>(&oFrom),
450 whichField,
451 oOffsets,
452 syncMode,
453 uiSyncInfo);
455 #endif
458 #ifdef OSG_MT_CPTR_ASPECT
459 FieldContainer *FBOBackgroundBase::createAspectCopy(
460 const FieldContainer *pRefAspect) const
462 FBOBackground *returnValue;
464 newAspectCopy(returnValue,
465 dynamic_cast<const FBOBackground *>(pRefAspect),
466 dynamic_cast<const FBOBackground *>(this));
468 return returnValue;
470 #endif
472 void FBOBackgroundBase::resolveLinks(void)
474 Inherited::resolveLinks();
476 static_cast<FBOBackground *>(this)->setFrameBufferObject(NULL);
482 OSG_END_NAMESPACE