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 "OSGEAGLWindowBase.h"
62 #include "OSGEAGLWindow.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::EAGLWindow
77 The class for MacOS X EAGL windows.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var EAGLContextP EAGLWindowBase::_sfContext
89 /***************************************************************************\
90 * FieldType/FieldTrait Instantiation *
91 \***************************************************************************/
93 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
94 PointerType FieldTraits
<EAGLWindow
*, nsOSG
>::_type(
97 EAGLWindow::getClassType(),
101 OSG_FIELDTRAITS_GETTYPE_NS(EAGLWindow
*, nsOSG
)
103 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
107 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
111 /***************************************************************************\
112 * Field Description *
113 \***************************************************************************/
115 void EAGLWindowBase::classDescInserter(TypeObject
&oType
)
117 FieldDescriptionBase
*pDesc
= NULL
;
120 pDesc
= new SFEAGLContextP::Description(
121 SFEAGLContextP::getClassType(),
124 ContextFieldId
, ContextFieldMask
,
126 (Field::SFDefaultFlags
| Field::FStdAccess
),
127 static_cast<FieldEditMethodSig
>(&EAGLWindow::editHandleContext
),
128 static_cast<FieldGetMethodSig
>(&EAGLWindow::getHandleContext
));
130 oType
.addInitialDesc(pDesc
);
134 EAGLWindowBase::TypeObject
EAGLWindowBase::_type(
135 EAGLWindowBase::getClassname(),
136 Inherited::getClassname(),
139 reinterpret_cast<PrototypeCreateF
>(&EAGLWindowBase::createEmptyLocal
),
140 EAGLWindow::initMethod
,
141 EAGLWindow::exitMethod
,
142 reinterpret_cast<InitalInsertDescFunc
>(&EAGLWindow::classDescInserter
),
145 "<?xml version=\"1.0\"?>\n"
148 " name=\"EAGLWindow\"\n"
149 " parent=\"Window\"\n"
150 " library=\"WindowEAGL\"\n"
151 " pointerfieldtypes=\"both\"\n"
152 " structure=\"concrete\"\n"
153 " systemcomponent=\"true\"\n"
154 " parentsystemcomponent=\"true\"\n"
155 " docGroupBase=\"GrpWindowCocao\"\n"
157 " The class for MacOS X EAGL windows.\n"
159 "\t name=\"context\"\n"
160 "\t type=\"EAGLContextP\"\n"
161 "\t cardinality=\"single\"\n"
162 "\t visibility=\"internal\"\n"
163 "\t defaultValue=\"0\"\n"
164 "\t fieldHeader=\"OSGEAGLWindowDataFields.h\"\n"
165 "\t access=\"public\"\n"
168 "</FieldContainer>\n",
169 "The class for MacOS X EAGL windows.\n"
172 /*------------------------------ get -----------------------------------*/
174 FieldContainerType
&EAGLWindowBase::getType(void)
179 const FieldContainerType
&EAGLWindowBase::getType(void) const
184 UInt32
EAGLWindowBase::getContainerSize(void) const
186 return sizeof(EAGLWindow
);
189 /*------------------------- decorator get ------------------------------*/
192 SFEAGLContextP
*EAGLWindowBase::editSFContext(void)
194 editSField(ContextFieldMask
);
199 const SFEAGLContextP
*EAGLWindowBase::getSFContext(void) const
209 /*------------------------------ access -----------------------------------*/
211 SizeT
EAGLWindowBase::getBinSize(ConstFieldMaskArg whichField
)
213 SizeT returnValue
= Inherited::getBinSize(whichField
);
215 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
217 returnValue
+= _sfContext
.getBinSize();
223 void EAGLWindowBase::copyToBin(BinaryDataHandler
&pMem
,
224 ConstFieldMaskArg whichField
)
226 Inherited::copyToBin(pMem
, whichField
);
228 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
230 _sfContext
.copyToBin(pMem
);
234 void EAGLWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
235 ConstFieldMaskArg whichField
)
237 Inherited::copyFromBin(pMem
, whichField
);
239 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
241 editSField(ContextFieldMask
);
242 _sfContext
.copyFromBin(pMem
);
246 //! create a new instance of the class
247 EAGLWindowTransitPtr
EAGLWindowBase::createLocal(BitVector bFlags
)
249 EAGLWindowTransitPtr fc
;
251 if(getClassType().getPrototype() != NULL
)
253 FieldContainerTransitPtr tmpPtr
=
254 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
256 fc
= dynamic_pointer_cast
<EAGLWindow
>(tmpPtr
);
262 //! create a new instance of the class, copy the container flags
263 EAGLWindowTransitPtr
EAGLWindowBase::createDependent(BitVector bFlags
)
265 EAGLWindowTransitPtr fc
;
267 if(getClassType().getPrototype() != NULL
)
269 FieldContainerTransitPtr tmpPtr
=
270 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
272 fc
= dynamic_pointer_cast
<EAGLWindow
>(tmpPtr
);
278 //! create a new instance of the class
279 EAGLWindowTransitPtr
EAGLWindowBase::create(void)
281 EAGLWindowTransitPtr fc
;
283 if(getClassType().getPrototype() != NULL
)
285 FieldContainerTransitPtr tmpPtr
=
286 getClassType().getPrototype()-> shallowCopy();
288 fc
= dynamic_pointer_cast
<EAGLWindow
>(tmpPtr
);
294 EAGLWindow
*EAGLWindowBase::createEmptyLocal(BitVector bFlags
)
296 EAGLWindow
*returnValue
;
298 newPtr
<EAGLWindow
>(returnValue
, bFlags
);
300 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
305 //! create an empty new instance of the class, do not copy the prototype
306 EAGLWindow
*EAGLWindowBase::createEmpty(void)
308 EAGLWindow
*returnValue
;
310 newPtr
<EAGLWindow
>(returnValue
, Thread::getCurrentLocalFlags());
312 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
313 ~Thread::getCurrentLocalFlags();
319 FieldContainerTransitPtr
EAGLWindowBase::shallowCopyLocal(
320 BitVector bFlags
) const
324 newPtr(tmpPtr
, dynamic_cast<const EAGLWindow
*>(this), bFlags
);
326 FieldContainerTransitPtr
returnValue(tmpPtr
);
328 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
333 FieldContainerTransitPtr
EAGLWindowBase::shallowCopyDependent(
334 BitVector bFlags
) const
338 newPtr(tmpPtr
, dynamic_cast<const EAGLWindow
*>(this), ~bFlags
);
340 FieldContainerTransitPtr
returnValue(tmpPtr
);
342 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
347 FieldContainerTransitPtr
EAGLWindowBase::shallowCopy(void) const
352 dynamic_cast<const EAGLWindow
*>(this),
353 Thread::getCurrentLocalFlags());
355 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
357 FieldContainerTransitPtr
returnValue(tmpPtr
);
365 /*------------------------- constructors ----------------------------------*/
367 EAGLWindowBase::EAGLWindowBase(void) :
369 _sfContext (EAGLContextP(0))
373 EAGLWindowBase::EAGLWindowBase(const EAGLWindowBase
&source
) :
375 _sfContext (source
._sfContext
)
380 /*-------------------------- destructors ----------------------------------*/
382 EAGLWindowBase::~EAGLWindowBase(void)
387 GetFieldHandlePtr
EAGLWindowBase::getHandleContext (void) const
389 SFEAGLContextP::GetHandlePtr
returnValue(
390 new SFEAGLContextP::GetHandle(
392 this->getType().getFieldDesc(ContextFieldId
),
393 const_cast<EAGLWindowBase
*>(this)));
398 EditFieldHandlePtr
EAGLWindowBase::editHandleContext (void)
400 SFEAGLContextP::EditHandlePtr
returnValue(
401 new SFEAGLContextP::EditHandle(
403 this->getType().getFieldDesc(ContextFieldId
),
407 editSField(ContextFieldMask
);
413 #ifdef OSG_MT_CPTR_ASPECT
414 void EAGLWindowBase::execSyncV( FieldContainer
&oFrom
,
415 ConstFieldMaskArg whichField
,
416 AspectOffsetStore
&oOffsets
,
417 ConstFieldMaskArg syncMode
,
418 const UInt32 uiSyncInfo
)
420 EAGLWindow
*pThis
= static_cast<EAGLWindow
*>(this);
422 pThis
->execSync(static_cast<EAGLWindow
*>(&oFrom
),
431 #ifdef OSG_MT_CPTR_ASPECT
432 FieldContainer
*EAGLWindowBase::createAspectCopy(
433 const FieldContainer
*pRefAspect
) const
435 EAGLWindow
*returnValue
;
437 newAspectCopy(returnValue
,
438 dynamic_cast<const EAGLWindow
*>(pRefAspect
),
439 dynamic_cast<const EAGLWindow
*>(this));
445 void EAGLWindowBase::resolveLinks(void)
447 Inherited::resolveLinks();