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 BalancedMultiWindow!
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 "OSGBalancedMultiWindowBase.h"
67 #include "OSGBalancedMultiWindow.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::BalancedMultiWindow
78 Load balanced sort first rendering for multiple windows
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var bool BalancedMultiWindowBase::_sfBalance
86 If true load balancing is eanbled. If falst it behaves like a
90 /*! \var bool BalancedMultiWindowBase::_sfBestCut
91 If true horizontal and vertical cuts are testet. Otherwise the longes side
92 of a viewport is split.
95 /*! \var bool BalancedMultiWindowBase::_sfShowBalancing
96 Mark regions rendered by other hosts
99 /*! \var UInt32 BalancedMultiWindowBase::_sfTileSize
103 /*! \var bool BalancedMultiWindowBase::_sfShort
108 /***************************************************************************\
109 * FieldType/FieldTrait Instantiation *
110 \***************************************************************************/
112 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
113 PointerType FieldTraits
<BalancedMultiWindow
*, nsOSG
>::_type(
114 "BalancedMultiWindowPtr",
115 "MultiDisplayWindowPtr",
116 BalancedMultiWindow::getClassType(),
120 OSG_FIELDTRAITS_GETTYPE_NS(BalancedMultiWindow
*, nsOSG
)
122 /***************************************************************************\
123 * Field Description *
124 \***************************************************************************/
126 void BalancedMultiWindowBase::classDescInserter(TypeObject
&oType
)
128 FieldDescriptionBase
*pDesc
= NULL
;
131 pDesc
= new SFBool::Description(
132 SFBool::getClassType(),
134 "If true load balancing is eanbled. If falst it behaves like a\n"
135 "MultiDisplayWindow \n",
136 BalanceFieldId
, BalanceFieldMask
,
138 (Field::SFDefaultFlags
| Field::FStdAccess
),
139 static_cast<FieldEditMethodSig
>(&BalancedMultiWindow::editHandleBalance
),
140 static_cast<FieldGetMethodSig
>(&BalancedMultiWindow::getHandleBalance
));
142 oType
.addInitialDesc(pDesc
);
144 pDesc
= new SFBool::Description(
145 SFBool::getClassType(),
147 "If true horizontal and vertical cuts are testet. Otherwise the longes side\n"
148 "of a viewport is split. \n",
149 BestCutFieldId
, BestCutFieldMask
,
151 (Field::SFDefaultFlags
| Field::FStdAccess
),
152 static_cast<FieldEditMethodSig
>(&BalancedMultiWindow::editHandleBestCut
),
153 static_cast<FieldGetMethodSig
>(&BalancedMultiWindow::getHandleBestCut
));
155 oType
.addInitialDesc(pDesc
);
157 pDesc
= new SFBool::Description(
158 SFBool::getClassType(),
160 "Mark regions rendered by other hosts\n",
161 ShowBalancingFieldId
, ShowBalancingFieldMask
,
163 (Field::SFDefaultFlags
| Field::FStdAccess
),
164 static_cast<FieldEditMethodSig
>(&BalancedMultiWindow::editHandleShowBalancing
),
165 static_cast<FieldGetMethodSig
>(&BalancedMultiWindow::getHandleShowBalancing
));
167 oType
.addInitialDesc(pDesc
);
169 pDesc
= new SFUInt32::Description(
170 SFUInt32::getClassType(),
173 TileSizeFieldId
, TileSizeFieldMask
,
175 (Field::SFDefaultFlags
| Field::FStdAccess
),
176 static_cast<FieldEditMethodSig
>(&BalancedMultiWindow::editHandleTileSize
),
177 static_cast<FieldGetMethodSig
>(&BalancedMultiWindow::getHandleTileSize
));
179 oType
.addInitialDesc(pDesc
);
181 pDesc
= new SFBool::Description(
182 SFBool::getClassType(),
185 ShortFieldId
, ShortFieldMask
,
187 (Field::SFDefaultFlags
| Field::FStdAccess
),
188 static_cast<FieldEditMethodSig
>(&BalancedMultiWindow::editHandleShort
),
189 static_cast<FieldGetMethodSig
>(&BalancedMultiWindow::getHandleShort
));
191 oType
.addInitialDesc(pDesc
);
195 BalancedMultiWindowBase::TypeObject
BalancedMultiWindowBase::_type(
196 BalancedMultiWindowBase::getClassname(),
197 Inherited::getClassname(),
200 reinterpret_cast<PrototypeCreateF
>(&BalancedMultiWindowBase::createEmptyLocal
),
201 reinterpret_cast<InitContainerF
>(&BalancedMultiWindow::initMethod
),
202 reinterpret_cast<ExitContainerF
>(&BalancedMultiWindow::exitMethod
),
203 reinterpret_cast<InitalInsertDescFunc
>(
204 reinterpret_cast<void *>(&BalancedMultiWindow::classDescInserter
)),
207 "<?xml version=\"1.0\"?>\n"
210 " name=\"BalancedMultiWindow\"\n"
211 " parent=\"MultiDisplayWindow\"\n"
212 " library=\"Cluster\"\n"
213 " pointerfieldtypes=\"none\"\n"
214 " structure=\"concrete\"\n"
215 " systemcomponent=\"true\"\n"
216 " parentsystemcomponent=\"true\"\n"
217 " decoratable=\"false\"\n"
218 " useLocalIncludes=\"true\"\n"
219 " docGroupBase=\"GrpClusterWindow\"\n"
221 " Load balanced sort first rendering for multiple windows\n"
223 "\t name=\"balance\"\n"
225 "\t cardinality=\"single\"\n"
226 "\t visibility=\"external\"\n"
227 "\t defaultValue=\"true\"\n"
228 "\t access=\"public\"\n"
230 "\tIf true load balancing is eanbled. If falst it behaves like a\n"
231 "\tMultiDisplayWindow \n"
234 "\t name=\"bestCut\"\n"
236 "\t cardinality=\"single\"\n"
237 "\t visibility=\"external\"\n"
238 "\t defaultValue=\"true\"\n"
239 "\t access=\"public\"\n"
241 "\tIf true horizontal and vertical cuts are testet. Otherwise the longes side\n"
242 "\tof a viewport is split. \n"
245 "\t name=\"showBalancing\"\n"
247 "\t cardinality=\"single\"\n"
248 "\t visibility=\"external\"\n"
249 "\t defaultValue=\"false\"\n"
250 "\t access=\"public\"\n"
252 "\tMark regions rendered by other hosts\n"
255 "\t name=\"tileSize\"\n"
256 "\t type=\"UInt32\"\n"
257 "\t cardinality=\"single\"\n"
258 "\t visibility=\"external\"\n"
259 "\t defaultValue=\"44\"\n"
260 "\t access=\"public\"\n"
264 "\t name=\"short\"\n"
266 "\t cardinality=\"single\"\n"
267 "\t visibility=\"external\"\n"
268 "\t defaultValue=\"true\"\n"
269 "\t access=\"public\"\n"
272 "</FieldContainer>\n",
273 "Load balanced sort first rendering for multiple windows\n"
276 /*------------------------------ get -----------------------------------*/
278 FieldContainerType
&BalancedMultiWindowBase::getType(void)
283 const FieldContainerType
&BalancedMultiWindowBase::getType(void) const
288 UInt32
BalancedMultiWindowBase::getContainerSize(void) const
290 return sizeof(BalancedMultiWindow
);
293 /*------------------------- decorator get ------------------------------*/
296 SFBool
*BalancedMultiWindowBase::editSFBalance(void)
298 editSField(BalanceFieldMask
);
303 const SFBool
*BalancedMultiWindowBase::getSFBalance(void) const
309 SFBool
*BalancedMultiWindowBase::editSFBestCut(void)
311 editSField(BestCutFieldMask
);
316 const SFBool
*BalancedMultiWindowBase::getSFBestCut(void) const
322 SFBool
*BalancedMultiWindowBase::editSFShowBalancing(void)
324 editSField(ShowBalancingFieldMask
);
326 return &_sfShowBalancing
;
329 const SFBool
*BalancedMultiWindowBase::getSFShowBalancing(void) const
331 return &_sfShowBalancing
;
335 SFUInt32
*BalancedMultiWindowBase::editSFTileSize(void)
337 editSField(TileSizeFieldMask
);
342 const SFUInt32
*BalancedMultiWindowBase::getSFTileSize(void) const
348 SFBool
*BalancedMultiWindowBase::editSFShort(void)
350 editSField(ShortFieldMask
);
355 const SFBool
*BalancedMultiWindowBase::getSFShort(void) const
365 /*------------------------------ access -----------------------------------*/
367 SizeT
BalancedMultiWindowBase::getBinSize(ConstFieldMaskArg whichField
)
369 SizeT returnValue
= Inherited::getBinSize(whichField
);
371 if(FieldBits::NoField
!= (BalanceFieldMask
& whichField
))
373 returnValue
+= _sfBalance
.getBinSize();
375 if(FieldBits::NoField
!= (BestCutFieldMask
& whichField
))
377 returnValue
+= _sfBestCut
.getBinSize();
379 if(FieldBits::NoField
!= (ShowBalancingFieldMask
& whichField
))
381 returnValue
+= _sfShowBalancing
.getBinSize();
383 if(FieldBits::NoField
!= (TileSizeFieldMask
& whichField
))
385 returnValue
+= _sfTileSize
.getBinSize();
387 if(FieldBits::NoField
!= (ShortFieldMask
& whichField
))
389 returnValue
+= _sfShort
.getBinSize();
395 void BalancedMultiWindowBase::copyToBin(BinaryDataHandler
&pMem
,
396 ConstFieldMaskArg whichField
)
398 Inherited::copyToBin(pMem
, whichField
);
400 if(FieldBits::NoField
!= (BalanceFieldMask
& whichField
))
402 _sfBalance
.copyToBin(pMem
);
404 if(FieldBits::NoField
!= (BestCutFieldMask
& whichField
))
406 _sfBestCut
.copyToBin(pMem
);
408 if(FieldBits::NoField
!= (ShowBalancingFieldMask
& whichField
))
410 _sfShowBalancing
.copyToBin(pMem
);
412 if(FieldBits::NoField
!= (TileSizeFieldMask
& whichField
))
414 _sfTileSize
.copyToBin(pMem
);
416 if(FieldBits::NoField
!= (ShortFieldMask
& whichField
))
418 _sfShort
.copyToBin(pMem
);
422 void BalancedMultiWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
423 ConstFieldMaskArg whichField
)
425 Inherited::copyFromBin(pMem
, whichField
);
427 if(FieldBits::NoField
!= (BalanceFieldMask
& whichField
))
429 editSField(BalanceFieldMask
);
430 _sfBalance
.copyFromBin(pMem
);
432 if(FieldBits::NoField
!= (BestCutFieldMask
& whichField
))
434 editSField(BestCutFieldMask
);
435 _sfBestCut
.copyFromBin(pMem
);
437 if(FieldBits::NoField
!= (ShowBalancingFieldMask
& whichField
))
439 editSField(ShowBalancingFieldMask
);
440 _sfShowBalancing
.copyFromBin(pMem
);
442 if(FieldBits::NoField
!= (TileSizeFieldMask
& whichField
))
444 editSField(TileSizeFieldMask
);
445 _sfTileSize
.copyFromBin(pMem
);
447 if(FieldBits::NoField
!= (ShortFieldMask
& whichField
))
449 editSField(ShortFieldMask
);
450 _sfShort
.copyFromBin(pMem
);
454 //! create a new instance of the class
455 BalancedMultiWindowTransitPtr
BalancedMultiWindowBase::createLocal(BitVector bFlags
)
457 BalancedMultiWindowTransitPtr fc
;
459 if(getClassType().getPrototype() != NULL
)
461 FieldContainerTransitPtr tmpPtr
=
462 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
464 fc
= dynamic_pointer_cast
<BalancedMultiWindow
>(tmpPtr
);
470 //! create a new instance of the class, copy the container flags
471 BalancedMultiWindowTransitPtr
BalancedMultiWindowBase::createDependent(BitVector bFlags
)
473 BalancedMultiWindowTransitPtr fc
;
475 if(getClassType().getPrototype() != NULL
)
477 FieldContainerTransitPtr tmpPtr
=
478 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
480 fc
= dynamic_pointer_cast
<BalancedMultiWindow
>(tmpPtr
);
486 //! create a new instance of the class
487 BalancedMultiWindowTransitPtr
BalancedMultiWindowBase::create(void)
489 BalancedMultiWindowTransitPtr fc
;
491 if(getClassType().getPrototype() != NULL
)
493 FieldContainerTransitPtr tmpPtr
=
494 getClassType().getPrototype()-> shallowCopy();
496 fc
= dynamic_pointer_cast
<BalancedMultiWindow
>(tmpPtr
);
502 BalancedMultiWindow
*BalancedMultiWindowBase::createEmptyLocal(BitVector bFlags
)
504 BalancedMultiWindow
*returnValue
;
506 newPtr
<BalancedMultiWindow
>(returnValue
, bFlags
);
508 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
513 //! create an empty new instance of the class, do not copy the prototype
514 BalancedMultiWindow
*BalancedMultiWindowBase::createEmpty(void)
516 BalancedMultiWindow
*returnValue
;
518 newPtr
<BalancedMultiWindow
>(returnValue
, Thread::getCurrentLocalFlags());
520 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
521 ~Thread::getCurrentLocalFlags();
527 FieldContainerTransitPtr
BalancedMultiWindowBase::shallowCopyLocal(
528 BitVector bFlags
) const
530 BalancedMultiWindow
*tmpPtr
;
532 newPtr(tmpPtr
, dynamic_cast<const BalancedMultiWindow
*>(this), bFlags
);
534 FieldContainerTransitPtr
returnValue(tmpPtr
);
536 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
541 FieldContainerTransitPtr
BalancedMultiWindowBase::shallowCopyDependent(
542 BitVector bFlags
) const
544 BalancedMultiWindow
*tmpPtr
;
546 newPtr(tmpPtr
, dynamic_cast<const BalancedMultiWindow
*>(this), ~bFlags
);
548 FieldContainerTransitPtr
returnValue(tmpPtr
);
550 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
555 FieldContainerTransitPtr
BalancedMultiWindowBase::shallowCopy(void) const
557 BalancedMultiWindow
*tmpPtr
;
560 dynamic_cast<const BalancedMultiWindow
*>(this),
561 Thread::getCurrentLocalFlags());
563 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
565 FieldContainerTransitPtr
returnValue(tmpPtr
);
573 /*------------------------- constructors ----------------------------------*/
575 BalancedMultiWindowBase::BalancedMultiWindowBase(void) :
577 _sfBalance (bool(true)),
578 _sfBestCut (bool(true)),
579 _sfShowBalancing (bool(false)),
580 _sfTileSize (UInt32(44)),
581 _sfShort (bool(true))
585 BalancedMultiWindowBase::BalancedMultiWindowBase(const BalancedMultiWindowBase
&source
) :
587 _sfBalance (source
._sfBalance
),
588 _sfBestCut (source
._sfBestCut
),
589 _sfShowBalancing (source
._sfShowBalancing
),
590 _sfTileSize (source
._sfTileSize
),
591 _sfShort (source
._sfShort
)
596 /*-------------------------- destructors ----------------------------------*/
598 BalancedMultiWindowBase::~BalancedMultiWindowBase(void)
603 GetFieldHandlePtr
BalancedMultiWindowBase::getHandleBalance (void) const
605 SFBool::GetHandlePtr
returnValue(
606 new SFBool::GetHandle(
608 this->getType().getFieldDesc(BalanceFieldId
),
609 const_cast<BalancedMultiWindowBase
*>(this)));
614 EditFieldHandlePtr
BalancedMultiWindowBase::editHandleBalance (void)
616 SFBool::EditHandlePtr
returnValue(
617 new SFBool::EditHandle(
619 this->getType().getFieldDesc(BalanceFieldId
),
623 editSField(BalanceFieldMask
);
628 GetFieldHandlePtr
BalancedMultiWindowBase::getHandleBestCut (void) const
630 SFBool::GetHandlePtr
returnValue(
631 new SFBool::GetHandle(
633 this->getType().getFieldDesc(BestCutFieldId
),
634 const_cast<BalancedMultiWindowBase
*>(this)));
639 EditFieldHandlePtr
BalancedMultiWindowBase::editHandleBestCut (void)
641 SFBool::EditHandlePtr
returnValue(
642 new SFBool::EditHandle(
644 this->getType().getFieldDesc(BestCutFieldId
),
648 editSField(BestCutFieldMask
);
653 GetFieldHandlePtr
BalancedMultiWindowBase::getHandleShowBalancing (void) const
655 SFBool::GetHandlePtr
returnValue(
656 new SFBool::GetHandle(
658 this->getType().getFieldDesc(ShowBalancingFieldId
),
659 const_cast<BalancedMultiWindowBase
*>(this)));
664 EditFieldHandlePtr
BalancedMultiWindowBase::editHandleShowBalancing (void)
666 SFBool::EditHandlePtr
returnValue(
667 new SFBool::EditHandle(
669 this->getType().getFieldDesc(ShowBalancingFieldId
),
673 editSField(ShowBalancingFieldMask
);
678 GetFieldHandlePtr
BalancedMultiWindowBase::getHandleTileSize (void) const
680 SFUInt32::GetHandlePtr
returnValue(
681 new SFUInt32::GetHandle(
683 this->getType().getFieldDesc(TileSizeFieldId
),
684 const_cast<BalancedMultiWindowBase
*>(this)));
689 EditFieldHandlePtr
BalancedMultiWindowBase::editHandleTileSize (void)
691 SFUInt32::EditHandlePtr
returnValue(
692 new SFUInt32::EditHandle(
694 this->getType().getFieldDesc(TileSizeFieldId
),
698 editSField(TileSizeFieldMask
);
703 GetFieldHandlePtr
BalancedMultiWindowBase::getHandleShort (void) const
705 SFBool::GetHandlePtr
returnValue(
706 new SFBool::GetHandle(
708 this->getType().getFieldDesc(ShortFieldId
),
709 const_cast<BalancedMultiWindowBase
*>(this)));
714 EditFieldHandlePtr
BalancedMultiWindowBase::editHandleShort (void)
716 SFBool::EditHandlePtr
returnValue(
717 new SFBool::EditHandle(
719 this->getType().getFieldDesc(ShortFieldId
),
723 editSField(ShortFieldMask
);
729 #ifdef OSG_MT_CPTR_ASPECT
730 void BalancedMultiWindowBase::execSyncV( FieldContainer
&oFrom
,
731 ConstFieldMaskArg whichField
,
732 AspectOffsetStore
&oOffsets
,
733 ConstFieldMaskArg syncMode
,
734 const UInt32 uiSyncInfo
)
736 BalancedMultiWindow
*pThis
= static_cast<BalancedMultiWindow
*>(this);
738 pThis
->execSync(static_cast<BalancedMultiWindow
*>(&oFrom
),
747 #ifdef OSG_MT_CPTR_ASPECT
748 FieldContainer
*BalancedMultiWindowBase::createAspectCopy(
749 const FieldContainer
*pRefAspect
) const
751 BalancedMultiWindow
*returnValue
;
753 newAspectCopy(returnValue
,
754 dynamic_cast<const BalancedMultiWindow
*>(pRefAspect
),
755 dynamic_cast<const BalancedMultiWindow
*>(this));
761 void BalancedMultiWindowBase::resolveLinks(void)
763 Inherited::resolveLinks();