1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 BinarySwapComposer!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
66 #include "OSGBinarySwapComposerBase.h"
67 #include "OSGBinarySwapComposer.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::BinarySwapComposer
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var bool BinarySwapComposerBase::_sfShort
89 /*! \var bool BinarySwapComposerBase::_sfAlpha
93 /*! \var UInt32 BinarySwapComposerBase::_sfTileSize
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<BinarySwapComposer
*, nsOSG
>::_type(
104 "BinarySwapComposerPtr",
106 BinarySwapComposer::getClassType(),
110 OSG_FIELDTRAITS_GETTYPE_NS(BinarySwapComposer
*, nsOSG
)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void BinarySwapComposerBase::classDescInserter(TypeObject
&oType
)
118 FieldDescriptionBase
*pDesc
= NULL
;
121 pDesc
= new SFBool::Description(
122 SFBool::getClassType(),
125 ShortFieldId
, ShortFieldMask
,
127 (Field::SFDefaultFlags
| Field::FStdAccess
),
128 static_cast<FieldEditMethodSig
>(&BinarySwapComposer::editHandleShort
),
129 static_cast<FieldGetMethodSig
>(&BinarySwapComposer::getHandleShort
));
131 oType
.addInitialDesc(pDesc
);
133 pDesc
= new SFBool::Description(
134 SFBool::getClassType(),
137 AlphaFieldId
, AlphaFieldMask
,
139 (Field::SFDefaultFlags
| Field::FStdAccess
),
140 static_cast<FieldEditMethodSig
>(&BinarySwapComposer::editHandleAlpha
),
141 static_cast<FieldGetMethodSig
>(&BinarySwapComposer::getHandleAlpha
));
143 oType
.addInitialDesc(pDesc
);
145 pDesc
= new SFUInt32::Description(
146 SFUInt32::getClassType(),
149 TileSizeFieldId
, TileSizeFieldMask
,
151 (Field::SFDefaultFlags
| Field::FStdAccess
),
152 static_cast<FieldEditMethodSig
>(&BinarySwapComposer::editHandleTileSize
),
153 static_cast<FieldGetMethodSig
>(&BinarySwapComposer::getHandleTileSize
));
155 oType
.addInitialDesc(pDesc
);
159 BinarySwapComposerBase::TypeObject
BinarySwapComposerBase::_type(
160 BinarySwapComposerBase::getClassname(),
161 Inherited::getClassname(),
164 reinterpret_cast<PrototypeCreateF
>(&BinarySwapComposerBase::createEmptyLocal
),
165 reinterpret_cast<InitContainerF
>(&BinarySwapComposer::initMethod
),
166 reinterpret_cast<ExitContainerF
>(&BinarySwapComposer::exitMethod
),
167 reinterpret_cast<InitalInsertDescFunc
>(
168 reinterpret_cast<void *>(&BinarySwapComposer::classDescInserter
)),
171 "<?xml version=\"1.0\"?>\n"
174 " name=\"BinarySwapComposer\"\n"
175 " parent=\"ImageComposer\"\n"
176 " library=\"Cluster\"\n"
177 " pointerfieldtypes=\"none\"\n"
178 " structure=\"concrete\"\n"
179 " systemcomponent=\"true\"\n"
180 " parentsystemcomponent=\"true\"\n"
181 " decoratable=\"false\"\n"
182 " useLocalIncludes=\"false\"\n"
183 " docGroupBase=\"GrpClusterWindow\"\n"
186 "\t name=\"short\"\n"
188 "\t cardinality=\"single\"\n"
189 "\t visibility=\"external\"\n"
190 "\t defaultValue=\"true\"\n"
191 "\t access=\"public\"\n"
195 "\t name=\"alpha\"\n"
197 "\t cardinality=\"single\"\n"
198 "\t visibility=\"external\"\n"
199 "\t defaultValue=\"false\"\n"
200 "\t access=\"public\"\n"
204 "\t name=\"tileSize\"\n"
205 "\t type=\"UInt32\"\n"
206 "\t cardinality=\"single\"\n"
207 "\t visibility=\"external\"\n"
208 "\t defaultValue=\"44\"\n"
209 "\t access=\"public\"\n"
212 "</FieldContainer>\n",
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType
&BinarySwapComposerBase::getType(void)
223 const FieldContainerType
&BinarySwapComposerBase::getType(void) const
228 UInt32
BinarySwapComposerBase::getContainerSize(void) const
230 return sizeof(BinarySwapComposer
);
233 /*------------------------- decorator get ------------------------------*/
236 SFBool
*BinarySwapComposerBase::editSFShort(void)
238 editSField(ShortFieldMask
);
243 const SFBool
*BinarySwapComposerBase::getSFShort(void) const
249 SFBool
*BinarySwapComposerBase::editSFAlpha(void)
251 editSField(AlphaFieldMask
);
256 const SFBool
*BinarySwapComposerBase::getSFAlpha(void) const
262 SFUInt32
*BinarySwapComposerBase::editSFTileSize(void)
264 editSField(TileSizeFieldMask
);
269 const SFUInt32
*BinarySwapComposerBase::getSFTileSize(void) const
279 /*------------------------------ access -----------------------------------*/
281 SizeT
BinarySwapComposerBase::getBinSize(ConstFieldMaskArg whichField
)
283 SizeT returnValue
= Inherited::getBinSize(whichField
);
285 if(FieldBits::NoField
!= (ShortFieldMask
& whichField
))
287 returnValue
+= _sfShort
.getBinSize();
289 if(FieldBits::NoField
!= (AlphaFieldMask
& whichField
))
291 returnValue
+= _sfAlpha
.getBinSize();
293 if(FieldBits::NoField
!= (TileSizeFieldMask
& whichField
))
295 returnValue
+= _sfTileSize
.getBinSize();
301 void BinarySwapComposerBase::copyToBin(BinaryDataHandler
&pMem
,
302 ConstFieldMaskArg whichField
)
304 Inherited::copyToBin(pMem
, whichField
);
306 if(FieldBits::NoField
!= (ShortFieldMask
& whichField
))
308 _sfShort
.copyToBin(pMem
);
310 if(FieldBits::NoField
!= (AlphaFieldMask
& whichField
))
312 _sfAlpha
.copyToBin(pMem
);
314 if(FieldBits::NoField
!= (TileSizeFieldMask
& whichField
))
316 _sfTileSize
.copyToBin(pMem
);
320 void BinarySwapComposerBase::copyFromBin(BinaryDataHandler
&pMem
,
321 ConstFieldMaskArg whichField
)
323 Inherited::copyFromBin(pMem
, whichField
);
325 if(FieldBits::NoField
!= (ShortFieldMask
& whichField
))
327 editSField(ShortFieldMask
);
328 _sfShort
.copyFromBin(pMem
);
330 if(FieldBits::NoField
!= (AlphaFieldMask
& whichField
))
332 editSField(AlphaFieldMask
);
333 _sfAlpha
.copyFromBin(pMem
);
335 if(FieldBits::NoField
!= (TileSizeFieldMask
& whichField
))
337 editSField(TileSizeFieldMask
);
338 _sfTileSize
.copyFromBin(pMem
);
342 //! create a new instance of the class
343 BinarySwapComposerTransitPtr
BinarySwapComposerBase::createLocal(BitVector bFlags
)
345 BinarySwapComposerTransitPtr fc
;
347 if(getClassType().getPrototype() != NULL
)
349 FieldContainerTransitPtr tmpPtr
=
350 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
352 fc
= dynamic_pointer_cast
<BinarySwapComposer
>(tmpPtr
);
358 //! create a new instance of the class, copy the container flags
359 BinarySwapComposerTransitPtr
BinarySwapComposerBase::createDependent(BitVector bFlags
)
361 BinarySwapComposerTransitPtr fc
;
363 if(getClassType().getPrototype() != NULL
)
365 FieldContainerTransitPtr tmpPtr
=
366 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
368 fc
= dynamic_pointer_cast
<BinarySwapComposer
>(tmpPtr
);
374 //! create a new instance of the class
375 BinarySwapComposerTransitPtr
BinarySwapComposerBase::create(void)
377 BinarySwapComposerTransitPtr fc
;
379 if(getClassType().getPrototype() != NULL
)
381 FieldContainerTransitPtr tmpPtr
=
382 getClassType().getPrototype()-> shallowCopy();
384 fc
= dynamic_pointer_cast
<BinarySwapComposer
>(tmpPtr
);
390 BinarySwapComposer
*BinarySwapComposerBase::createEmptyLocal(BitVector bFlags
)
392 BinarySwapComposer
*returnValue
;
394 newPtr
<BinarySwapComposer
>(returnValue
, bFlags
);
396 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
401 //! create an empty new instance of the class, do not copy the prototype
402 BinarySwapComposer
*BinarySwapComposerBase::createEmpty(void)
404 BinarySwapComposer
*returnValue
;
406 newPtr
<BinarySwapComposer
>(returnValue
, Thread::getCurrentLocalFlags());
408 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
409 ~Thread::getCurrentLocalFlags();
415 FieldContainerTransitPtr
BinarySwapComposerBase::shallowCopyLocal(
416 BitVector bFlags
) const
418 BinarySwapComposer
*tmpPtr
;
420 newPtr(tmpPtr
, dynamic_cast<const BinarySwapComposer
*>(this), bFlags
);
422 FieldContainerTransitPtr
returnValue(tmpPtr
);
424 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
429 FieldContainerTransitPtr
BinarySwapComposerBase::shallowCopyDependent(
430 BitVector bFlags
) const
432 BinarySwapComposer
*tmpPtr
;
434 newPtr(tmpPtr
, dynamic_cast<const BinarySwapComposer
*>(this), ~bFlags
);
436 FieldContainerTransitPtr
returnValue(tmpPtr
);
438 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
443 FieldContainerTransitPtr
BinarySwapComposerBase::shallowCopy(void) const
445 BinarySwapComposer
*tmpPtr
;
448 dynamic_cast<const BinarySwapComposer
*>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr
returnValue(tmpPtr
);
461 /*------------------------- constructors ----------------------------------*/
463 BinarySwapComposerBase::BinarySwapComposerBase(void) :
465 _sfShort (bool(true)),
466 _sfAlpha (bool(false)),
467 _sfTileSize (UInt32(44))
471 BinarySwapComposerBase::BinarySwapComposerBase(const BinarySwapComposerBase
&source
) :
473 _sfShort (source
._sfShort
),
474 _sfAlpha (source
._sfAlpha
),
475 _sfTileSize (source
._sfTileSize
)
480 /*-------------------------- destructors ----------------------------------*/
482 BinarySwapComposerBase::~BinarySwapComposerBase(void)
487 GetFieldHandlePtr
BinarySwapComposerBase::getHandleShort (void) const
489 SFBool::GetHandlePtr
returnValue(
490 new SFBool::GetHandle(
492 this->getType().getFieldDesc(ShortFieldId
),
493 const_cast<BinarySwapComposerBase
*>(this)));
498 EditFieldHandlePtr
BinarySwapComposerBase::editHandleShort (void)
500 SFBool::EditHandlePtr
returnValue(
501 new SFBool::EditHandle(
503 this->getType().getFieldDesc(ShortFieldId
),
507 editSField(ShortFieldMask
);
512 GetFieldHandlePtr
BinarySwapComposerBase::getHandleAlpha (void) const
514 SFBool::GetHandlePtr
returnValue(
515 new SFBool::GetHandle(
517 this->getType().getFieldDesc(AlphaFieldId
),
518 const_cast<BinarySwapComposerBase
*>(this)));
523 EditFieldHandlePtr
BinarySwapComposerBase::editHandleAlpha (void)
525 SFBool::EditHandlePtr
returnValue(
526 new SFBool::EditHandle(
528 this->getType().getFieldDesc(AlphaFieldId
),
532 editSField(AlphaFieldMask
);
537 GetFieldHandlePtr
BinarySwapComposerBase::getHandleTileSize (void) const
539 SFUInt32::GetHandlePtr
returnValue(
540 new SFUInt32::GetHandle(
542 this->getType().getFieldDesc(TileSizeFieldId
),
543 const_cast<BinarySwapComposerBase
*>(this)));
548 EditFieldHandlePtr
BinarySwapComposerBase::editHandleTileSize (void)
550 SFUInt32::EditHandlePtr
returnValue(
551 new SFUInt32::EditHandle(
553 this->getType().getFieldDesc(TileSizeFieldId
),
557 editSField(TileSizeFieldMask
);
563 #ifdef OSG_MT_CPTR_ASPECT
564 void BinarySwapComposerBase::execSyncV( FieldContainer
&oFrom
,
565 ConstFieldMaskArg whichField
,
566 AspectOffsetStore
&oOffsets
,
567 ConstFieldMaskArg syncMode
,
568 const UInt32 uiSyncInfo
)
570 BinarySwapComposer
*pThis
= static_cast<BinarySwapComposer
*>(this);
572 pThis
->execSync(static_cast<BinarySwapComposer
*>(&oFrom
),
581 #ifdef OSG_MT_CPTR_ASPECT
582 FieldContainer
*BinarySwapComposerBase::createAspectCopy(
583 const FieldContainer
*pRefAspect
) const
585 BinarySwapComposer
*returnValue
;
587 newAspectCopy(returnValue
,
588 dynamic_cast<const BinarySwapComposer
*>(pRefAspect
),
589 dynamic_cast<const BinarySwapComposer
*>(this));
595 void BinarySwapComposerBase::resolveLinks(void)
597 Inherited::resolveLinks();