changed: gcc8 base update
[opensg.git] / Source / System / Cluster / Window / SortFirst / OSGSortFirstWindowBase.cpp
blob810bcc82a1933e79657d95e8f938aa6ef8a47aec
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 SortFirstWindow!
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 "OSGSortFirstWindowBase.h"
67 #include "OSGSortFirstWindow.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::SortFirstWindow
78 Cluster rendering configuration for sort first image composition
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var std::string SortFirstWindowBase::_sfCompression
89 /*! \var UInt32 SortFirstWindowBase::_sfSubtileSize
93 /*! \var bool SortFirstWindowBase::_sfCompose
94 Transmit rendered image to cleint
97 /*! \var UInt32 SortFirstWindowBase::_mfRegion
98 left,right,bottom,top for each viewport
101 /*! \var bool SortFirstWindowBase::_sfUseFaceDistribution
102 Enabe, disable analysation of face distribution
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits<SortFirstWindow *, nsOSG>::_type(
112 "SortFirstWindowPtr",
113 "ClusterWindowPtr",
114 SortFirstWindow::getClassType(),
115 nsOSG);
116 #endif
118 OSG_FIELDTRAITS_GETTYPE_NS(SortFirstWindow *, nsOSG)
120 /***************************************************************************\
121 * Field Description *
122 \***************************************************************************/
124 void SortFirstWindowBase::classDescInserter(TypeObject &oType)
126 FieldDescriptionBase *pDesc = NULL;
129 pDesc = new SFString::Description(
130 SFString::getClassType(),
131 "compression",
133 CompressionFieldId, CompressionFieldMask,
134 false,
135 (Field::SFDefaultFlags | Field::FStdAccess),
136 static_cast<FieldEditMethodSig>(&SortFirstWindow::editHandleCompression),
137 static_cast<FieldGetMethodSig >(&SortFirstWindow::getHandleCompression));
139 oType.addInitialDesc(pDesc);
141 pDesc = new SFUInt32::Description(
142 SFUInt32::getClassType(),
143 "subtileSize",
145 SubtileSizeFieldId, SubtileSizeFieldMask,
146 false,
147 (Field::SFDefaultFlags | Field::FStdAccess),
148 static_cast<FieldEditMethodSig>(&SortFirstWindow::editHandleSubtileSize),
149 static_cast<FieldGetMethodSig >(&SortFirstWindow::getHandleSubtileSize));
151 oType.addInitialDesc(pDesc);
153 pDesc = new SFBool::Description(
154 SFBool::getClassType(),
155 "compose",
156 "Transmit rendered image to cleint\n",
157 ComposeFieldId, ComposeFieldMask,
158 false,
159 (Field::SFDefaultFlags | Field::FStdAccess),
160 static_cast<FieldEditMethodSig>(&SortFirstWindow::editHandleCompose),
161 static_cast<FieldGetMethodSig >(&SortFirstWindow::getHandleCompose));
163 oType.addInitialDesc(pDesc);
165 pDesc = new MFUInt32::Description(
166 MFUInt32::getClassType(),
167 "region",
168 "left,right,bottom,top for each viewport\n",
169 RegionFieldId, RegionFieldMask,
170 false,
171 (Field::MFDefaultFlags | Field::FStdAccess),
172 static_cast<FieldEditMethodSig>(&SortFirstWindow::editHandleRegion),
173 static_cast<FieldGetMethodSig >(&SortFirstWindow::getHandleRegion));
175 oType.addInitialDesc(pDesc);
177 pDesc = new SFBool::Description(
178 SFBool::getClassType(),
179 "useFaceDistribution",
180 "Enabe, disable analysation of face distribution\n",
181 UseFaceDistributionFieldId, UseFaceDistributionFieldMask,
182 false,
183 (Field::SFDefaultFlags | Field::FStdAccess),
184 static_cast<FieldEditMethodSig>(&SortFirstWindow::editHandleUseFaceDistribution),
185 static_cast<FieldGetMethodSig >(&SortFirstWindow::getHandleUseFaceDistribution));
187 oType.addInitialDesc(pDesc);
191 SortFirstWindowBase::TypeObject SortFirstWindowBase::_type(
192 SortFirstWindowBase::getClassname(),
193 Inherited::getClassname(),
194 "NULL",
195 nsOSG, //Namespace
196 reinterpret_cast<PrototypeCreateF>(&SortFirstWindowBase::createEmptyLocal),
197 reinterpret_cast<InitContainerF>(&SortFirstWindow::initMethod),
198 reinterpret_cast<ExitContainerF>(&SortFirstWindow::exitMethod),
199 reinterpret_cast<InitalInsertDescFunc>(
200 reinterpret_cast<void *>(&SortFirstWindow::classDescInserter)),
201 false,
203 "<?xml version=\"1.0\"?>\n"
204 "\n"
205 "<FieldContainer\n"
206 " name=\"SortFirstWindow\"\n"
207 " parent=\"ClusterWindow\"\n"
208 " library=\"Cluster\"\n"
209 " pointerfieldtypes=\"none\"\n"
210 " structure=\"concrete\"\n"
211 " systemcomponent=\"true\"\n"
212 " parentsystemcomponent=\"true\"\n"
213 " decoratable=\"false\"\n"
214 " docGroupBase=\"GrpClusterWindow\"\n"
215 " >\n"
216 " Cluster rendering configuration for sort first image composition\n"
217 " <Field\n"
218 "\t name=\"compression\"\n"
219 "\t type=\"std::string\"\n"
220 "\t cardinality=\"single\"\n"
221 "\t visibility=\"external\"\n"
222 "\t access=\"public\"\n"
223 "\t >\n"
224 " </Field>\n"
225 " <Field\n"
226 "\t name=\"subtileSize\"\n"
227 "\t type=\"UInt32\"\n"
228 "\t cardinality=\"single\"\n"
229 "\t visibility=\"external\"\n"
230 "\t defaultValue=\"32\"\n"
231 "\t access=\"public\"\n"
232 "\t >\n"
233 " </Field>\n"
234 " <Field\n"
235 "\t name=\"compose\"\n"
236 "\t type=\"bool\"\n"
237 "\t cardinality=\"single\"\n"
238 "\t visibility=\"external\"\n"
239 "\t defaultValue=\"true\"\n"
240 "\t access=\"public\"\n"
241 "\t >\n"
242 "\tTransmit rendered image to cleint\n"
243 " </Field>\n"
244 " <Field\n"
245 "\t name=\"region\"\n"
246 "\t type=\"UInt32\"\n"
247 "\t cardinality=\"multi\"\n"
248 "\t visibility=\"external\"\n"
249 "\t access=\"public\"\n"
250 "\t >\n"
251 "\tleft,right,bottom,top for each viewport\n"
252 " </Field>\n"
253 " <Field\n"
254 "\t name=\"useFaceDistribution\"\n"
255 "\t type=\"bool\"\n"
256 "\t cardinality=\"single\"\n"
257 "\t visibility=\"external\"\n"
258 "\t defaultValue=\"false\"\n"
259 "\t access=\"public\"\n"
260 "\t >\n"
261 "\tEnabe, disable analysation of face distribution\n"
262 " </Field>\n"
263 "</FieldContainer>\n",
264 "Cluster rendering configuration for sort first image composition\n"
267 /*------------------------------ get -----------------------------------*/
269 FieldContainerType &SortFirstWindowBase::getType(void)
271 return _type;
274 const FieldContainerType &SortFirstWindowBase::getType(void) const
276 return _type;
279 UInt32 SortFirstWindowBase::getContainerSize(void) const
281 return sizeof(SortFirstWindow);
284 /*------------------------- decorator get ------------------------------*/
287 SFString *SortFirstWindowBase::editSFCompression(void)
289 editSField(CompressionFieldMask);
291 return &_sfCompression;
294 const SFString *SortFirstWindowBase::getSFCompression(void) const
296 return &_sfCompression;
300 SFUInt32 *SortFirstWindowBase::editSFSubtileSize(void)
302 editSField(SubtileSizeFieldMask);
304 return &_sfSubtileSize;
307 const SFUInt32 *SortFirstWindowBase::getSFSubtileSize(void) const
309 return &_sfSubtileSize;
313 SFBool *SortFirstWindowBase::editSFCompose(void)
315 editSField(ComposeFieldMask);
317 return &_sfCompose;
320 const SFBool *SortFirstWindowBase::getSFCompose(void) const
322 return &_sfCompose;
326 MFUInt32 *SortFirstWindowBase::editMFRegion(void)
328 editMField(RegionFieldMask, _mfRegion);
330 return &_mfRegion;
333 const MFUInt32 *SortFirstWindowBase::getMFRegion(void) const
335 return &_mfRegion;
339 SFBool *SortFirstWindowBase::editSFUseFaceDistribution(void)
341 editSField(UseFaceDistributionFieldMask);
343 return &_sfUseFaceDistribution;
346 const SFBool *SortFirstWindowBase::getSFUseFaceDistribution(void) const
348 return &_sfUseFaceDistribution;
356 /*------------------------------ access -----------------------------------*/
358 SizeT SortFirstWindowBase::getBinSize(ConstFieldMaskArg whichField)
360 SizeT returnValue = Inherited::getBinSize(whichField);
362 if(FieldBits::NoField != (CompressionFieldMask & whichField))
364 returnValue += _sfCompression.getBinSize();
366 if(FieldBits::NoField != (SubtileSizeFieldMask & whichField))
368 returnValue += _sfSubtileSize.getBinSize();
370 if(FieldBits::NoField != (ComposeFieldMask & whichField))
372 returnValue += _sfCompose.getBinSize();
374 if(FieldBits::NoField != (RegionFieldMask & whichField))
376 returnValue += _mfRegion.getBinSize();
378 if(FieldBits::NoField != (UseFaceDistributionFieldMask & whichField))
380 returnValue += _sfUseFaceDistribution.getBinSize();
383 return returnValue;
386 void SortFirstWindowBase::copyToBin(BinaryDataHandler &pMem,
387 ConstFieldMaskArg whichField)
389 Inherited::copyToBin(pMem, whichField);
391 if(FieldBits::NoField != (CompressionFieldMask & whichField))
393 _sfCompression.copyToBin(pMem);
395 if(FieldBits::NoField != (SubtileSizeFieldMask & whichField))
397 _sfSubtileSize.copyToBin(pMem);
399 if(FieldBits::NoField != (ComposeFieldMask & whichField))
401 _sfCompose.copyToBin(pMem);
403 if(FieldBits::NoField != (RegionFieldMask & whichField))
405 _mfRegion.copyToBin(pMem);
407 if(FieldBits::NoField != (UseFaceDistributionFieldMask & whichField))
409 _sfUseFaceDistribution.copyToBin(pMem);
413 void SortFirstWindowBase::copyFromBin(BinaryDataHandler &pMem,
414 ConstFieldMaskArg whichField)
416 Inherited::copyFromBin(pMem, whichField);
418 if(FieldBits::NoField != (CompressionFieldMask & whichField))
420 editSField(CompressionFieldMask);
421 _sfCompression.copyFromBin(pMem);
423 if(FieldBits::NoField != (SubtileSizeFieldMask & whichField))
425 editSField(SubtileSizeFieldMask);
426 _sfSubtileSize.copyFromBin(pMem);
428 if(FieldBits::NoField != (ComposeFieldMask & whichField))
430 editSField(ComposeFieldMask);
431 _sfCompose.copyFromBin(pMem);
433 if(FieldBits::NoField != (RegionFieldMask & whichField))
435 editMField(RegionFieldMask, _mfRegion);
436 _mfRegion.copyFromBin(pMem);
438 if(FieldBits::NoField != (UseFaceDistributionFieldMask & whichField))
440 editSField(UseFaceDistributionFieldMask);
441 _sfUseFaceDistribution.copyFromBin(pMem);
445 //! create a new instance of the class
446 SortFirstWindowTransitPtr SortFirstWindowBase::createLocal(BitVector bFlags)
448 SortFirstWindowTransitPtr fc;
450 if(getClassType().getPrototype() != NULL)
452 FieldContainerTransitPtr tmpPtr =
453 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
455 fc = dynamic_pointer_cast<SortFirstWindow>(tmpPtr);
458 return fc;
461 //! create a new instance of the class, copy the container flags
462 SortFirstWindowTransitPtr SortFirstWindowBase::createDependent(BitVector bFlags)
464 SortFirstWindowTransitPtr fc;
466 if(getClassType().getPrototype() != NULL)
468 FieldContainerTransitPtr tmpPtr =
469 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
471 fc = dynamic_pointer_cast<SortFirstWindow>(tmpPtr);
474 return fc;
477 //! create a new instance of the class
478 SortFirstWindowTransitPtr SortFirstWindowBase::create(void)
480 SortFirstWindowTransitPtr fc;
482 if(getClassType().getPrototype() != NULL)
484 FieldContainerTransitPtr tmpPtr =
485 getClassType().getPrototype()-> shallowCopy();
487 fc = dynamic_pointer_cast<SortFirstWindow>(tmpPtr);
490 return fc;
493 SortFirstWindow *SortFirstWindowBase::createEmptyLocal(BitVector bFlags)
495 SortFirstWindow *returnValue;
497 newPtr<SortFirstWindow>(returnValue, bFlags);
499 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
501 return returnValue;
504 //! create an empty new instance of the class, do not copy the prototype
505 SortFirstWindow *SortFirstWindowBase::createEmpty(void)
507 SortFirstWindow *returnValue;
509 newPtr<SortFirstWindow>(returnValue, Thread::getCurrentLocalFlags());
511 returnValue->_pFieldFlags->_bNamespaceMask &=
512 ~Thread::getCurrentLocalFlags();
514 return returnValue;
518 FieldContainerTransitPtr SortFirstWindowBase::shallowCopyLocal(
519 BitVector bFlags) const
521 SortFirstWindow *tmpPtr;
523 newPtr(tmpPtr, dynamic_cast<const SortFirstWindow *>(this), bFlags);
525 FieldContainerTransitPtr returnValue(tmpPtr);
527 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
529 return returnValue;
532 FieldContainerTransitPtr SortFirstWindowBase::shallowCopyDependent(
533 BitVector bFlags) const
535 SortFirstWindow *tmpPtr;
537 newPtr(tmpPtr, dynamic_cast<const SortFirstWindow *>(this), ~bFlags);
539 FieldContainerTransitPtr returnValue(tmpPtr);
541 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
543 return returnValue;
546 FieldContainerTransitPtr SortFirstWindowBase::shallowCopy(void) const
548 SortFirstWindow *tmpPtr;
550 newPtr(tmpPtr,
551 dynamic_cast<const SortFirstWindow *>(this),
552 Thread::getCurrentLocalFlags());
554 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
556 FieldContainerTransitPtr returnValue(tmpPtr);
558 return returnValue;
564 /*------------------------- constructors ----------------------------------*/
566 SortFirstWindowBase::SortFirstWindowBase(void) :
567 Inherited(),
568 _sfCompression (),
569 _sfSubtileSize (UInt32(32)),
570 _sfCompose (bool(true)),
571 _mfRegion (),
572 _sfUseFaceDistribution (bool(false))
576 SortFirstWindowBase::SortFirstWindowBase(const SortFirstWindowBase &source) :
577 Inherited(source),
578 _sfCompression (source._sfCompression ),
579 _sfSubtileSize (source._sfSubtileSize ),
580 _sfCompose (source._sfCompose ),
581 _mfRegion (source._mfRegion ),
582 _sfUseFaceDistribution (source._sfUseFaceDistribution )
587 /*-------------------------- destructors ----------------------------------*/
589 SortFirstWindowBase::~SortFirstWindowBase(void)
594 GetFieldHandlePtr SortFirstWindowBase::getHandleCompression (void) const
596 SFString::GetHandlePtr returnValue(
597 new SFString::GetHandle(
598 &_sfCompression,
599 this->getType().getFieldDesc(CompressionFieldId),
600 const_cast<SortFirstWindowBase *>(this)));
602 return returnValue;
605 EditFieldHandlePtr SortFirstWindowBase::editHandleCompression (void)
607 SFString::EditHandlePtr returnValue(
608 new SFString::EditHandle(
609 &_sfCompression,
610 this->getType().getFieldDesc(CompressionFieldId),
611 this));
614 editSField(CompressionFieldMask);
616 return returnValue;
619 GetFieldHandlePtr SortFirstWindowBase::getHandleSubtileSize (void) const
621 SFUInt32::GetHandlePtr returnValue(
622 new SFUInt32::GetHandle(
623 &_sfSubtileSize,
624 this->getType().getFieldDesc(SubtileSizeFieldId),
625 const_cast<SortFirstWindowBase *>(this)));
627 return returnValue;
630 EditFieldHandlePtr SortFirstWindowBase::editHandleSubtileSize (void)
632 SFUInt32::EditHandlePtr returnValue(
633 new SFUInt32::EditHandle(
634 &_sfSubtileSize,
635 this->getType().getFieldDesc(SubtileSizeFieldId),
636 this));
639 editSField(SubtileSizeFieldMask);
641 return returnValue;
644 GetFieldHandlePtr SortFirstWindowBase::getHandleCompose (void) const
646 SFBool::GetHandlePtr returnValue(
647 new SFBool::GetHandle(
648 &_sfCompose,
649 this->getType().getFieldDesc(ComposeFieldId),
650 const_cast<SortFirstWindowBase *>(this)));
652 return returnValue;
655 EditFieldHandlePtr SortFirstWindowBase::editHandleCompose (void)
657 SFBool::EditHandlePtr returnValue(
658 new SFBool::EditHandle(
659 &_sfCompose,
660 this->getType().getFieldDesc(ComposeFieldId),
661 this));
664 editSField(ComposeFieldMask);
666 return returnValue;
669 GetFieldHandlePtr SortFirstWindowBase::getHandleRegion (void) const
671 MFUInt32::GetHandlePtr returnValue(
672 new MFUInt32::GetHandle(
673 &_mfRegion,
674 this->getType().getFieldDesc(RegionFieldId),
675 const_cast<SortFirstWindowBase *>(this)));
677 return returnValue;
680 EditFieldHandlePtr SortFirstWindowBase::editHandleRegion (void)
682 MFUInt32::EditHandlePtr returnValue(
683 new MFUInt32::EditHandle(
684 &_mfRegion,
685 this->getType().getFieldDesc(RegionFieldId),
686 this));
689 editMField(RegionFieldMask, _mfRegion);
691 return returnValue;
694 GetFieldHandlePtr SortFirstWindowBase::getHandleUseFaceDistribution (void) const
696 SFBool::GetHandlePtr returnValue(
697 new SFBool::GetHandle(
698 &_sfUseFaceDistribution,
699 this->getType().getFieldDesc(UseFaceDistributionFieldId),
700 const_cast<SortFirstWindowBase *>(this)));
702 return returnValue;
705 EditFieldHandlePtr SortFirstWindowBase::editHandleUseFaceDistribution(void)
707 SFBool::EditHandlePtr returnValue(
708 new SFBool::EditHandle(
709 &_sfUseFaceDistribution,
710 this->getType().getFieldDesc(UseFaceDistributionFieldId),
711 this));
714 editSField(UseFaceDistributionFieldMask);
716 return returnValue;
720 #ifdef OSG_MT_CPTR_ASPECT
721 void SortFirstWindowBase::execSyncV( FieldContainer &oFrom,
722 ConstFieldMaskArg whichField,
723 AspectOffsetStore &oOffsets,
724 ConstFieldMaskArg syncMode,
725 const UInt32 uiSyncInfo)
727 SortFirstWindow *pThis = static_cast<SortFirstWindow *>(this);
729 pThis->execSync(static_cast<SortFirstWindow *>(&oFrom),
730 whichField,
731 oOffsets,
732 syncMode,
733 uiSyncInfo);
735 #endif
738 #ifdef OSG_MT_CPTR_ASPECT
739 FieldContainer *SortFirstWindowBase::createAspectCopy(
740 const FieldContainer *pRefAspect) const
742 SortFirstWindow *returnValue;
744 newAspectCopy(returnValue,
745 dynamic_cast<const SortFirstWindow *>(pRefAspect),
746 dynamic_cast<const SortFirstWindow *>(this));
748 return returnValue;
750 #endif
752 void SortFirstWindowBase::resolveLinks(void)
754 Inherited::resolveLinks();
756 #ifdef OSG_MT_CPTR_ASPECT
757 AspectOffsetStore oOffsets;
759 _pAspectStore->fillOffsetArray(oOffsets, this);
760 #endif
762 #ifdef OSG_MT_CPTR_ASPECT
763 _mfRegion.terminateShare(Thread::getCurrentAspect(),
764 oOffsets);
765 #endif
769 OSG_END_NAMESPACE