fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Cluster / Window / SortLast / OSGSortLastWindowBase.cpp
blob6b66742df6f9f723740d42b53531571288dfee01
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 SortLastWindow!
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"
65 #include "OSGNode.h" // GroupNodes Class
67 #include "OSGSortLastWindowBase.h"
68 #include "OSGSortLastWindow.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::SortLastWindow
79 Cluster rendering configuration for sort first image composition
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Node * SortLastWindowBase::_mfGroupNodes
90 /*! \var UInt32 SortLastWindowBase::_mfGroupLengths
94 /*! \var bool SortLastWindowBase::_sfGroupsChanged
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits<SortLastWindow *, nsOSG>::_type(
105 "SortLastWindowPtr",
106 "ClusterWindowPtr",
107 SortLastWindow::getClassType(),
108 nsOSG);
109 #endif
111 OSG_FIELDTRAITS_GETTYPE_NS(SortLastWindow *, nsOSG)
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void SortLastWindowBase::classDescInserter(TypeObject &oType)
119 FieldDescriptionBase *pDesc = NULL;
122 pDesc = new MFUnrecNodePtr::Description(
123 MFUnrecNodePtr::getClassType(),
124 "groupNodes",
126 GroupNodesFieldId, GroupNodesFieldMask,
127 false,
128 (Field::MFDefaultFlags | Field::FStdAccess),
129 static_cast<FieldEditMethodSig>(&SortLastWindow::editHandleGroupNodes),
130 static_cast<FieldGetMethodSig >(&SortLastWindow::getHandleGroupNodes));
132 oType.addInitialDesc(pDesc);
134 pDesc = new MFUInt32::Description(
135 MFUInt32::getClassType(),
136 "groupLengths",
138 GroupLengthsFieldId, GroupLengthsFieldMask,
139 false,
140 (Field::MFDefaultFlags | Field::FStdAccess),
141 static_cast<FieldEditMethodSig>(&SortLastWindow::editHandleGroupLengths),
142 static_cast<FieldGetMethodSig >(&SortLastWindow::getHandleGroupLengths));
144 oType.addInitialDesc(pDesc);
146 pDesc = new SFBool::Description(
147 SFBool::getClassType(),
148 "groupsChanged",
150 GroupsChangedFieldId, GroupsChangedFieldMask,
151 true,
152 (Field::SFDefaultFlags | Field::FStdAccess),
153 static_cast<FieldEditMethodSig>(&SortLastWindow::editHandleGroupsChanged),
154 static_cast<FieldGetMethodSig >(&SortLastWindow::getHandleGroupsChanged));
156 oType.addInitialDesc(pDesc);
160 SortLastWindowBase::TypeObject SortLastWindowBase::_type(
161 SortLastWindowBase::getClassname(),
162 Inherited::getClassname(),
163 "NULL",
164 nsOSG, //Namespace
165 reinterpret_cast<PrototypeCreateF>(&SortLastWindowBase::createEmptyLocal),
166 reinterpret_cast<InitContainerF>(&SortLastWindow::initMethod),
167 reinterpret_cast<ExitContainerF>(&SortLastWindow::exitMethod),
168 reinterpret_cast<InitalInsertDescFunc>(
169 reinterpret_cast<void *>(&SortLastWindow::classDescInserter)),
170 false,
172 "<?xml version=\"1.0\"?>\n"
173 "\n"
174 "<FieldContainer\n"
175 " name=\"SortLastWindow\"\n"
176 " parent=\"ClusterWindow\"\n"
177 " library=\"Cluster\"\n"
178 " pointerfieldtypes=\"none\"\n"
179 " structure=\"concrete\"\n"
180 " systemcomponent=\"true\"\n"
181 " parentsystemcomponent=\"true\"\n"
182 " decoratable=\"false\"\n"
183 " useLocalIncludes=\"false\"\n"
184 " docGroupBase=\"GrpClusterWindow\"\n"
185 " >\n"
186 " Cluster rendering configuration for sort first image composition\n"
187 " <Field\n"
188 "\t name=\"groupNodes\"\n"
189 "\t type=\"NodePtr\"\n"
190 "\t cardinality=\"multi\"\n"
191 "\t visibility=\"external\"\n"
192 "\t access=\"protected\"\n"
193 "\t >\n"
194 " </Field>\n"
195 " <Field\n"
196 "\t name=\"groupLengths\"\n"
197 "\t type=\"UInt32\"\n"
198 "\t cardinality=\"multi\"\n"
199 "\t visibility=\"external\"\n"
200 "\t access=\"protected\"\n"
201 "\t >\n"
202 " </Field>\n"
203 " <Field\n"
204 "\t name=\"groupsChanged\"\n"
205 "\t type=\"bool\"\n"
206 "\t cardinality=\"single\"\n"
207 "\t visibility=\"internal\"\n"
208 "\t access=\"protected\"\n"
209 "\t >\n"
210 " </Field>\n"
211 "</FieldContainer>\n",
212 "Cluster rendering configuration for sort first image composition\n"
215 /*------------------------------ get -----------------------------------*/
217 FieldContainerType &SortLastWindowBase::getType(void)
219 return _type;
222 const FieldContainerType &SortLastWindowBase::getType(void) const
224 return _type;
227 UInt32 SortLastWindowBase::getContainerSize(void) const
229 return sizeof(SortLastWindow);
232 /*------------------------- decorator get ------------------------------*/
235 //! Get the SortLastWindow::_mfGroupNodes field.
236 const MFUnrecNodePtr *SortLastWindowBase::getMFGroupNodes(void) const
238 return &_mfGroupNodes;
241 MFUnrecNodePtr *SortLastWindowBase::editMFGroupNodes (void)
243 editMField(GroupNodesFieldMask, _mfGroupNodes);
245 return &_mfGroupNodes;
247 Node * SortLastWindowBase::getGroupNodes(const UInt32 index) const
249 return _mfGroupNodes[index];
252 MFUInt32 *SortLastWindowBase::editMFGroupLengths(void)
254 editMField(GroupLengthsFieldMask, _mfGroupLengths);
256 return &_mfGroupLengths;
259 const MFUInt32 *SortLastWindowBase::getMFGroupLengths(void) const
261 return &_mfGroupLengths;
265 SFBool *SortLastWindowBase::editSFGroupsChanged(void)
267 editSField(GroupsChangedFieldMask);
269 return &_sfGroupsChanged;
272 const SFBool *SortLastWindowBase::getSFGroupsChanged(void) const
274 return &_sfGroupsChanged;
280 void SortLastWindowBase::pushToGroupNodes(Node * const value)
282 editMField(GroupNodesFieldMask, _mfGroupNodes);
284 _mfGroupNodes.push_back(value);
287 void SortLastWindowBase::assignGroupNodes(const MFUnrecNodePtr &value)
289 MFUnrecNodePtr ::const_iterator elemIt =
290 value.begin();
291 MFUnrecNodePtr ::const_iterator elemEnd =
292 value.end ();
294 static_cast<SortLastWindow *>(this)->clearGroupNodes();
296 while(elemIt != elemEnd)
298 this->pushToGroupNodes(*elemIt);
300 ++elemIt;
304 void SortLastWindowBase::removeFromGroupNodes(UInt32 uiIndex)
306 if(uiIndex < _mfGroupNodes.size())
308 editMField(GroupNodesFieldMask, _mfGroupNodes);
310 _mfGroupNodes.erase(uiIndex);
314 void SortLastWindowBase::removeObjFromGroupNodes(Node * const value)
316 Int32 iElemIdx = _mfGroupNodes.findIndex(value);
318 if(iElemIdx != -1)
320 editMField(GroupNodesFieldMask, _mfGroupNodes);
322 _mfGroupNodes.erase(iElemIdx);
325 void SortLastWindowBase::clearGroupNodes(void)
327 editMField(GroupNodesFieldMask, _mfGroupNodes);
330 _mfGroupNodes.clear();
335 /*------------------------------ access -----------------------------------*/
337 SizeT SortLastWindowBase::getBinSize(ConstFieldMaskArg whichField)
339 SizeT returnValue = Inherited::getBinSize(whichField);
341 if(FieldBits::NoField != (GroupNodesFieldMask & whichField))
343 returnValue += _mfGroupNodes.getBinSize();
345 if(FieldBits::NoField != (GroupLengthsFieldMask & whichField))
347 returnValue += _mfGroupLengths.getBinSize();
349 if(FieldBits::NoField != (GroupsChangedFieldMask & whichField))
351 returnValue += _sfGroupsChanged.getBinSize();
354 return returnValue;
357 void SortLastWindowBase::copyToBin(BinaryDataHandler &pMem,
358 ConstFieldMaskArg whichField)
360 Inherited::copyToBin(pMem, whichField);
362 if(FieldBits::NoField != (GroupNodesFieldMask & whichField))
364 _mfGroupNodes.copyToBin(pMem);
366 if(FieldBits::NoField != (GroupLengthsFieldMask & whichField))
368 _mfGroupLengths.copyToBin(pMem);
370 if(FieldBits::NoField != (GroupsChangedFieldMask & whichField))
372 _sfGroupsChanged.copyToBin(pMem);
376 void SortLastWindowBase::copyFromBin(BinaryDataHandler &pMem,
377 ConstFieldMaskArg whichField)
379 Inherited::copyFromBin(pMem, whichField);
381 if(FieldBits::NoField != (GroupNodesFieldMask & whichField))
383 editMField(GroupNodesFieldMask, _mfGroupNodes);
384 _mfGroupNodes.copyFromBin(pMem);
386 if(FieldBits::NoField != (GroupLengthsFieldMask & whichField))
388 editMField(GroupLengthsFieldMask, _mfGroupLengths);
389 _mfGroupLengths.copyFromBin(pMem);
391 if(FieldBits::NoField != (GroupsChangedFieldMask & whichField))
393 editSField(GroupsChangedFieldMask);
394 _sfGroupsChanged.copyFromBin(pMem);
398 //! create a new instance of the class
399 SortLastWindowTransitPtr SortLastWindowBase::createLocal(BitVector bFlags)
401 SortLastWindowTransitPtr fc;
403 if(getClassType().getPrototype() != NULL)
405 FieldContainerTransitPtr tmpPtr =
406 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
408 fc = dynamic_pointer_cast<SortLastWindow>(tmpPtr);
411 return fc;
414 //! create a new instance of the class, copy the container flags
415 SortLastWindowTransitPtr SortLastWindowBase::createDependent(BitVector bFlags)
417 SortLastWindowTransitPtr fc;
419 if(getClassType().getPrototype() != NULL)
421 FieldContainerTransitPtr tmpPtr =
422 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
424 fc = dynamic_pointer_cast<SortLastWindow>(tmpPtr);
427 return fc;
430 //! create a new instance of the class
431 SortLastWindowTransitPtr SortLastWindowBase::create(void)
433 SortLastWindowTransitPtr fc;
435 if(getClassType().getPrototype() != NULL)
437 FieldContainerTransitPtr tmpPtr =
438 getClassType().getPrototype()-> shallowCopy();
440 fc = dynamic_pointer_cast<SortLastWindow>(tmpPtr);
443 return fc;
446 SortLastWindow *SortLastWindowBase::createEmptyLocal(BitVector bFlags)
448 SortLastWindow *returnValue;
450 newPtr<SortLastWindow>(returnValue, bFlags);
452 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
454 return returnValue;
457 //! create an empty new instance of the class, do not copy the prototype
458 SortLastWindow *SortLastWindowBase::createEmpty(void)
460 SortLastWindow *returnValue;
462 newPtr<SortLastWindow>(returnValue, Thread::getCurrentLocalFlags());
464 returnValue->_pFieldFlags->_bNamespaceMask &=
465 ~Thread::getCurrentLocalFlags();
467 return returnValue;
471 FieldContainerTransitPtr SortLastWindowBase::shallowCopyLocal(
472 BitVector bFlags) const
474 SortLastWindow *tmpPtr;
476 newPtr(tmpPtr, dynamic_cast<const SortLastWindow *>(this), bFlags);
478 FieldContainerTransitPtr returnValue(tmpPtr);
480 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
482 return returnValue;
485 FieldContainerTransitPtr SortLastWindowBase::shallowCopyDependent(
486 BitVector bFlags) const
488 SortLastWindow *tmpPtr;
490 newPtr(tmpPtr, dynamic_cast<const SortLastWindow *>(this), ~bFlags);
492 FieldContainerTransitPtr returnValue(tmpPtr);
494 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
496 return returnValue;
499 FieldContainerTransitPtr SortLastWindowBase::shallowCopy(void) const
501 SortLastWindow *tmpPtr;
503 newPtr(tmpPtr,
504 dynamic_cast<const SortLastWindow *>(this),
505 Thread::getCurrentLocalFlags());
507 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
509 FieldContainerTransitPtr returnValue(tmpPtr);
511 return returnValue;
517 /*------------------------- constructors ----------------------------------*/
519 SortLastWindowBase::SortLastWindowBase(void) :
520 Inherited(),
521 _mfGroupNodes (),
522 _mfGroupLengths (),
523 _sfGroupsChanged ()
527 SortLastWindowBase::SortLastWindowBase(const SortLastWindowBase &source) :
528 Inherited(source),
529 _mfGroupNodes (),
530 _mfGroupLengths (source._mfGroupLengths ),
531 _sfGroupsChanged (source._sfGroupsChanged )
536 /*-------------------------- destructors ----------------------------------*/
538 SortLastWindowBase::~SortLastWindowBase(void)
542 void SortLastWindowBase::onCreate(const SortLastWindow *source)
544 Inherited::onCreate(source);
546 if(source != NULL)
548 SortLastWindow *pThis = static_cast<SortLastWindow *>(this);
550 MFUnrecNodePtr::const_iterator GroupNodesIt =
551 source->_mfGroupNodes.begin();
552 MFUnrecNodePtr::const_iterator GroupNodesEnd =
553 source->_mfGroupNodes.end ();
555 while(GroupNodesIt != GroupNodesEnd)
557 pThis->pushToGroupNodes(*GroupNodesIt);
559 ++GroupNodesIt;
564 GetFieldHandlePtr SortLastWindowBase::getHandleGroupNodes (void) const
566 MFUnrecNodePtr::GetHandlePtr returnValue(
567 new MFUnrecNodePtr::GetHandle(
568 &_mfGroupNodes,
569 this->getType().getFieldDesc(GroupNodesFieldId),
570 const_cast<SortLastWindowBase *>(this)));
572 return returnValue;
575 EditFieldHandlePtr SortLastWindowBase::editHandleGroupNodes (void)
577 MFUnrecNodePtr::EditHandlePtr returnValue(
578 new MFUnrecNodePtr::EditHandle(
579 &_mfGroupNodes,
580 this->getType().getFieldDesc(GroupNodesFieldId),
581 this));
583 returnValue->setAddMethod(
584 boost::bind(&SortLastWindow::pushToGroupNodes,
585 static_cast<SortLastWindow *>(this), _1));
586 returnValue->setRemoveMethod(
587 boost::bind(&SortLastWindow::removeFromGroupNodes,
588 static_cast<SortLastWindow *>(this), _1));
589 returnValue->setRemoveObjMethod(
590 boost::bind(&SortLastWindow::removeObjFromGroupNodes,
591 static_cast<SortLastWindow *>(this), _1));
592 returnValue->setClearMethod(
593 boost::bind(&SortLastWindow::clearGroupNodes,
594 static_cast<SortLastWindow *>(this)));
596 editMField(GroupNodesFieldMask, _mfGroupNodes);
598 return returnValue;
601 GetFieldHandlePtr SortLastWindowBase::getHandleGroupLengths (void) const
603 MFUInt32::GetHandlePtr returnValue(
604 new MFUInt32::GetHandle(
605 &_mfGroupLengths,
606 this->getType().getFieldDesc(GroupLengthsFieldId),
607 const_cast<SortLastWindowBase *>(this)));
609 return returnValue;
612 EditFieldHandlePtr SortLastWindowBase::editHandleGroupLengths (void)
614 MFUInt32::EditHandlePtr returnValue(
615 new MFUInt32::EditHandle(
616 &_mfGroupLengths,
617 this->getType().getFieldDesc(GroupLengthsFieldId),
618 this));
621 editMField(GroupLengthsFieldMask, _mfGroupLengths);
623 return returnValue;
626 GetFieldHandlePtr SortLastWindowBase::getHandleGroupsChanged (void) const
628 SFBool::GetHandlePtr returnValue(
629 new SFBool::GetHandle(
630 &_sfGroupsChanged,
631 this->getType().getFieldDesc(GroupsChangedFieldId),
632 const_cast<SortLastWindowBase *>(this)));
634 return returnValue;
637 EditFieldHandlePtr SortLastWindowBase::editHandleGroupsChanged (void)
639 SFBool::EditHandlePtr returnValue(
640 new SFBool::EditHandle(
641 &_sfGroupsChanged,
642 this->getType().getFieldDesc(GroupsChangedFieldId),
643 this));
646 editSField(GroupsChangedFieldMask);
648 return returnValue;
652 #ifdef OSG_MT_CPTR_ASPECT
653 void SortLastWindowBase::execSyncV( FieldContainer &oFrom,
654 ConstFieldMaskArg whichField,
655 AspectOffsetStore &oOffsets,
656 ConstFieldMaskArg syncMode,
657 const UInt32 uiSyncInfo)
659 SortLastWindow *pThis = static_cast<SortLastWindow *>(this);
661 pThis->execSync(static_cast<SortLastWindow *>(&oFrom),
662 whichField,
663 oOffsets,
664 syncMode,
665 uiSyncInfo);
667 #endif
670 #ifdef OSG_MT_CPTR_ASPECT
671 FieldContainer *SortLastWindowBase::createAspectCopy(
672 const FieldContainer *pRefAspect) const
674 SortLastWindow *returnValue;
676 newAspectCopy(returnValue,
677 dynamic_cast<const SortLastWindow *>(pRefAspect),
678 dynamic_cast<const SortLastWindow *>(this));
680 return returnValue;
682 #endif
684 void SortLastWindowBase::resolveLinks(void)
686 Inherited::resolveLinks();
688 static_cast<SortLastWindow *>(this)->clearGroupNodes();
690 #ifdef OSG_MT_CPTR_ASPECT
691 AspectOffsetStore oOffsets;
693 _pAspectStore->fillOffsetArray(oOffsets, this);
694 #endif
696 #ifdef OSG_MT_CPTR_ASPECT
697 _mfGroupLengths.terminateShare(Thread::getCurrentAspect(),
698 oOffsets);
699 #endif
703 OSG_END_NAMESPACE