changed: gcc8 base update
[opensg.git] / Source / WindowSystem / GLUT / OSGGLUTWindowBase.cpp
blob72c9473289e7f7f326c3f3429eb2b564dafdb80d
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 GLUTWindow!
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 "OSGGLUTWindowBase.h"
67 #include "OSGGLUTWindow.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::GLUTWindow
78 The class for GLUT-based windows. See \ref PageWindowGLUT for a description.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Int32 GLUTWindowBase::_sfGlutId
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<GLUTWindow *, nsOSG>::_type(
96 "GLUTWindowPtr",
97 "WindowPtr",
98 GLUTWindow::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(GLUTWindow *, nsOSG)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
105 GLUTWindow *,
106 nsOSG)
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
109 GLUTWindow *,
110 nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void GLUTWindowBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new SFInt32::Description(
122 SFInt32::getClassType(),
123 "glutId",
125 GlutIdFieldId, GlutIdFieldMask,
126 true,
127 (Field::FClusterLocal),
128 static_cast<FieldEditMethodSig>(&GLUTWindow::editHandleGlutId),
129 static_cast<FieldGetMethodSig >(&GLUTWindow::getHandleGlutId));
131 oType.addInitialDesc(pDesc);
135 GLUTWindowBase::TypeObject GLUTWindowBase::_type(
136 GLUTWindowBase::getClassname(),
137 Inherited::getClassname(),
138 "NULL",
139 nsOSG, //Namespace
140 reinterpret_cast<PrototypeCreateF>(&GLUTWindowBase::createEmptyLocal),
141 reinterpret_cast<InitContainerF>(&GLUTWindow::initMethod),
142 reinterpret_cast<ExitContainerF>(&GLUTWindow::exitMethod),
143 reinterpret_cast<InitalInsertDescFunc>(
144 reinterpret_cast<void *>(&GLUTWindow::classDescInserter)),
145 false,
147 "<?xml version=\"1.0\"?>\n"
148 "\n"
149 "<FieldContainer\n"
150 " name=\"GLUTWindow\"\n"
151 " parent=\"NativeWindow\"\n"
152 " library=\"WindowGLUT\"\n"
153 " pointerfieldtypes=\"both\"\n"
154 " structure=\"concrete\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " realparent=\"Window\"\n"
158 " docGroupBase=\"GrpWindowGLUT\"\n"
159 " >\n"
160 " The class for GLUT-based windows. See \\ref PageWindowGLUT for a description.\n"
161 " <Field\n"
162 " name=\"glutId\"\n"
163 " type=\"Int32\"\n"
164 " cardinality=\"single\"\n"
165 " visibility=\"internal\"\n"
166 " defaultValue=\"0\"\n"
167 " access=\"public\"\n"
168 " fieldFlags=\"FClusterLocal\"\n"
169 " >\n"
170 " </Field>\n"
171 "</FieldContainer>\n",
172 "The class for GLUT-based windows. See \\ref PageWindowGLUT for a description.\n"
175 /*------------------------------ get -----------------------------------*/
177 FieldContainerType &GLUTWindowBase::getType(void)
179 return _type;
182 const FieldContainerType &GLUTWindowBase::getType(void) const
184 return _type;
187 UInt32 GLUTWindowBase::getContainerSize(void) const
189 return sizeof(GLUTWindow);
192 /*------------------------- decorator get ------------------------------*/
195 SFInt32 *GLUTWindowBase::editSFGlutId(void)
197 editSField(GlutIdFieldMask);
199 return &_sfGlutId;
202 const SFInt32 *GLUTWindowBase::getSFGlutId(void) const
204 return &_sfGlutId;
212 /*------------------------------ access -----------------------------------*/
214 SizeT GLUTWindowBase::getBinSize(ConstFieldMaskArg whichField)
216 SizeT returnValue = Inherited::getBinSize(whichField);
218 if(FieldBits::NoField != (GlutIdFieldMask & whichField))
220 returnValue += _sfGlutId.getBinSize();
223 return returnValue;
226 void GLUTWindowBase::copyToBin(BinaryDataHandler &pMem,
227 ConstFieldMaskArg whichField)
229 Inherited::copyToBin(pMem, whichField);
231 if(FieldBits::NoField != (GlutIdFieldMask & whichField))
233 _sfGlutId.copyToBin(pMem);
237 void GLUTWindowBase::copyFromBin(BinaryDataHandler &pMem,
238 ConstFieldMaskArg whichField)
240 Inherited::copyFromBin(pMem, whichField);
242 if(FieldBits::NoField != (GlutIdFieldMask & whichField))
244 editSField(GlutIdFieldMask);
245 _sfGlutId.copyFromBin(pMem);
249 //! create a new instance of the class
250 GLUTWindowTransitPtr GLUTWindowBase::createLocal(BitVector bFlags)
252 GLUTWindowTransitPtr fc;
254 if(getClassType().getPrototype() != NULL)
256 FieldContainerTransitPtr tmpPtr =
257 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
259 fc = dynamic_pointer_cast<GLUTWindow>(tmpPtr);
262 return fc;
265 //! create a new instance of the class, copy the container flags
266 GLUTWindowTransitPtr GLUTWindowBase::createDependent(BitVector bFlags)
268 GLUTWindowTransitPtr fc;
270 if(getClassType().getPrototype() != NULL)
272 FieldContainerTransitPtr tmpPtr =
273 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
275 fc = dynamic_pointer_cast<GLUTWindow>(tmpPtr);
278 return fc;
281 //! create a new instance of the class
282 GLUTWindowTransitPtr GLUTWindowBase::create(void)
284 GLUTWindowTransitPtr fc;
286 if(getClassType().getPrototype() != NULL)
288 FieldContainerTransitPtr tmpPtr =
289 getClassType().getPrototype()-> shallowCopy();
291 fc = dynamic_pointer_cast<GLUTWindow>(tmpPtr);
294 return fc;
297 GLUTWindow *GLUTWindowBase::createEmptyLocal(BitVector bFlags)
299 GLUTWindow *returnValue;
301 newPtr<GLUTWindow>(returnValue, bFlags);
303 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
305 return returnValue;
308 //! create an empty new instance of the class, do not copy the prototype
309 GLUTWindow *GLUTWindowBase::createEmpty(void)
311 GLUTWindow *returnValue;
313 newPtr<GLUTWindow>(returnValue, Thread::getCurrentLocalFlags());
315 returnValue->_pFieldFlags->_bNamespaceMask &=
316 ~Thread::getCurrentLocalFlags();
318 return returnValue;
322 FieldContainerTransitPtr GLUTWindowBase::shallowCopyLocal(
323 BitVector bFlags) const
325 GLUTWindow *tmpPtr;
327 newPtr(tmpPtr, dynamic_cast<const GLUTWindow *>(this), bFlags);
329 FieldContainerTransitPtr returnValue(tmpPtr);
331 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
333 return returnValue;
336 FieldContainerTransitPtr GLUTWindowBase::shallowCopyDependent(
337 BitVector bFlags) const
339 GLUTWindow *tmpPtr;
341 newPtr(tmpPtr, dynamic_cast<const GLUTWindow *>(this), ~bFlags);
343 FieldContainerTransitPtr returnValue(tmpPtr);
345 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
347 return returnValue;
350 FieldContainerTransitPtr GLUTWindowBase::shallowCopy(void) const
352 GLUTWindow *tmpPtr;
354 newPtr(tmpPtr,
355 dynamic_cast<const GLUTWindow *>(this),
356 Thread::getCurrentLocalFlags());
358 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
360 FieldContainerTransitPtr returnValue(tmpPtr);
362 return returnValue;
368 /*------------------------- constructors ----------------------------------*/
370 GLUTWindowBase::GLUTWindowBase(void) :
371 Inherited(),
372 _sfGlutId (Int32(0))
376 GLUTWindowBase::GLUTWindowBase(const GLUTWindowBase &source) :
377 Inherited(source),
378 _sfGlutId (source._sfGlutId )
383 /*-------------------------- destructors ----------------------------------*/
385 GLUTWindowBase::~GLUTWindowBase(void)
390 GetFieldHandlePtr GLUTWindowBase::getHandleGlutId (void) const
392 SFInt32::GetHandlePtr returnValue(
393 new SFInt32::GetHandle(
394 &_sfGlutId,
395 this->getType().getFieldDesc(GlutIdFieldId),
396 const_cast<GLUTWindowBase *>(this)));
398 return returnValue;
401 EditFieldHandlePtr GLUTWindowBase::editHandleGlutId (void)
403 SFInt32::EditHandlePtr returnValue(
404 new SFInt32::EditHandle(
405 &_sfGlutId,
406 this->getType().getFieldDesc(GlutIdFieldId),
407 this));
410 editSField(GlutIdFieldMask);
412 return returnValue;
416 #ifdef OSG_MT_CPTR_ASPECT
417 void GLUTWindowBase::execSyncV( FieldContainer &oFrom,
418 ConstFieldMaskArg whichField,
419 AspectOffsetStore &oOffsets,
420 ConstFieldMaskArg syncMode,
421 const UInt32 uiSyncInfo)
423 GLUTWindow *pThis = static_cast<GLUTWindow *>(this);
425 pThis->execSync(static_cast<GLUTWindow *>(&oFrom),
426 whichField,
427 oOffsets,
428 syncMode,
429 uiSyncInfo);
431 #endif
434 #ifdef OSG_MT_CPTR_ASPECT
435 FieldContainer *GLUTWindowBase::createAspectCopy(
436 const FieldContainer *pRefAspect) const
438 GLUTWindow *returnValue;
440 newAspectCopy(returnValue,
441 dynamic_cast<const GLUTWindow *>(pRefAspect),
442 dynamic_cast<const GLUTWindow *>(this));
444 return returnValue;
446 #endif
448 void GLUTWindowBase::resolveLinks(void)
450 Inherited::resolveLinks();
456 OSG_END_NAMESPACE