fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGProxyGroupBase.cpp
blob52f3a1eb4dd30da90501b54afc27839d8f74f949
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 ProxyGroup!
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" // Root Class
67 #include "OSGProxyGroupBase.h"
68 #include "OSGProxyGroup.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::ProxyGroup
79 This group is used for delayed loading. If enabled the child
80 nodes are loaded in a second thread. Until the load is finished
81 the child nodes of this group are rendered. This could be used
82 to show a proxy object. If concurrentLoad is false, then loading
83 is done during the first frame. This is the behaviour of a simple
84 inline.
87 /***************************************************************************\
88 * Field Documentation *
89 \***************************************************************************/
91 /*! \var bool ProxyGroupBase::_sfEnabled
95 /*! \var std::string ProxyGroupBase::_sfUrl
99 /*! \var Node * ProxyGroupBase::_sfRoot
103 /*! \var UInt32 ProxyGroupBase::_sfState
107 /*! \var bool ProxyGroupBase::_sfConcurrentLoad
111 /*! \var BoxVolume ProxyGroupBase::_sfVolume
115 /*! \var UInt32 ProxyGroupBase::_sfIndices
119 /*! \var UInt32 ProxyGroupBase::_sfTriangles
123 /*! \var UInt32 ProxyGroupBase::_sfPositions
127 /*! \var UInt32 ProxyGroupBase::_sfGeometries
131 /*! \var std::string ProxyGroupBase::_sfAbsoluteUrl
135 /*! \var UInt8 ProxyGroupBase::_mfInline
140 /***************************************************************************\
141 * FieldType/FieldTrait Instantiation *
142 \***************************************************************************/
144 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
145 PointerType FieldTraits<ProxyGroup *, nsOSG>::_type(
146 "ProxyGroupPtr",
147 "GroupPtr",
148 ProxyGroup::getClassType(),
149 nsOSG);
150 #endif
152 OSG_FIELDTRAITS_GETTYPE_NS(ProxyGroup *, nsOSG)
154 /***************************************************************************\
155 * Field Description *
156 \***************************************************************************/
158 void ProxyGroupBase::classDescInserter(TypeObject &oType)
160 FieldDescriptionBase *pDesc = NULL;
163 pDesc = new SFBool::Description(
164 SFBool::getClassType(),
165 "enabled",
167 EnabledFieldId, EnabledFieldMask,
168 false,
169 (Field::SFDefaultFlags | Field::FStdAccess),
170 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleEnabled),
171 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleEnabled));
173 oType.addInitialDesc(pDesc);
175 pDesc = new SFString::Description(
176 SFString::getClassType(),
177 "url",
179 UrlFieldId, UrlFieldMask,
180 false,
181 (Field::SFDefaultFlags | Field::FStdAccess),
182 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleUrl),
183 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleUrl));
185 oType.addInitialDesc(pDesc);
187 pDesc = new SFUnrecNodePtr::Description(
188 SFUnrecNodePtr::getClassType(),
189 "root",
191 RootFieldId, RootFieldMask,
192 true,
193 (Field::SFDefaultFlags | Field::FStdAccess),
194 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleRoot),
195 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleRoot));
197 oType.addInitialDesc(pDesc);
199 pDesc = new SFUInt32::Description(
200 SFUInt32::getClassType(),
201 "state",
203 StateFieldId, StateFieldMask,
204 false,
205 (Field::SFDefaultFlags | Field::FStdAccess),
206 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleState),
207 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleState));
209 oType.addInitialDesc(pDesc);
211 pDesc = new SFBool::Description(
212 SFBool::getClassType(),
213 "concurrentLoad",
215 ConcurrentLoadFieldId, ConcurrentLoadFieldMask,
216 false,
217 (Field::SFDefaultFlags | Field::FStdAccess),
218 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleConcurrentLoad),
219 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleConcurrentLoad));
221 oType.addInitialDesc(pDesc);
223 pDesc = new SFBoxVolume::Description(
224 SFBoxVolume::getClassType(),
225 "volume",
227 VolumeFieldId, VolumeFieldMask,
228 false,
229 (Field::SFDefaultFlags | Field::FStdAccess),
230 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleVolume),
231 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleVolume));
233 oType.addInitialDesc(pDesc);
235 pDesc = new SFUInt32::Description(
236 SFUInt32::getClassType(),
237 "indices",
239 IndicesFieldId, IndicesFieldMask,
240 false,
241 (Field::SFDefaultFlags | Field::FStdAccess),
242 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleIndices),
243 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleIndices));
245 oType.addInitialDesc(pDesc);
247 pDesc = new SFUInt32::Description(
248 SFUInt32::getClassType(),
249 "triangles",
251 TrianglesFieldId, TrianglesFieldMask,
252 false,
253 (Field::SFDefaultFlags | Field::FStdAccess),
254 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleTriangles),
255 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleTriangles));
257 oType.addInitialDesc(pDesc);
259 pDesc = new SFUInt32::Description(
260 SFUInt32::getClassType(),
261 "positions",
263 PositionsFieldId, PositionsFieldMask,
264 false,
265 (Field::SFDefaultFlags | Field::FStdAccess),
266 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandlePositions),
267 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandlePositions));
269 oType.addInitialDesc(pDesc);
271 pDesc = new SFUInt32::Description(
272 SFUInt32::getClassType(),
273 "geometries",
275 GeometriesFieldId, GeometriesFieldMask,
276 false,
277 (Field::SFDefaultFlags | Field::FStdAccess),
278 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleGeometries),
279 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleGeometries));
281 oType.addInitialDesc(pDesc);
283 pDesc = new SFString::Description(
284 SFString::getClassType(),
285 "absoluteUrl",
287 AbsoluteUrlFieldId, AbsoluteUrlFieldMask,
288 true,
289 (Field::SFDefaultFlags | Field::FStdAccess),
290 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleAbsoluteUrl),
291 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleAbsoluteUrl));
293 oType.addInitialDesc(pDesc);
295 pDesc = new MFUInt8::Description(
296 MFUInt8::getClassType(),
297 "inline",
299 InlineFieldId, InlineFieldMask,
300 false,
301 (Field::MFDefaultFlags | Field::FStdAccess),
302 static_cast<FieldEditMethodSig>(&ProxyGroup::editHandleInline),
303 static_cast<FieldGetMethodSig >(&ProxyGroup::getHandleInline));
305 oType.addInitialDesc(pDesc);
309 ProxyGroupBase::TypeObject ProxyGroupBase::_type(
310 ProxyGroupBase::getClassname(),
311 Inherited::getClassname(),
312 "NULL",
313 nsOSG, //Namespace
314 reinterpret_cast<PrototypeCreateF>(&ProxyGroupBase::createEmptyLocal),
315 reinterpret_cast<InitContainerF>(&ProxyGroup::initMethod),
316 reinterpret_cast<ExitContainerF>(&ProxyGroup::exitMethod),
317 reinterpret_cast<InitalInsertDescFunc>(
318 reinterpret_cast<void *>(&ProxyGroup::classDescInserter)),
319 false,
321 "<?xml version=\"1.0\"?>\n"
322 "\n"
323 "<FieldContainer\n"
324 " name=\"ProxyGroup\"\n"
325 " parent=\"Group\"\n"
326 " library=\"Group\"\n"
327 " pointerfieldtypes=\"none\"\n"
328 " structure=\"concrete\"\n"
329 " systemcomponent=\"true\"\n"
330 " parentsystemcomponent=\"true\"\n"
331 " decoratable=\"false\"\n"
332 " useLocalIncludes=\"false\"\n"
333 " isNodeCore=\"true\"\n"
334 " docGroupBase=\"GrpGroupMisc\"\n"
335 " >\n"
336 " This group is used for delayed loading. If enabled the child\n"
337 " nodes are loaded in a second thread. Until the load is finished\n"
338 " the child nodes of this group are rendered. This could be used\n"
339 " to show a proxy object. If concurrentLoad is false, then loading\n"
340 " is done during the first frame. This is the behaviour of a simple\n"
341 " inline.\n"
342 " <Field\n"
343 "\t name=\"enabled\"\n"
344 "\t type=\"bool\"\n"
345 "\t cardinality=\"single\"\n"
346 "\t visibility=\"external\"\n"
347 "\t defaultValue=\"true\"\n"
348 "\t access=\"public\"\n"
349 "\t >\n"
350 " </Field>\n"
351 " <Field\n"
352 "\t name=\"url\"\n"
353 "\t type=\"std::string\"\n"
354 "\t cardinality=\"single\"\n"
355 "\t visibility=\"external\"\n"
356 "\t access=\"public\"\n"
357 "\t >\n"
358 " </Field>\n"
359 " <Field\n"
360 "\t name=\"root\"\n"
361 "\t type=\"NodePtr\"\n"
362 "\t cardinality=\"single\"\n"
363 "\t visibility=\"internal\"\n"
364 "\t defaultValue=\"NULL\"\n"
365 "\t access=\"public\"\n"
366 "\t >\n"
367 " </Field>\n"
368 " <Field\n"
369 "\t name=\"state\"\n"
370 "\t type=\"UInt32\"\n"
371 "\t cardinality=\"single\"\n"
372 "\t visibility=\"external\"\n"
373 "\t defaultValue=\"0\"\n"
374 "\t access=\"public\"\n"
375 "\t >\n"
376 " </Field>\n"
377 " <Field\n"
378 "\t name=\"concurrentLoad\"\n"
379 "\t type=\"bool\"\n"
380 "\t cardinality=\"single\"\n"
381 "\t visibility=\"external\"\n"
382 "\t defaultValue=\"true\"\n"
383 "\t access=\"public\"\n"
384 "\t >\n"
385 " </Field>\n"
386 " <Field\n"
387 "\t name=\"volume\"\n"
388 "\t type=\"BoxVolume\"\n"
389 "\t cardinality=\"single\"\n"
390 "\t visibility=\"external\"\n"
391 "\t access=\"public\"\n"
392 "\t >\n"
393 " </Field>\n"
394 " <Field\n"
395 "\t name=\"indices\"\n"
396 "\t type=\"UInt32\"\n"
397 "\t cardinality=\"single\"\n"
398 "\t visibility=\"external\"\n"
399 "\t defaultValue=\"0\"\n"
400 "\t access=\"public\"\n"
401 "\t >\n"
402 " </Field>\n"
403 " <Field\n"
404 "\t name=\"triangles\"\n"
405 "\t type=\"UInt32\"\n"
406 "\t cardinality=\"single\"\n"
407 "\t visibility=\"external\"\n"
408 "\t defaultValue=\"0\"\n"
409 "\t access=\"public\"\n"
410 "\t >\n"
411 " </Field>\n"
412 " <Field\n"
413 "\t name=\"positions\"\n"
414 "\t type=\"UInt32\"\n"
415 "\t cardinality=\"single\"\n"
416 "\t visibility=\"external\"\n"
417 "\t access=\"public\"\n"
418 "\t >\n"
419 " </Field>\n"
420 " <Field\n"
421 "\t name=\"geometries\"\n"
422 "\t type=\"UInt32\"\n"
423 "\t cardinality=\"single\"\n"
424 "\t visibility=\"external\"\n"
425 "\t access=\"public\"\n"
426 "\t >\n"
427 " </Field>\n"
428 " <Field\n"
429 "\t name=\"absoluteUrl\"\n"
430 "\t type=\"std::string\"\n"
431 "\t cardinality=\"single\"\n"
432 "\t visibility=\"internal\"\n"
433 "\t access=\"protected\"\n"
434 "\t >\n"
435 " </Field>\n"
436 " <Field\n"
437 "\t name=\"inline\"\n"
438 "\t type=\"UInt8\"\n"
439 "\t cardinality=\"multi\"\n"
440 "\t visibility=\"external\"\n"
441 "\t access=\"public\"\n"
442 "\t >\n"
443 " </Field>\n"
444 "</FieldContainer>\n",
445 "This group is used for delayed loading. If enabled the child\n"
446 "nodes are loaded in a second thread. Until the load is finished\n"
447 "the child nodes of this group are rendered. This could be used\n"
448 "to show a proxy object. If concurrentLoad is false, then loading\n"
449 "is done during the first frame. This is the behaviour of a simple\n"
450 "inline.\n"
453 /*------------------------------ get -----------------------------------*/
455 FieldContainerType &ProxyGroupBase::getType(void)
457 return _type;
460 const FieldContainerType &ProxyGroupBase::getType(void) const
462 return _type;
465 UInt32 ProxyGroupBase::getContainerSize(void) const
467 return sizeof(ProxyGroup);
470 /*------------------------- decorator get ------------------------------*/
473 SFBool *ProxyGroupBase::editSFEnabled(void)
475 editSField(EnabledFieldMask);
477 return &_sfEnabled;
480 const SFBool *ProxyGroupBase::getSFEnabled(void) const
482 return &_sfEnabled;
486 SFString *ProxyGroupBase::editSFUrl(void)
488 editSField(UrlFieldMask);
490 return &_sfUrl;
493 const SFString *ProxyGroupBase::getSFUrl(void) const
495 return &_sfUrl;
499 //! Get the ProxyGroup::_sfRoot field.
500 const SFUnrecNodePtr *ProxyGroupBase::getSFRoot(void) const
502 return &_sfRoot;
505 SFUnrecNodePtr *ProxyGroupBase::editSFRoot (void)
507 editSField(RootFieldMask);
509 return &_sfRoot;
512 //! Get the value of the ProxyGroup::_sfRoot field.
513 Node * ProxyGroupBase::getRoot(void) const
515 return _sfRoot.getValue();
518 //! Set the value of the ProxyGroup::_sfRoot field.
519 void ProxyGroupBase::setRoot(Node * const value)
521 editSField(RootFieldMask);
523 _sfRoot.setValue(value);
527 SFUInt32 *ProxyGroupBase::editSFState(void)
529 editSField(StateFieldMask);
531 return &_sfState;
534 const SFUInt32 *ProxyGroupBase::getSFState(void) const
536 return &_sfState;
540 SFBool *ProxyGroupBase::editSFConcurrentLoad(void)
542 editSField(ConcurrentLoadFieldMask);
544 return &_sfConcurrentLoad;
547 const SFBool *ProxyGroupBase::getSFConcurrentLoad(void) const
549 return &_sfConcurrentLoad;
553 SFBoxVolume *ProxyGroupBase::editSFVolume(void)
555 editSField(VolumeFieldMask);
557 return &_sfVolume;
560 const SFBoxVolume *ProxyGroupBase::getSFVolume(void) const
562 return &_sfVolume;
566 SFUInt32 *ProxyGroupBase::editSFIndices(void)
568 editSField(IndicesFieldMask);
570 return &_sfIndices;
573 const SFUInt32 *ProxyGroupBase::getSFIndices(void) const
575 return &_sfIndices;
579 SFUInt32 *ProxyGroupBase::editSFTriangles(void)
581 editSField(TrianglesFieldMask);
583 return &_sfTriangles;
586 const SFUInt32 *ProxyGroupBase::getSFTriangles(void) const
588 return &_sfTriangles;
592 SFUInt32 *ProxyGroupBase::editSFPositions(void)
594 editSField(PositionsFieldMask);
596 return &_sfPositions;
599 const SFUInt32 *ProxyGroupBase::getSFPositions(void) const
601 return &_sfPositions;
605 SFUInt32 *ProxyGroupBase::editSFGeometries(void)
607 editSField(GeometriesFieldMask);
609 return &_sfGeometries;
612 const SFUInt32 *ProxyGroupBase::getSFGeometries(void) const
614 return &_sfGeometries;
618 SFString *ProxyGroupBase::editSFAbsoluteUrl(void)
620 editSField(AbsoluteUrlFieldMask);
622 return &_sfAbsoluteUrl;
625 const SFString *ProxyGroupBase::getSFAbsoluteUrl(void) const
627 return &_sfAbsoluteUrl;
631 MFUInt8 *ProxyGroupBase::editMFInline(void)
633 editMField(InlineFieldMask, _mfInline);
635 return &_mfInline;
638 const MFUInt8 *ProxyGroupBase::getMFInline(void) const
640 return &_mfInline;
648 /*------------------------------ access -----------------------------------*/
650 SizeT ProxyGroupBase::getBinSize(ConstFieldMaskArg whichField)
652 SizeT returnValue = Inherited::getBinSize(whichField);
654 if(FieldBits::NoField != (EnabledFieldMask & whichField))
656 returnValue += _sfEnabled.getBinSize();
658 if(FieldBits::NoField != (UrlFieldMask & whichField))
660 returnValue += _sfUrl.getBinSize();
662 if(FieldBits::NoField != (RootFieldMask & whichField))
664 returnValue += _sfRoot.getBinSize();
666 if(FieldBits::NoField != (StateFieldMask & whichField))
668 returnValue += _sfState.getBinSize();
670 if(FieldBits::NoField != (ConcurrentLoadFieldMask & whichField))
672 returnValue += _sfConcurrentLoad.getBinSize();
674 if(FieldBits::NoField != (VolumeFieldMask & whichField))
676 returnValue += _sfVolume.getBinSize();
678 if(FieldBits::NoField != (IndicesFieldMask & whichField))
680 returnValue += _sfIndices.getBinSize();
682 if(FieldBits::NoField != (TrianglesFieldMask & whichField))
684 returnValue += _sfTriangles.getBinSize();
686 if(FieldBits::NoField != (PositionsFieldMask & whichField))
688 returnValue += _sfPositions.getBinSize();
690 if(FieldBits::NoField != (GeometriesFieldMask & whichField))
692 returnValue += _sfGeometries.getBinSize();
694 if(FieldBits::NoField != (AbsoluteUrlFieldMask & whichField))
696 returnValue += _sfAbsoluteUrl.getBinSize();
698 if(FieldBits::NoField != (InlineFieldMask & whichField))
700 returnValue += _mfInline.getBinSize();
703 return returnValue;
706 void ProxyGroupBase::copyToBin(BinaryDataHandler &pMem,
707 ConstFieldMaskArg whichField)
709 Inherited::copyToBin(pMem, whichField);
711 if(FieldBits::NoField != (EnabledFieldMask & whichField))
713 _sfEnabled.copyToBin(pMem);
715 if(FieldBits::NoField != (UrlFieldMask & whichField))
717 _sfUrl.copyToBin(pMem);
719 if(FieldBits::NoField != (RootFieldMask & whichField))
721 _sfRoot.copyToBin(pMem);
723 if(FieldBits::NoField != (StateFieldMask & whichField))
725 _sfState.copyToBin(pMem);
727 if(FieldBits::NoField != (ConcurrentLoadFieldMask & whichField))
729 _sfConcurrentLoad.copyToBin(pMem);
731 if(FieldBits::NoField != (VolumeFieldMask & whichField))
733 _sfVolume.copyToBin(pMem);
735 if(FieldBits::NoField != (IndicesFieldMask & whichField))
737 _sfIndices.copyToBin(pMem);
739 if(FieldBits::NoField != (TrianglesFieldMask & whichField))
741 _sfTriangles.copyToBin(pMem);
743 if(FieldBits::NoField != (PositionsFieldMask & whichField))
745 _sfPositions.copyToBin(pMem);
747 if(FieldBits::NoField != (GeometriesFieldMask & whichField))
749 _sfGeometries.copyToBin(pMem);
751 if(FieldBits::NoField != (AbsoluteUrlFieldMask & whichField))
753 _sfAbsoluteUrl.copyToBin(pMem);
755 if(FieldBits::NoField != (InlineFieldMask & whichField))
757 _mfInline.copyToBin(pMem);
761 void ProxyGroupBase::copyFromBin(BinaryDataHandler &pMem,
762 ConstFieldMaskArg whichField)
764 Inherited::copyFromBin(pMem, whichField);
766 if(FieldBits::NoField != (EnabledFieldMask & whichField))
768 editSField(EnabledFieldMask);
769 _sfEnabled.copyFromBin(pMem);
771 if(FieldBits::NoField != (UrlFieldMask & whichField))
773 editSField(UrlFieldMask);
774 _sfUrl.copyFromBin(pMem);
776 if(FieldBits::NoField != (RootFieldMask & whichField))
778 editSField(RootFieldMask);
779 _sfRoot.copyFromBin(pMem);
781 if(FieldBits::NoField != (StateFieldMask & whichField))
783 editSField(StateFieldMask);
784 _sfState.copyFromBin(pMem);
786 if(FieldBits::NoField != (ConcurrentLoadFieldMask & whichField))
788 editSField(ConcurrentLoadFieldMask);
789 _sfConcurrentLoad.copyFromBin(pMem);
791 if(FieldBits::NoField != (VolumeFieldMask & whichField))
793 editSField(VolumeFieldMask);
794 _sfVolume.copyFromBin(pMem);
796 if(FieldBits::NoField != (IndicesFieldMask & whichField))
798 editSField(IndicesFieldMask);
799 _sfIndices.copyFromBin(pMem);
801 if(FieldBits::NoField != (TrianglesFieldMask & whichField))
803 editSField(TrianglesFieldMask);
804 _sfTriangles.copyFromBin(pMem);
806 if(FieldBits::NoField != (PositionsFieldMask & whichField))
808 editSField(PositionsFieldMask);
809 _sfPositions.copyFromBin(pMem);
811 if(FieldBits::NoField != (GeometriesFieldMask & whichField))
813 editSField(GeometriesFieldMask);
814 _sfGeometries.copyFromBin(pMem);
816 if(FieldBits::NoField != (AbsoluteUrlFieldMask & whichField))
818 editSField(AbsoluteUrlFieldMask);
819 _sfAbsoluteUrl.copyFromBin(pMem);
821 if(FieldBits::NoField != (InlineFieldMask & whichField))
823 editMField(InlineFieldMask, _mfInline);
824 _mfInline.copyFromBin(pMem);
828 //! create a new instance of the class
829 ProxyGroupTransitPtr ProxyGroupBase::createLocal(BitVector bFlags)
831 ProxyGroupTransitPtr fc;
833 if(getClassType().getPrototype() != NULL)
835 FieldContainerTransitPtr tmpPtr =
836 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
838 fc = dynamic_pointer_cast<ProxyGroup>(tmpPtr);
841 return fc;
844 //! create a new instance of the class, copy the container flags
845 ProxyGroupTransitPtr ProxyGroupBase::createDependent(BitVector bFlags)
847 ProxyGroupTransitPtr fc;
849 if(getClassType().getPrototype() != NULL)
851 FieldContainerTransitPtr tmpPtr =
852 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
854 fc = dynamic_pointer_cast<ProxyGroup>(tmpPtr);
857 return fc;
860 //! create a new instance of the class
861 ProxyGroupTransitPtr ProxyGroupBase::create(void)
863 ProxyGroupTransitPtr fc;
865 if(getClassType().getPrototype() != NULL)
867 FieldContainerTransitPtr tmpPtr =
868 getClassType().getPrototype()-> shallowCopy();
870 fc = dynamic_pointer_cast<ProxyGroup>(tmpPtr);
873 return fc;
876 ProxyGroup *ProxyGroupBase::createEmptyLocal(BitVector bFlags)
878 ProxyGroup *returnValue;
880 newPtr<ProxyGroup>(returnValue, bFlags);
882 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
884 return returnValue;
887 //! create an empty new instance of the class, do not copy the prototype
888 ProxyGroup *ProxyGroupBase::createEmpty(void)
890 ProxyGroup *returnValue;
892 newPtr<ProxyGroup>(returnValue, Thread::getCurrentLocalFlags());
894 returnValue->_pFieldFlags->_bNamespaceMask &=
895 ~Thread::getCurrentLocalFlags();
897 return returnValue;
901 FieldContainerTransitPtr ProxyGroupBase::shallowCopyLocal(
902 BitVector bFlags) const
904 ProxyGroup *tmpPtr;
906 newPtr(tmpPtr, dynamic_cast<const ProxyGroup *>(this), bFlags);
908 FieldContainerTransitPtr returnValue(tmpPtr);
910 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
912 return returnValue;
915 FieldContainerTransitPtr ProxyGroupBase::shallowCopyDependent(
916 BitVector bFlags) const
918 ProxyGroup *tmpPtr;
920 newPtr(tmpPtr, dynamic_cast<const ProxyGroup *>(this), ~bFlags);
922 FieldContainerTransitPtr returnValue(tmpPtr);
924 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
926 return returnValue;
929 FieldContainerTransitPtr ProxyGroupBase::shallowCopy(void) const
931 ProxyGroup *tmpPtr;
933 newPtr(tmpPtr,
934 dynamic_cast<const ProxyGroup *>(this),
935 Thread::getCurrentLocalFlags());
937 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
939 FieldContainerTransitPtr returnValue(tmpPtr);
941 return returnValue;
947 /*------------------------- constructors ----------------------------------*/
949 ProxyGroupBase::ProxyGroupBase(void) :
950 Inherited(),
951 _sfEnabled (bool(true)),
952 _sfUrl (),
953 _sfRoot (NULL),
954 _sfState (UInt32(0)),
955 _sfConcurrentLoad (bool(true)),
956 _sfVolume (),
957 _sfIndices (UInt32(0)),
958 _sfTriangles (UInt32(0)),
959 _sfPositions (),
960 _sfGeometries (),
961 _sfAbsoluteUrl (),
962 _mfInline ()
966 ProxyGroupBase::ProxyGroupBase(const ProxyGroupBase &source) :
967 Inherited(source),
968 _sfEnabled (source._sfEnabled ),
969 _sfUrl (source._sfUrl ),
970 _sfRoot (NULL),
971 _sfState (source._sfState ),
972 _sfConcurrentLoad (source._sfConcurrentLoad ),
973 _sfVolume (source._sfVolume ),
974 _sfIndices (source._sfIndices ),
975 _sfTriangles (source._sfTriangles ),
976 _sfPositions (source._sfPositions ),
977 _sfGeometries (source._sfGeometries ),
978 _sfAbsoluteUrl (source._sfAbsoluteUrl ),
979 _mfInline (source._mfInline )
984 /*-------------------------- destructors ----------------------------------*/
986 ProxyGroupBase::~ProxyGroupBase(void)
990 void ProxyGroupBase::onCreate(const ProxyGroup *source)
992 Inherited::onCreate(source);
994 if(source != NULL)
996 ProxyGroup *pThis = static_cast<ProxyGroup *>(this);
998 pThis->setRoot(source->getRoot());
1002 GetFieldHandlePtr ProxyGroupBase::getHandleEnabled (void) const
1004 SFBool::GetHandlePtr returnValue(
1005 new SFBool::GetHandle(
1006 &_sfEnabled,
1007 this->getType().getFieldDesc(EnabledFieldId),
1008 const_cast<ProxyGroupBase *>(this)));
1010 return returnValue;
1013 EditFieldHandlePtr ProxyGroupBase::editHandleEnabled (void)
1015 SFBool::EditHandlePtr returnValue(
1016 new SFBool::EditHandle(
1017 &_sfEnabled,
1018 this->getType().getFieldDesc(EnabledFieldId),
1019 this));
1022 editSField(EnabledFieldMask);
1024 return returnValue;
1027 GetFieldHandlePtr ProxyGroupBase::getHandleUrl (void) const
1029 SFString::GetHandlePtr returnValue(
1030 new SFString::GetHandle(
1031 &_sfUrl,
1032 this->getType().getFieldDesc(UrlFieldId),
1033 const_cast<ProxyGroupBase *>(this)));
1035 return returnValue;
1038 EditFieldHandlePtr ProxyGroupBase::editHandleUrl (void)
1040 SFString::EditHandlePtr returnValue(
1041 new SFString::EditHandle(
1042 &_sfUrl,
1043 this->getType().getFieldDesc(UrlFieldId),
1044 this));
1047 editSField(UrlFieldMask);
1049 return returnValue;
1052 GetFieldHandlePtr ProxyGroupBase::getHandleRoot (void) const
1054 SFUnrecNodePtr::GetHandlePtr returnValue(
1055 new SFUnrecNodePtr::GetHandle(
1056 &_sfRoot,
1057 this->getType().getFieldDesc(RootFieldId),
1058 const_cast<ProxyGroupBase *>(this)));
1060 return returnValue;
1063 EditFieldHandlePtr ProxyGroupBase::editHandleRoot (void)
1065 SFUnrecNodePtr::EditHandlePtr returnValue(
1066 new SFUnrecNodePtr::EditHandle(
1067 &_sfRoot,
1068 this->getType().getFieldDesc(RootFieldId),
1069 this));
1071 returnValue->setSetMethod(
1072 boost::bind(&ProxyGroup::setRoot,
1073 static_cast<ProxyGroup *>(this), _1));
1075 editSField(RootFieldMask);
1077 return returnValue;
1080 GetFieldHandlePtr ProxyGroupBase::getHandleState (void) const
1082 SFUInt32::GetHandlePtr returnValue(
1083 new SFUInt32::GetHandle(
1084 &_sfState,
1085 this->getType().getFieldDesc(StateFieldId),
1086 const_cast<ProxyGroupBase *>(this)));
1088 return returnValue;
1091 EditFieldHandlePtr ProxyGroupBase::editHandleState (void)
1093 SFUInt32::EditHandlePtr returnValue(
1094 new SFUInt32::EditHandle(
1095 &_sfState,
1096 this->getType().getFieldDesc(StateFieldId),
1097 this));
1100 editSField(StateFieldMask);
1102 return returnValue;
1105 GetFieldHandlePtr ProxyGroupBase::getHandleConcurrentLoad (void) const
1107 SFBool::GetHandlePtr returnValue(
1108 new SFBool::GetHandle(
1109 &_sfConcurrentLoad,
1110 this->getType().getFieldDesc(ConcurrentLoadFieldId),
1111 const_cast<ProxyGroupBase *>(this)));
1113 return returnValue;
1116 EditFieldHandlePtr ProxyGroupBase::editHandleConcurrentLoad (void)
1118 SFBool::EditHandlePtr returnValue(
1119 new SFBool::EditHandle(
1120 &_sfConcurrentLoad,
1121 this->getType().getFieldDesc(ConcurrentLoadFieldId),
1122 this));
1125 editSField(ConcurrentLoadFieldMask);
1127 return returnValue;
1130 GetFieldHandlePtr ProxyGroupBase::getHandleVolume (void) const
1132 SFBoxVolume::GetHandlePtr returnValue(
1133 new SFBoxVolume::GetHandle(
1134 &_sfVolume,
1135 this->getType().getFieldDesc(VolumeFieldId),
1136 const_cast<ProxyGroupBase *>(this)));
1138 return returnValue;
1141 EditFieldHandlePtr ProxyGroupBase::editHandleVolume (void)
1143 SFBoxVolume::EditHandlePtr returnValue(
1144 new SFBoxVolume::EditHandle(
1145 &_sfVolume,
1146 this->getType().getFieldDesc(VolumeFieldId),
1147 this));
1150 editSField(VolumeFieldMask);
1152 return returnValue;
1155 GetFieldHandlePtr ProxyGroupBase::getHandleIndices (void) const
1157 SFUInt32::GetHandlePtr returnValue(
1158 new SFUInt32::GetHandle(
1159 &_sfIndices,
1160 this->getType().getFieldDesc(IndicesFieldId),
1161 const_cast<ProxyGroupBase *>(this)));
1163 return returnValue;
1166 EditFieldHandlePtr ProxyGroupBase::editHandleIndices (void)
1168 SFUInt32::EditHandlePtr returnValue(
1169 new SFUInt32::EditHandle(
1170 &_sfIndices,
1171 this->getType().getFieldDesc(IndicesFieldId),
1172 this));
1175 editSField(IndicesFieldMask);
1177 return returnValue;
1180 GetFieldHandlePtr ProxyGroupBase::getHandleTriangles (void) const
1182 SFUInt32::GetHandlePtr returnValue(
1183 new SFUInt32::GetHandle(
1184 &_sfTriangles,
1185 this->getType().getFieldDesc(TrianglesFieldId),
1186 const_cast<ProxyGroupBase *>(this)));
1188 return returnValue;
1191 EditFieldHandlePtr ProxyGroupBase::editHandleTriangles (void)
1193 SFUInt32::EditHandlePtr returnValue(
1194 new SFUInt32::EditHandle(
1195 &_sfTriangles,
1196 this->getType().getFieldDesc(TrianglesFieldId),
1197 this));
1200 editSField(TrianglesFieldMask);
1202 return returnValue;
1205 GetFieldHandlePtr ProxyGroupBase::getHandlePositions (void) const
1207 SFUInt32::GetHandlePtr returnValue(
1208 new SFUInt32::GetHandle(
1209 &_sfPositions,
1210 this->getType().getFieldDesc(PositionsFieldId),
1211 const_cast<ProxyGroupBase *>(this)));
1213 return returnValue;
1216 EditFieldHandlePtr ProxyGroupBase::editHandlePositions (void)
1218 SFUInt32::EditHandlePtr returnValue(
1219 new SFUInt32::EditHandle(
1220 &_sfPositions,
1221 this->getType().getFieldDesc(PositionsFieldId),
1222 this));
1225 editSField(PositionsFieldMask);
1227 return returnValue;
1230 GetFieldHandlePtr ProxyGroupBase::getHandleGeometries (void) const
1232 SFUInt32::GetHandlePtr returnValue(
1233 new SFUInt32::GetHandle(
1234 &_sfGeometries,
1235 this->getType().getFieldDesc(GeometriesFieldId),
1236 const_cast<ProxyGroupBase *>(this)));
1238 return returnValue;
1241 EditFieldHandlePtr ProxyGroupBase::editHandleGeometries (void)
1243 SFUInt32::EditHandlePtr returnValue(
1244 new SFUInt32::EditHandle(
1245 &_sfGeometries,
1246 this->getType().getFieldDesc(GeometriesFieldId),
1247 this));
1250 editSField(GeometriesFieldMask);
1252 return returnValue;
1255 GetFieldHandlePtr ProxyGroupBase::getHandleAbsoluteUrl (void) const
1257 SFString::GetHandlePtr returnValue(
1258 new SFString::GetHandle(
1259 &_sfAbsoluteUrl,
1260 this->getType().getFieldDesc(AbsoluteUrlFieldId),
1261 const_cast<ProxyGroupBase *>(this)));
1263 return returnValue;
1266 EditFieldHandlePtr ProxyGroupBase::editHandleAbsoluteUrl (void)
1268 SFString::EditHandlePtr returnValue(
1269 new SFString::EditHandle(
1270 &_sfAbsoluteUrl,
1271 this->getType().getFieldDesc(AbsoluteUrlFieldId),
1272 this));
1275 editSField(AbsoluteUrlFieldMask);
1277 return returnValue;
1280 GetFieldHandlePtr ProxyGroupBase::getHandleInline (void) const
1282 MFUInt8::GetHandlePtr returnValue(
1283 new MFUInt8::GetHandle(
1284 &_mfInline,
1285 this->getType().getFieldDesc(InlineFieldId),
1286 const_cast<ProxyGroupBase *>(this)));
1288 return returnValue;
1291 EditFieldHandlePtr ProxyGroupBase::editHandleInline (void)
1293 MFUInt8::EditHandlePtr returnValue(
1294 new MFUInt8::EditHandle(
1295 &_mfInline,
1296 this->getType().getFieldDesc(InlineFieldId),
1297 this));
1300 editMField(InlineFieldMask, _mfInline);
1302 return returnValue;
1306 #ifdef OSG_MT_CPTR_ASPECT
1307 void ProxyGroupBase::execSyncV( FieldContainer &oFrom,
1308 ConstFieldMaskArg whichField,
1309 AspectOffsetStore &oOffsets,
1310 ConstFieldMaskArg syncMode,
1311 const UInt32 uiSyncInfo)
1313 ProxyGroup *pThis = static_cast<ProxyGroup *>(this);
1315 pThis->execSync(static_cast<ProxyGroup *>(&oFrom),
1316 whichField,
1317 oOffsets,
1318 syncMode,
1319 uiSyncInfo);
1321 #endif
1324 #ifdef OSG_MT_CPTR_ASPECT
1325 FieldContainer *ProxyGroupBase::createAspectCopy(
1326 const FieldContainer *pRefAspect) const
1328 ProxyGroup *returnValue;
1330 newAspectCopy(returnValue,
1331 dynamic_cast<const ProxyGroup *>(pRefAspect),
1332 dynamic_cast<const ProxyGroup *>(this));
1334 return returnValue;
1336 #endif
1338 void ProxyGroupBase::resolveLinks(void)
1340 Inherited::resolveLinks();
1342 static_cast<ProxyGroup *>(this)->setRoot(NULL);
1344 #ifdef OSG_MT_CPTR_ASPECT
1345 AspectOffsetStore oOffsets;
1347 _pAspectStore->fillOffsetArray(oOffsets, this);
1348 #endif
1350 #ifdef OSG_MT_CPTR_ASPECT
1351 _mfInline.terminateShare(Thread::getCurrentAspect(),
1352 oOffsets);
1353 #endif
1357 OSG_END_NAMESPACE