fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Cluster / Window / SortLast / OSGBinarySwapComposerBase.cpp
blob1ec7ae73a8cdbf61f3eabe6b00a58e5525e8faba
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 BinarySwapComposer!
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 "OSGBinarySwapComposerBase.h"
67 #include "OSGBinarySwapComposer.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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",
105 "ImageComposerPtr",
106 BinarySwapComposer::getClassType(),
107 nsOSG);
108 #endif
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(),
123 "short",
125 ShortFieldId, ShortFieldMask,
126 false,
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(),
135 "alpha",
137 AlphaFieldId, AlphaFieldMask,
138 false,
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(),
147 "tileSize",
149 TileSizeFieldId, TileSizeFieldMask,
150 false,
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(),
162 "NULL",
163 nsOSG, //Namespace
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)),
169 false,
171 "<?xml version=\"1.0\"?>\n"
172 "\n"
173 "<FieldContainer\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"
184 " >\n"
185 " <Field\n"
186 "\t name=\"short\"\n"
187 "\t type=\"bool\"\n"
188 "\t cardinality=\"single\"\n"
189 "\t visibility=\"external\"\n"
190 "\t defaultValue=\"true\"\n"
191 "\t access=\"public\"\n"
192 "\t >\n"
193 " </Field>\n"
194 " <Field\n"
195 "\t name=\"alpha\"\n"
196 "\t type=\"bool\"\n"
197 "\t cardinality=\"single\"\n"
198 "\t visibility=\"external\"\n"
199 "\t defaultValue=\"false\"\n"
200 "\t access=\"public\"\n"
201 "\t >\n"
202 " </Field>\n"
203 " <Field\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"
210 "\t >\n"
211 " </Field>\n"
212 "</FieldContainer>\n",
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType &BinarySwapComposerBase::getType(void)
220 return _type;
223 const FieldContainerType &BinarySwapComposerBase::getType(void) const
225 return _type;
228 UInt32 BinarySwapComposerBase::getContainerSize(void) const
230 return sizeof(BinarySwapComposer);
233 /*------------------------- decorator get ------------------------------*/
236 SFBool *BinarySwapComposerBase::editSFShort(void)
238 editSField(ShortFieldMask);
240 return &_sfShort;
243 const SFBool *BinarySwapComposerBase::getSFShort(void) const
245 return &_sfShort;
249 SFBool *BinarySwapComposerBase::editSFAlpha(void)
251 editSField(AlphaFieldMask);
253 return &_sfAlpha;
256 const SFBool *BinarySwapComposerBase::getSFAlpha(void) const
258 return &_sfAlpha;
262 SFUInt32 *BinarySwapComposerBase::editSFTileSize(void)
264 editSField(TileSizeFieldMask);
266 return &_sfTileSize;
269 const SFUInt32 *BinarySwapComposerBase::getSFTileSize(void) const
271 return &_sfTileSize;
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();
298 return returnValue;
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);
355 return fc;
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);
371 return fc;
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);
387 return fc;
390 BinarySwapComposer *BinarySwapComposerBase::createEmptyLocal(BitVector bFlags)
392 BinarySwapComposer *returnValue;
394 newPtr<BinarySwapComposer>(returnValue, bFlags);
396 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
398 return returnValue;
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();
411 return returnValue;
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;
426 return returnValue;
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;
440 return returnValue;
443 FieldContainerTransitPtr BinarySwapComposerBase::shallowCopy(void) const
445 BinarySwapComposer *tmpPtr;
447 newPtr(tmpPtr,
448 dynamic_cast<const BinarySwapComposer *>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr returnValue(tmpPtr);
455 return returnValue;
461 /*------------------------- constructors ----------------------------------*/
463 BinarySwapComposerBase::BinarySwapComposerBase(void) :
464 Inherited(),
465 _sfShort (bool(true)),
466 _sfAlpha (bool(false)),
467 _sfTileSize (UInt32(44))
471 BinarySwapComposerBase::BinarySwapComposerBase(const BinarySwapComposerBase &source) :
472 Inherited(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(
491 &_sfShort,
492 this->getType().getFieldDesc(ShortFieldId),
493 const_cast<BinarySwapComposerBase *>(this)));
495 return returnValue;
498 EditFieldHandlePtr BinarySwapComposerBase::editHandleShort (void)
500 SFBool::EditHandlePtr returnValue(
501 new SFBool::EditHandle(
502 &_sfShort,
503 this->getType().getFieldDesc(ShortFieldId),
504 this));
507 editSField(ShortFieldMask);
509 return returnValue;
512 GetFieldHandlePtr BinarySwapComposerBase::getHandleAlpha (void) const
514 SFBool::GetHandlePtr returnValue(
515 new SFBool::GetHandle(
516 &_sfAlpha,
517 this->getType().getFieldDesc(AlphaFieldId),
518 const_cast<BinarySwapComposerBase *>(this)));
520 return returnValue;
523 EditFieldHandlePtr BinarySwapComposerBase::editHandleAlpha (void)
525 SFBool::EditHandlePtr returnValue(
526 new SFBool::EditHandle(
527 &_sfAlpha,
528 this->getType().getFieldDesc(AlphaFieldId),
529 this));
532 editSField(AlphaFieldMask);
534 return returnValue;
537 GetFieldHandlePtr BinarySwapComposerBase::getHandleTileSize (void) const
539 SFUInt32::GetHandlePtr returnValue(
540 new SFUInt32::GetHandle(
541 &_sfTileSize,
542 this->getType().getFieldDesc(TileSizeFieldId),
543 const_cast<BinarySwapComposerBase *>(this)));
545 return returnValue;
548 EditFieldHandlePtr BinarySwapComposerBase::editHandleTileSize (void)
550 SFUInt32::EditHandlePtr returnValue(
551 new SFUInt32::EditHandle(
552 &_sfTileSize,
553 this->getType().getFieldDesc(TileSizeFieldId),
554 this));
557 editSField(TileSizeFieldMask);
559 return returnValue;
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),
573 whichField,
574 oOffsets,
575 syncMode,
576 uiSyncInfo);
578 #endif
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));
591 return returnValue;
593 #endif
595 void BinarySwapComposerBase::resolveLinks(void)
597 Inherited::resolveLinks();
603 OSG_END_NAMESPACE