1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 **
50 *****************************************************************************
51 \*****************************************************************************/
56 #include "OSGConfig.h"
61 #include "OSGEGLWindowBase.h"
62 #include "OSGEGLWindow.h"
64 #include <boost/bind.hpp>
66 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
67 #pragma warning(disable:4355)
72 /***************************************************************************\
74 \***************************************************************************/
76 /*! \class OSG::EGLWindow
77 The class for EGL windows.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var EGLDisplay EGLWindowBase::_sfDisplay
88 /*! \var EGLSurface EGLWindowBase::_sfWindow
92 /*! \var EGLContext EGLWindowBase::_sfContext
97 /***************************************************************************\
98 * FieldType/FieldTrait Instantiation *
99 \***************************************************************************/
101 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
102 DataType FieldTraits
<EGLWindow
*>::_type("EGLWindowPtr", "WindowPtr");
105 OSG_FIELDTRAITS_GETTYPE(EGLWindow
*)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void EGLWindowBase::classDescInserter(TypeObject
&oType
)
121 FieldDescriptionBase
*pDesc
= NULL
;
124 pDesc
= new SFEGLDisplay::Description(
125 SFEGLDisplay::getClassType(),
128 DisplayFieldId
, DisplayFieldMask
,
130 (Field::SFDefaultFlags
| Field::FStdAccess
),
131 static_cast<FieldEditMethodSig
>(&EGLWindow::editHandleDisplay
),
132 static_cast<FieldGetMethodSig
>(&EGLWindow::getHandleDisplay
));
134 oType
.addInitialDesc(pDesc
);
136 pDesc
= new SFEGLSurface::Description(
137 SFEGLSurface::getClassType(),
140 WindowFieldId
, WindowFieldMask
,
142 (Field::SFDefaultFlags
| Field::FStdAccess
),
143 static_cast<FieldEditMethodSig
>(&EGLWindow::editHandleWindow
),
144 static_cast<FieldGetMethodSig
>(&EGLWindow::getHandleWindow
));
146 oType
.addInitialDesc(pDesc
);
148 pDesc
= new SFEGLContext::Description(
149 SFEGLContext::getClassType(),
152 ContextFieldId
, ContextFieldMask
,
154 (Field::SFDefaultFlags
| Field::FStdAccess
),
155 static_cast<FieldEditMethodSig
>(&EGLWindow::editHandleContext
),
156 static_cast<FieldGetMethodSig
>(&EGLWindow::getHandleContext
));
158 oType
.addInitialDesc(pDesc
);
162 EGLWindowBase::TypeObject
EGLWindowBase::_type(
163 EGLWindowBase::getClassname(),
164 Inherited::getClassname(),
167 reinterpret_cast<PrototypeCreateF
>(&EGLWindowBase::createEmptyLocal
),
168 EGLWindow::initMethod
,
169 EGLWindow::exitMethod
,
170 reinterpret_cast<InitalInsertDescFunc
>(&EGLWindow::classDescInserter
),
173 "<?xml version=\"1.0\"?>\n"
176 " name=\"EGLWindow\"\n"
177 " parent=\"Window\"\n"
178 " library=\"WindowEGL\"\n"
179 " pointerfieldtypes=\"both\"\n"
180 " structure=\"concrete\"\n"
181 " systemcomponent=\"true\"\n"
182 " parentsystemcomponent=\"true\"\n"
184 " The class for EGL windows.\n"
186 "\t name=\"display\"\n"
187 "\t type=\"EGLDisplay\"\n"
188 "\t cardinality=\"single\"\n"
189 "\t visibility=\"internal\"\n"
190 "\t defaultValue=\"0\"\n"
191 "\t fieldHeader=\"OSGEGLWindowDataFields.h\"\n"
192 "\t access=\"public\"\n"
196 "\t name=\"window\"\n"
197 "\t type=\"EGLSurface\"\n"
198 "\t cardinality=\"single\"\n"
199 "\t visibility=\"internal\"\n"
200 "\t defaultValue=\"0\"\n"
201 "\t fieldHeader=\"OSGEGLWindowDataFields.h\"\n"
202 "\t access=\"public\"\n"
206 "\t name=\"context\"\n"
207 "\t type=\"EGLContext\"\n"
208 "\t cardinality=\"single\"\n"
209 "\t visibility=\"internal\"\n"
210 "\t defaultValue=\"0\"\n"
211 "\t fieldHeader=\"OSGEGLWindowDataFields.h\"\n"
212 "\t access=\"public\"\n"
215 "</FieldContainer>\n",
216 "The class for EGL windows.\n"
219 /*------------------------------ get -----------------------------------*/
221 FieldContainerType
&EGLWindowBase::getType(void)
226 const FieldContainerType
&EGLWindowBase::getType(void) const
231 UInt32
EGLWindowBase::getContainerSize(void) const
233 return sizeof(EGLWindow
);
236 /*------------------------- decorator get ------------------------------*/
239 SFEGLDisplay
*EGLWindowBase::editSFDisplay(void)
241 editSField(DisplayFieldMask
);
246 const SFEGLDisplay
*EGLWindowBase::getSFDisplay(void) const
252 SFEGLSurface
*EGLWindowBase::editSFWindow(void)
254 editSField(WindowFieldMask
);
259 const SFEGLSurface
*EGLWindowBase::getSFWindow(void) const
265 SFEGLContext
*EGLWindowBase::editSFContext(void)
267 editSField(ContextFieldMask
);
272 const SFEGLContext
*EGLWindowBase::getSFContext(void) const
282 /*------------------------------ access -----------------------------------*/
284 SizeT
EGLWindowBase::getBinSize(ConstFieldMaskArg whichField
)
286 SizeT returnValue
= Inherited::getBinSize(whichField
);
288 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
290 returnValue
+= _sfDisplay
.getBinSize();
292 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
294 returnValue
+= _sfWindow
.getBinSize();
296 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
298 returnValue
+= _sfContext
.getBinSize();
304 void EGLWindowBase::copyToBin(BinaryDataHandler
&pMem
,
305 ConstFieldMaskArg whichField
)
307 Inherited::copyToBin(pMem
, whichField
);
309 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
311 _sfDisplay
.copyToBin(pMem
);
313 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
315 _sfWindow
.copyToBin(pMem
);
317 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
319 _sfContext
.copyToBin(pMem
);
323 void EGLWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
324 ConstFieldMaskArg whichField
)
326 Inherited::copyFromBin(pMem
, whichField
);
328 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
330 editSField(DisplayFieldMask
);
331 _sfDisplay
.copyFromBin(pMem
);
333 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
335 editSField(WindowFieldMask
);
336 _sfWindow
.copyFromBin(pMem
);
338 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
340 editSField(ContextFieldMask
);
341 _sfContext
.copyFromBin(pMem
);
345 //! create a new instance of the class
346 EGLWindowTransitPtr
EGLWindowBase::createLocal(BitVector bFlags
)
348 EGLWindowTransitPtr fc
;
350 if(getClassType().getPrototype() != NULL
)
352 FieldContainerTransitPtr tmpPtr
=
353 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
355 fc
= dynamic_pointer_cast
<EGLWindow
>(tmpPtr
);
361 //! create a new instance of the class, copy the container flags
362 EGLWindowTransitPtr
EGLWindowBase::createDependent(BitVector bFlags
)
364 EGLWindowTransitPtr fc
;
366 if(getClassType().getPrototype() != NULL
)
368 FieldContainerTransitPtr tmpPtr
=
369 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
371 fc
= dynamic_pointer_cast
<EGLWindow
>(tmpPtr
);
377 //! create a new instance of the class
378 EGLWindowTransitPtr
EGLWindowBase::create(void)
380 EGLWindowTransitPtr fc
;
382 if(getClassType().getPrototype() != NULL
)
384 FieldContainerTransitPtr tmpPtr
=
385 getClassType().getPrototype()-> shallowCopy();
387 fc
= dynamic_pointer_cast
<EGLWindow
>(tmpPtr
);
393 EGLWindow
*EGLWindowBase::createEmptyLocal(BitVector bFlags
)
395 EGLWindow
*returnValue
;
397 newPtr
<EGLWindow
>(returnValue
, bFlags
);
399 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
404 //! create an empty new instance of the class, do not copy the prototype
405 EGLWindow
*EGLWindowBase::createEmpty(void)
407 EGLWindow
*returnValue
;
409 newPtr
<EGLWindow
>(returnValue
, Thread::getCurrentLocalFlags());
411 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
412 ~Thread::getCurrentLocalFlags();
418 FieldContainerTransitPtr
EGLWindowBase::shallowCopyLocal(
419 BitVector bFlags
) const
423 newPtr(tmpPtr
, dynamic_cast<const EGLWindow
*>(this), bFlags
);
425 FieldContainerTransitPtr
returnValue(tmpPtr
);
427 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
432 FieldContainerTransitPtr
EGLWindowBase::shallowCopyDependent(
433 BitVector bFlags
) const
437 newPtr(tmpPtr
, dynamic_cast<const EGLWindow
*>(this), ~bFlags
);
439 FieldContainerTransitPtr
returnValue(tmpPtr
);
441 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
446 FieldContainerTransitPtr
EGLWindowBase::shallowCopy(void) const
451 dynamic_cast<const EGLWindow
*>(this),
452 Thread::getCurrentLocalFlags());
454 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
456 FieldContainerTransitPtr
returnValue(tmpPtr
);
464 /*------------------------- constructors ----------------------------------*/
466 EGLWindowBase::EGLWindowBase(void) :
468 _sfDisplay (EGLDisplay(0)),
469 _sfWindow (EGLSurface(0)),
470 _sfContext (EGLContext(0))
474 EGLWindowBase::EGLWindowBase(const EGLWindowBase
&source
) :
476 _sfDisplay (source
._sfDisplay
),
477 _sfWindow (source
._sfWindow
),
478 _sfContext (source
._sfContext
)
483 /*-------------------------- destructors ----------------------------------*/
485 EGLWindowBase::~EGLWindowBase(void)
490 GetFieldHandlePtr
EGLWindowBase::getHandleDisplay (void) const
492 SFEGLDisplay::GetHandlePtr
returnValue(
493 new SFEGLDisplay::GetHandle(
495 this->getType().getFieldDesc(DisplayFieldId
),
496 const_cast<EGLWindowBase
*>(this)));
501 EditFieldHandlePtr
EGLWindowBase::editHandleDisplay (void)
503 SFEGLDisplay::EditHandlePtr
returnValue(
504 new SFEGLDisplay::EditHandle(
506 this->getType().getFieldDesc(DisplayFieldId
),
510 editSField(DisplayFieldMask
);
515 GetFieldHandlePtr
EGLWindowBase::getHandleWindow (void) const
517 SFEGLSurface::GetHandlePtr
returnValue(
518 new SFEGLSurface::GetHandle(
520 this->getType().getFieldDesc(WindowFieldId
),
521 const_cast<EGLWindowBase
*>(this)));
526 EditFieldHandlePtr
EGLWindowBase::editHandleWindow (void)
528 SFEGLSurface::EditHandlePtr
returnValue(
529 new SFEGLSurface::EditHandle(
531 this->getType().getFieldDesc(WindowFieldId
),
535 editSField(WindowFieldMask
);
540 GetFieldHandlePtr
EGLWindowBase::getHandleContext (void) const
542 SFEGLContext::GetHandlePtr
returnValue(
543 new SFEGLContext::GetHandle(
545 this->getType().getFieldDesc(ContextFieldId
),
546 const_cast<EGLWindowBase
*>(this)));
551 EditFieldHandlePtr
EGLWindowBase::editHandleContext (void)
553 SFEGLContext::EditHandlePtr
returnValue(
554 new SFEGLContext::EditHandle(
556 this->getType().getFieldDesc(ContextFieldId
),
560 editSField(ContextFieldMask
);
566 #ifdef OSG_MT_CPTR_ASPECT
567 void EGLWindowBase::execSyncV( FieldContainer
&oFrom
,
568 ConstFieldMaskArg whichField
,
569 AspectOffsetStore
&oOffsets
,
570 ConstFieldMaskArg syncMode
,
571 const UInt32 uiSyncInfo
)
573 EGLWindow
*pThis
= static_cast<EGLWindow
*>(this);
575 pThis
->execSync(static_cast<EGLWindow
*>(&oFrom
),
584 #ifdef OSG_MT_CPTR_ASPECT
585 FieldContainer
*EGLWindowBase::createAspectCopy(
586 const FieldContainer
*pRefAspect
) const
588 EGLWindow
*returnValue
;
590 newAspectCopy(returnValue
,
591 dynamic_cast<const EGLWindow
*>(pRefAspect
),
592 dynamic_cast<const EGLWindow
*>(this));
598 void EGLWindowBase::resolveLinks(void)
600 Inherited::resolveLinks();