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 **
48 ** class CoreGLWindow!
50 *****************************************************************************
51 \*****************************************************************************/
56 #include "OSGConfig.h"
61 #include "OSGCoreGLWindowBase.h"
62 #include "OSGCoreGLWindow.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::CoreGLWindow
77 The class for MacOS X CoreGL windows.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var CGLContextObj CoreGLWindowBase::_sfContext
89 /***************************************************************************\
90 * FieldType/FieldTrait Instantiation *
91 \***************************************************************************/
93 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
94 DataType FieldTraits
<CoreGLWindow
*>::_type("CoreGLWindowPtr", "WindowPtr");
97 OSG_FIELDTRAITS_GETTYPE(CoreGLWindow
*)
99 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
103 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
107 /***************************************************************************\
108 * Field Description *
109 \***************************************************************************/
111 void CoreGLWindowBase::classDescInserter(TypeObject
&oType
)
113 FieldDescriptionBase
*pDesc
= NULL
;
116 pDesc
= new SFCGLContextObj::Description(
117 SFCGLContextObj::getClassType(),
120 ContextFieldId
, ContextFieldMask
,
122 (Field::SFDefaultFlags
| Field::FStdAccess
),
123 static_cast<FieldEditMethodSig
>(&CoreGLWindow::editHandleContext
),
124 static_cast<FieldGetMethodSig
>(&CoreGLWindow::getHandleContext
));
126 oType
.addInitialDesc(pDesc
);
130 CoreGLWindowBase::TypeObject
CoreGLWindowBase::_type(
131 CoreGLWindowBase::getClassname(),
132 Inherited::getClassname(),
135 reinterpret_cast<PrototypeCreateF
>(&CoreGLWindowBase::createEmptyLocal
),
136 CoreGLWindow::initMethod
,
137 CoreGLWindow::exitMethod
,
138 reinterpret_cast<InitalInsertDescFunc
>(&CoreGLWindow::classDescInserter
),
141 "<?xml version=\"1.0\"?>\n"
144 " name=\"CoreGLWindow\"\n"
145 " parent=\"Window\"\n"
146 " library=\"WindowCoreGL\"\n"
147 " pointerfieldtypes=\"both\"\n"
148 " structure=\"concrete\"\n"
149 " systemcomponent=\"true\"\n"
150 " parentsystemcomponent=\"true\"\n"
151 " docGroupBase=\"GrpWindowCoreGL\"\n"
153 " The class for MacOS X CoreGL windows.\n"
155 "\t name=\"context\"\n"
156 "\t type=\"CGLContextObj\"\n"
157 "\t cardinality=\"single\"\n"
158 "\t visibility=\"internal\"\n"
159 "\t defaultValue=\"0\"\n"
160 "\t fieldHeader=\"OSGCoreGLWindowDataFields.h\"\n"
161 "\t access=\"public\"\n"
164 "</FieldContainer>\n",
165 "The class for MacOS X CoreGL windows.\n"
168 /*------------------------------ get -----------------------------------*/
170 FieldContainerType
&CoreGLWindowBase::getType(void)
175 const FieldContainerType
&CoreGLWindowBase::getType(void) const
180 UInt32
CoreGLWindowBase::getContainerSize(void) const
182 return sizeof(CoreGLWindow
);
185 /*------------------------- decorator get ------------------------------*/
188 SFCGLContextObj
*CoreGLWindowBase::editSFContext(void)
190 editSField(ContextFieldMask
);
195 const SFCGLContextObj
*CoreGLWindowBase::getSFContext(void) const
205 /*------------------------------ access -----------------------------------*/
207 SizeT
CoreGLWindowBase::getBinSize(ConstFieldMaskArg whichField
)
209 SizeT returnValue
= Inherited::getBinSize(whichField
);
211 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
213 returnValue
+= _sfContext
.getBinSize();
219 void CoreGLWindowBase::copyToBin(BinaryDataHandler
&pMem
,
220 ConstFieldMaskArg whichField
)
222 Inherited::copyToBin(pMem
, whichField
);
224 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
226 _sfContext
.copyToBin(pMem
);
230 void CoreGLWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
231 ConstFieldMaskArg whichField
)
233 Inherited::copyFromBin(pMem
, whichField
);
235 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
237 editSField(ContextFieldMask
);
238 _sfContext
.copyFromBin(pMem
);
242 //! create a new instance of the class
243 CoreGLWindowTransitPtr
CoreGLWindowBase::createLocal(BitVector bFlags
)
245 CoreGLWindowTransitPtr fc
;
247 if(getClassType().getPrototype() != NULL
)
249 FieldContainerTransitPtr tmpPtr
=
250 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
252 fc
= dynamic_pointer_cast
<CoreGLWindow
>(tmpPtr
);
258 //! create a new instance of the class, copy the container flags
259 CoreGLWindowTransitPtr
CoreGLWindowBase::createDependent(BitVector bFlags
)
261 CoreGLWindowTransitPtr fc
;
263 if(getClassType().getPrototype() != NULL
)
265 FieldContainerTransitPtr tmpPtr
=
266 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
268 fc
= dynamic_pointer_cast
<CoreGLWindow
>(tmpPtr
);
274 //! create a new instance of the class
275 CoreGLWindowTransitPtr
CoreGLWindowBase::create(void)
277 CoreGLWindowTransitPtr fc
;
279 if(getClassType().getPrototype() != NULL
)
281 FieldContainerTransitPtr tmpPtr
=
282 getClassType().getPrototype()-> shallowCopy();
284 fc
= dynamic_pointer_cast
<CoreGLWindow
>(tmpPtr
);
290 CoreGLWindow
*CoreGLWindowBase::createEmptyLocal(BitVector bFlags
)
292 CoreGLWindow
*returnValue
;
294 newPtr
<CoreGLWindow
>(returnValue
, bFlags
);
296 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
301 //! create an empty new instance of the class, do not copy the prototype
302 CoreGLWindow
*CoreGLWindowBase::createEmpty(void)
304 CoreGLWindow
*returnValue
;
306 newPtr
<CoreGLWindow
>(returnValue
, Thread::getCurrentLocalFlags());
308 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
309 ~Thread::getCurrentLocalFlags();
315 FieldContainerTransitPtr
CoreGLWindowBase::shallowCopyLocal(
316 BitVector bFlags
) const
318 CoreGLWindow
*tmpPtr
;
320 newPtr(tmpPtr
, dynamic_cast<const CoreGLWindow
*>(this), bFlags
);
322 FieldContainerTransitPtr
returnValue(tmpPtr
);
324 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
329 FieldContainerTransitPtr
CoreGLWindowBase::shallowCopyDependent(
330 BitVector bFlags
) const
332 CoreGLWindow
*tmpPtr
;
334 newPtr(tmpPtr
, dynamic_cast<const CoreGLWindow
*>(this), ~bFlags
);
336 FieldContainerTransitPtr
returnValue(tmpPtr
);
338 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
343 FieldContainerTransitPtr
CoreGLWindowBase::shallowCopy(void) const
345 CoreGLWindow
*tmpPtr
;
348 dynamic_cast<const CoreGLWindow
*>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr
returnValue(tmpPtr
);
361 /*------------------------- constructors ----------------------------------*/
363 CoreGLWindowBase::CoreGLWindowBase(void) :
365 _sfContext (CGLContextObj(0))
369 CoreGLWindowBase::CoreGLWindowBase(const CoreGLWindowBase
&source
) :
371 _sfContext (source
._sfContext
)
376 /*-------------------------- destructors ----------------------------------*/
378 CoreGLWindowBase::~CoreGLWindowBase(void)
383 GetFieldHandlePtr
CoreGLWindowBase::getHandleContext (void) const
385 SFCGLContextObj::GetHandlePtr
returnValue(
386 new SFCGLContextObj::GetHandle(
388 this->getType().getFieldDesc(ContextFieldId
),
389 const_cast<CoreGLWindowBase
*>(this)));
394 EditFieldHandlePtr
CoreGLWindowBase::editHandleContext (void)
396 SFCGLContextObj::EditHandlePtr
returnValue(
397 new SFCGLContextObj::EditHandle(
399 this->getType().getFieldDesc(ContextFieldId
),
403 editSField(ContextFieldMask
);
409 #ifdef OSG_MT_CPTR_ASPECT
410 void CoreGLWindowBase::execSyncV( FieldContainer
&oFrom
,
411 ConstFieldMaskArg whichField
,
412 AspectOffsetStore
&oOffsets
,
413 ConstFieldMaskArg syncMode
,
414 const UInt32 uiSyncInfo
)
416 CoreGLWindow
*pThis
= static_cast<CoreGLWindow
*>(this);
418 pThis
->execSync(static_cast<CoreGLWindow
*>(&oFrom
),
427 #ifdef OSG_MT_CPTR_ASPECT
428 FieldContainer
*CoreGLWindowBase::createAspectCopy(
429 const FieldContainer
*pRefAspect
) const
431 CoreGLWindow
*returnValue
;
433 newAspectCopy(returnValue
,
434 dynamic_cast<const CoreGLWindow
*>(pRefAspect
),
435 dynamic_cast<const CoreGLWindow
*>(this));
441 void CoreGLWindowBase::resolveLinks(void)
443 Inherited::resolveLinks();