fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComplexSceneManager / Helper / OSGCSMStatisticsForegroundBase.cpp
blob031684d249feed7a27f1694035f9a0a40f82468c
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 CSMStatisticsForeground!
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 "OSGCSMStatisticsForegroundBase.h"
67 #include "OSGCSMStatisticsForeground.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::CSMStatisticsForeground
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt32 CSMStatisticsForegroundBase::_sfSize
89 /*! \var Color4f CSMStatisticsForegroundBase::_sfColor
93 /*! \var Color4f CSMStatisticsForegroundBase::_sfBgColor
97 /*! \var std::string CSMStatisticsForegroundBase::_mfElements
102 /***************************************************************************\
103 * FieldType/FieldTrait Instantiation *
104 \***************************************************************************/
106 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
107 PointerType FieldTraits<CSMStatisticsForeground *, nsOSG>::_type(
108 "CSMStatisticsForegroundPtr",
109 "ForegroundPtr",
110 CSMStatisticsForeground::getClassType(),
111 nsOSG);
112 #endif
114 OSG_FIELDTRAITS_GETTYPE_NS(CSMStatisticsForeground *, nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void CSMStatisticsForegroundBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFUInt32::Description(
126 SFUInt32::getClassType(),
127 "size",
129 SizeFieldId, SizeFieldMask,
130 false,
131 (Field::SFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&CSMStatisticsForeground::editHandleSize),
133 static_cast<FieldGetMethodSig >(&CSMStatisticsForeground::getHandleSize));
135 oType.addInitialDesc(pDesc);
137 pDesc = new SFColor4f::Description(
138 SFColor4f::getClassType(),
139 "color",
141 ColorFieldId, ColorFieldMask,
142 false,
143 (Field::SFDefaultFlags | Field::FStdAccess),
144 static_cast<FieldEditMethodSig>(&CSMStatisticsForeground::editHandleColor),
145 static_cast<FieldGetMethodSig >(&CSMStatisticsForeground::getHandleColor));
147 oType.addInitialDesc(pDesc);
149 pDesc = new SFColor4f::Description(
150 SFColor4f::getClassType(),
151 "bgColor",
153 BgColorFieldId, BgColorFieldMask,
154 false,
155 (Field::SFDefaultFlags | Field::FStdAccess),
156 static_cast<FieldEditMethodSig>(&CSMStatisticsForeground::editHandleBgColor),
157 static_cast<FieldGetMethodSig >(&CSMStatisticsForeground::getHandleBgColor));
159 oType.addInitialDesc(pDesc);
161 pDesc = new MFString::Description(
162 MFString::getClassType(),
163 "elements",
165 ElementsFieldId, ElementsFieldMask,
166 false,
167 (Field::MFDefaultFlags | Field::FStdAccess),
168 static_cast<FieldEditMethodSig>(&CSMStatisticsForeground::editHandleElements),
169 static_cast<FieldGetMethodSig >(&CSMStatisticsForeground::getHandleElements));
171 oType.addInitialDesc(pDesc);
175 CSMStatisticsForegroundBase::TypeObject CSMStatisticsForegroundBase::_type(
176 CSMStatisticsForegroundBase::getClassname(),
177 Inherited::getClassname(),
178 "NULL",
179 nsOSG, //Namespace
180 reinterpret_cast<PrototypeCreateF>(&CSMStatisticsForegroundBase::createEmptyLocal),
181 reinterpret_cast<InitContainerF>(&CSMStatisticsForeground::initMethod),
182 reinterpret_cast<ExitContainerF>(&CSMStatisticsForeground::exitMethod),
183 reinterpret_cast<InitalInsertDescFunc>(
184 reinterpret_cast<void *>(&CSMStatisticsForeground::classDescInserter)),
185 false,
187 "<?xml version=\"1.0\"?>\n"
188 "\n"
189 "<FieldContainer\n"
190 " name=\"CSMStatisticsForeground\"\n"
191 " parent=\"Foreground\"\n"
192 " library=\"ContribCSM\"\n"
193 " pointerfieldtypes=\"none\"\n"
194 " structure=\"concrete\"\n"
195 " systemcomponent=\"true\"\n"
196 " parentsystemcomponent=\"true\"\n"
197 " decoratable=\"false\"\n"
198 " useLocalIncludes=\"false\"\n"
199 " isNodeCore=\"false\"\n"
200 " isBundle=\"true\"\n"
201 " parentFields=\"none\"\n"
202 " >\n"
203 " <Field\n"
204 " name=\"size\"\n"
205 " type=\"UInt32\"\n"
206 " cardinality=\"single\"\n"
207 " visibility=\"external\"\n"
208 " access=\"public\"\n"
209 " defaultValue=\"25\"\n"
210 " >\n"
211 " </Field>\n"
212 " <Field\n"
213 " name=\"color\"\n"
214 " type=\"Color4f\"\n"
215 " cardinality=\"single\"\n"
216 " visibility=\"external\"\n"
217 " access=\"public\"\n"
218 " defaultValue=\"0.0, 1.0, 0.0, 0.7\"\n"
219 " >\n"
220 " </Field>\n"
221 " <Field\n"
222 " name=\"bgColor\"\n"
223 " type=\"Color4f\"\n"
224 " cardinality=\"single\"\n"
225 " visibility=\"external\"\n"
226 " access=\"public\"\n"
227 " defaultValue=\"0.0, 0.0, 0.0, 0.0\"\n"
228 " >\n"
229 " </Field>\n"
230 " <Field\n"
231 " name=\"elements\"\n"
232 " type=\"std::string\"\n"
233 " cardinality=\"multi\"\n"
234 " visibility=\"external\"\n"
235 " access=\"public\"\n"
236 " >\n"
237 " </Field>\n"
238 "</FieldContainer>\n",
242 /*------------------------------ get -----------------------------------*/
244 FieldContainerType &CSMStatisticsForegroundBase::getType(void)
246 return _type;
249 const FieldContainerType &CSMStatisticsForegroundBase::getType(void) const
251 return _type;
254 UInt32 CSMStatisticsForegroundBase::getContainerSize(void) const
256 return sizeof(CSMStatisticsForeground);
259 /*------------------------- decorator get ------------------------------*/
262 SFUInt32 *CSMStatisticsForegroundBase::editSFSize(void)
264 editSField(SizeFieldMask);
266 return &_sfSize;
269 const SFUInt32 *CSMStatisticsForegroundBase::getSFSize(void) const
271 return &_sfSize;
275 SFColor4f *CSMStatisticsForegroundBase::editSFColor(void)
277 editSField(ColorFieldMask);
279 return &_sfColor;
282 const SFColor4f *CSMStatisticsForegroundBase::getSFColor(void) const
284 return &_sfColor;
288 SFColor4f *CSMStatisticsForegroundBase::editSFBgColor(void)
290 editSField(BgColorFieldMask);
292 return &_sfBgColor;
295 const SFColor4f *CSMStatisticsForegroundBase::getSFBgColor(void) const
297 return &_sfBgColor;
301 MFString *CSMStatisticsForegroundBase::editMFElements(void)
303 editMField(ElementsFieldMask, _mfElements);
305 return &_mfElements;
308 const MFString *CSMStatisticsForegroundBase::getMFElements(void) const
310 return &_mfElements;
318 /*------------------------------ access -----------------------------------*/
320 SizeT CSMStatisticsForegroundBase::getBinSize(ConstFieldMaskArg whichField)
322 SizeT returnValue = Inherited::getBinSize(whichField);
324 if(FieldBits::NoField != (SizeFieldMask & whichField))
326 returnValue += _sfSize.getBinSize();
328 if(FieldBits::NoField != (ColorFieldMask & whichField))
330 returnValue += _sfColor.getBinSize();
332 if(FieldBits::NoField != (BgColorFieldMask & whichField))
334 returnValue += _sfBgColor.getBinSize();
336 if(FieldBits::NoField != (ElementsFieldMask & whichField))
338 returnValue += _mfElements.getBinSize();
341 return returnValue;
344 void CSMStatisticsForegroundBase::copyToBin(BinaryDataHandler &pMem,
345 ConstFieldMaskArg whichField)
347 Inherited::copyToBin(pMem, whichField);
349 if(FieldBits::NoField != (SizeFieldMask & whichField))
351 _sfSize.copyToBin(pMem);
353 if(FieldBits::NoField != (ColorFieldMask & whichField))
355 _sfColor.copyToBin(pMem);
357 if(FieldBits::NoField != (BgColorFieldMask & whichField))
359 _sfBgColor.copyToBin(pMem);
361 if(FieldBits::NoField != (ElementsFieldMask & whichField))
363 _mfElements.copyToBin(pMem);
367 void CSMStatisticsForegroundBase::copyFromBin(BinaryDataHandler &pMem,
368 ConstFieldMaskArg whichField)
370 Inherited::copyFromBin(pMem, whichField);
372 if(FieldBits::NoField != (SizeFieldMask & whichField))
374 editSField(SizeFieldMask);
375 _sfSize.copyFromBin(pMem);
377 if(FieldBits::NoField != (ColorFieldMask & whichField))
379 editSField(ColorFieldMask);
380 _sfColor.copyFromBin(pMem);
382 if(FieldBits::NoField != (BgColorFieldMask & whichField))
384 editSField(BgColorFieldMask);
385 _sfBgColor.copyFromBin(pMem);
387 if(FieldBits::NoField != (ElementsFieldMask & whichField))
389 editMField(ElementsFieldMask, _mfElements);
390 _mfElements.copyFromBin(pMem);
394 //! create a new instance of the class
395 CSMStatisticsForegroundTransitPtr CSMStatisticsForegroundBase::createLocal(BitVector bFlags)
397 CSMStatisticsForegroundTransitPtr fc;
399 if(getClassType().getPrototype() != NULL)
401 FieldContainerTransitPtr tmpPtr =
402 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
404 fc = dynamic_pointer_cast<CSMStatisticsForeground>(tmpPtr);
407 return fc;
410 //! create a new instance of the class, copy the container flags
411 CSMStatisticsForegroundTransitPtr CSMStatisticsForegroundBase::createDependent(BitVector bFlags)
413 CSMStatisticsForegroundTransitPtr fc;
415 if(getClassType().getPrototype() != NULL)
417 FieldContainerTransitPtr tmpPtr =
418 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
420 fc = dynamic_pointer_cast<CSMStatisticsForeground>(tmpPtr);
423 return fc;
426 //! create a new instance of the class
427 CSMStatisticsForegroundTransitPtr CSMStatisticsForegroundBase::create(void)
429 return createLocal();
432 CSMStatisticsForeground *CSMStatisticsForegroundBase::createEmptyLocal(BitVector bFlags)
434 CSMStatisticsForeground *returnValue;
436 newPtr<CSMStatisticsForeground>(returnValue, bFlags);
438 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
440 return returnValue;
443 //! create an empty new instance of the class, do not copy the prototype
444 CSMStatisticsForeground *CSMStatisticsForegroundBase::createEmpty(void)
446 return createEmptyLocal();
450 FieldContainerTransitPtr CSMStatisticsForegroundBase::shallowCopyLocal(
451 BitVector bFlags) const
453 CSMStatisticsForeground *tmpPtr;
455 newPtr(tmpPtr, dynamic_cast<const CSMStatisticsForeground *>(this), bFlags);
457 FieldContainerTransitPtr returnValue(tmpPtr);
459 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
461 return returnValue;
464 FieldContainerTransitPtr CSMStatisticsForegroundBase::shallowCopyDependent(
465 BitVector bFlags) const
467 CSMStatisticsForeground *tmpPtr;
469 newPtr(tmpPtr, dynamic_cast<const CSMStatisticsForeground *>(this), ~bFlags);
471 FieldContainerTransitPtr returnValue(tmpPtr);
473 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
475 return returnValue;
478 FieldContainerTransitPtr CSMStatisticsForegroundBase::shallowCopy(void) const
480 return shallowCopyLocal();
486 /*------------------------- constructors ----------------------------------*/
488 CSMStatisticsForegroundBase::CSMStatisticsForegroundBase(void) :
489 Inherited(),
490 _sfSize (UInt32(25)),
491 _sfColor (Color4f(0.0, 1.0, 0.0, 0.7)),
492 _sfBgColor (Color4f(0.0, 0.0, 0.0, 0.0)),
493 _mfElements ()
497 CSMStatisticsForegroundBase::CSMStatisticsForegroundBase(const CSMStatisticsForegroundBase &source) :
498 Inherited(source),
499 _sfSize (source._sfSize ),
500 _sfColor (source._sfColor ),
501 _sfBgColor (source._sfBgColor ),
502 _mfElements (source._mfElements )
507 /*-------------------------- destructors ----------------------------------*/
509 CSMStatisticsForegroundBase::~CSMStatisticsForegroundBase(void)
514 GetFieldHandlePtr CSMStatisticsForegroundBase::getHandleSize (void) const
516 SFUInt32::GetHandlePtr returnValue(
517 new SFUInt32::GetHandle(
518 &_sfSize,
519 this->getType().getFieldDesc(SizeFieldId),
520 const_cast<CSMStatisticsForegroundBase *>(this)));
522 return returnValue;
525 EditFieldHandlePtr CSMStatisticsForegroundBase::editHandleSize (void)
527 SFUInt32::EditHandlePtr returnValue(
528 new SFUInt32::EditHandle(
529 &_sfSize,
530 this->getType().getFieldDesc(SizeFieldId),
531 this));
534 editSField(SizeFieldMask);
536 return returnValue;
539 GetFieldHandlePtr CSMStatisticsForegroundBase::getHandleColor (void) const
541 SFColor4f::GetHandlePtr returnValue(
542 new SFColor4f::GetHandle(
543 &_sfColor,
544 this->getType().getFieldDesc(ColorFieldId),
545 const_cast<CSMStatisticsForegroundBase *>(this)));
547 return returnValue;
550 EditFieldHandlePtr CSMStatisticsForegroundBase::editHandleColor (void)
552 SFColor4f::EditHandlePtr returnValue(
553 new SFColor4f::EditHandle(
554 &_sfColor,
555 this->getType().getFieldDesc(ColorFieldId),
556 this));
559 editSField(ColorFieldMask);
561 return returnValue;
564 GetFieldHandlePtr CSMStatisticsForegroundBase::getHandleBgColor (void) const
566 SFColor4f::GetHandlePtr returnValue(
567 new SFColor4f::GetHandle(
568 &_sfBgColor,
569 this->getType().getFieldDesc(BgColorFieldId),
570 const_cast<CSMStatisticsForegroundBase *>(this)));
572 return returnValue;
575 EditFieldHandlePtr CSMStatisticsForegroundBase::editHandleBgColor (void)
577 SFColor4f::EditHandlePtr returnValue(
578 new SFColor4f::EditHandle(
579 &_sfBgColor,
580 this->getType().getFieldDesc(BgColorFieldId),
581 this));
584 editSField(BgColorFieldMask);
586 return returnValue;
589 GetFieldHandlePtr CSMStatisticsForegroundBase::getHandleElements (void) const
591 MFString::GetHandlePtr returnValue(
592 new MFString::GetHandle(
593 &_mfElements,
594 this->getType().getFieldDesc(ElementsFieldId),
595 const_cast<CSMStatisticsForegroundBase *>(this)));
597 return returnValue;
600 EditFieldHandlePtr CSMStatisticsForegroundBase::editHandleElements (void)
602 MFString::EditHandlePtr returnValue(
603 new MFString::EditHandle(
604 &_mfElements,
605 this->getType().getFieldDesc(ElementsFieldId),
606 this));
609 editMField(ElementsFieldMask, _mfElements);
611 return returnValue;
615 #ifdef OSG_MT_CPTR_ASPECT
616 void CSMStatisticsForegroundBase::execSyncV( FieldContainer &oFrom,
617 ConstFieldMaskArg whichField,
618 AspectOffsetStore &oOffsets,
619 ConstFieldMaskArg syncMode,
620 const UInt32 uiSyncInfo)
622 CSMStatisticsForeground *pThis = static_cast<CSMStatisticsForeground *>(this);
624 pThis->execSync(static_cast<CSMStatisticsForeground *>(&oFrom),
625 whichField,
626 oOffsets,
627 syncMode,
628 uiSyncInfo);
630 #endif
633 #ifdef OSG_MT_CPTR_ASPECT
634 FieldContainer *CSMStatisticsForegroundBase::createAspectCopy(
635 const FieldContainer *pRefAspect) const
637 CSMStatisticsForeground *returnValue;
639 newAspectCopy(returnValue,
640 dynamic_cast<const CSMStatisticsForeground *>(pRefAspect),
641 dynamic_cast<const CSMStatisticsForeground *>(this));
643 return returnValue;
645 #endif
647 void CSMStatisticsForegroundBase::resolveLinks(void)
649 Inherited::resolveLinks();
651 #ifdef OSG_MT_CPTR_ASPECT
652 AspectOffsetStore oOffsets;
654 _pAspectStore->fillOffsetArray(oOffsets, this);
655 #endif
657 #ifdef OSG_MT_CPTR_ASPECT
658 _mfElements.terminateShare(Thread::getCurrentAspect(),
659 oOffsets);
660 #endif
664 OSG_END_NAMESPACE