changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGInlineBase.cpp
blobaa3a3140a6168bee0978aba5a9fb204731f03e6f
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 Inline!
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 "OSGInlineBase.h"
68 #include "OSGInline.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::Inline
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var std::string InlineBase::_mfUrl
90 /*! \var bool InlineBase::_sfLoaded
94 /*! \var Node * InlineBase::_sfRoot
98 /*! \var std::string InlineBase::_sfGraphOp
102 /*! \var std::string InlineBase::_mfOptions
107 /***************************************************************************\
108 * FieldType/FieldTrait Instantiation *
109 \***************************************************************************/
111 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
112 PointerType FieldTraits<Inline *, nsOSG>::_type(
113 "InlinePtr",
114 "RootGroupPtr",
115 Inline::getClassType(),
116 nsOSG);
117 #endif
119 OSG_FIELDTRAITS_GETTYPE_NS(Inline *, nsOSG)
121 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
122 Inline *,
123 nsOSG)
125 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
126 Inline *,
127 nsOSG)
129 /***************************************************************************\
130 * Field Description *
131 \***************************************************************************/
133 void InlineBase::classDescInserter(TypeObject &oType)
135 FieldDescriptionBase *pDesc = NULL;
138 pDesc = new MFString::Description(
139 MFString::getClassType(),
140 "url",
142 UrlFieldId, UrlFieldMask,
143 false,
144 (Field::MFDefaultFlags | Field::FStdAccess),
145 static_cast<FieldEditMethodSig>(&Inline::editHandleUrl),
146 static_cast<FieldGetMethodSig >(&Inline::getHandleUrl));
148 oType.addInitialDesc(pDesc);
150 pDesc = new SFBool::Description(
151 SFBool::getClassType(),
152 "loaded",
154 LoadedFieldId, LoadedFieldMask,
155 true,
156 (Field::SFDefaultFlags | Field::FStdAccess),
157 static_cast<FieldEditMethodSig>(&Inline::editHandleLoaded),
158 static_cast<FieldGetMethodSig >(&Inline::getHandleLoaded));
160 oType.addInitialDesc(pDesc);
162 pDesc = new SFUnrecNodePtr::Description(
163 SFUnrecNodePtr::getClassType(),
164 "root",
166 RootFieldId, RootFieldMask,
167 true,
168 (Field::SFDefaultFlags | Field::FStdAccess),
169 static_cast<FieldEditMethodSig>(&Inline::editHandleRoot),
170 static_cast<FieldGetMethodSig >(&Inline::getHandleRoot));
172 oType.addInitialDesc(pDesc);
174 pDesc = new SFString::Description(
175 SFString::getClassType(),
176 "graphOp",
178 GraphOpFieldId, GraphOpFieldMask,
179 false,
180 (Field::SFDefaultFlags | Field::FStdAccess),
181 static_cast<FieldEditMethodSig>(&Inline::editHandleGraphOp),
182 static_cast<FieldGetMethodSig >(&Inline::getHandleGraphOp));
184 oType.addInitialDesc(pDesc);
186 pDesc = new MFString::Description(
187 MFString::getClassType(),
188 "options",
190 OptionsFieldId, OptionsFieldMask,
191 false,
192 (Field::MFDefaultFlags | Field::FStdAccess),
193 static_cast<FieldEditMethodSig>(&Inline::editHandleOptions),
194 static_cast<FieldGetMethodSig >(&Inline::getHandleOptions));
196 oType.addInitialDesc(pDesc);
200 InlineBase::TypeObject InlineBase::_type(
201 InlineBase::getClassname(),
202 Inherited::getClassname(),
203 "NULL",
204 nsOSG, //Namespace
205 reinterpret_cast<PrototypeCreateF>(&InlineBase::createEmptyLocal),
206 reinterpret_cast<InitContainerF>(&Inline::initMethod),
207 reinterpret_cast<ExitContainerF>(&Inline::exitMethod),
208 reinterpret_cast<InitalInsertDescFunc>(
209 reinterpret_cast<void *>(&Inline::classDescInserter)),
210 false,
212 "<?xml version=\"1.0\"?>\n"
213 "\n"
214 "<FieldContainer\n"
215 " name=\"Inline\"\n"
216 " parent=\"RootGroup\"\n"
217 " library=\"Group\"\n"
218 " pointerfieldtypes=\"both\"\n"
219 " structure=\"concrete\"\n"
220 " systemcomponent=\"true\"\n"
221 " parentsystemcomponent=\"true\"\n"
222 " isNodeCore=\"true\"\n"
223 " docGroupBase=\"GrpGroupMisc\"\n"
224 " >\n"
225 " <Field\n"
226 "\t name=\"url\"\n"
227 "\t type=\"std::string\"\n"
228 "\t cardinality=\"multi\"\n"
229 "\t visibility=\"external\"\n"
230 "\t access=\"public\"\n"
231 "\t >\n"
232 " </Field>\n"
233 " <Field\n"
234 "\t name=\"loaded\"\n"
235 "\t type=\"bool\"\n"
236 "\t cardinality=\"single\"\n"
237 "\t visibility=\"internal\"\n"
238 "\t access=\"public\"\n"
239 "\t defaultValue=\"true\"\n"
240 "\t >\n"
241 " </Field>\n"
242 " <Field\n"
243 "\t name=\"root\"\n"
244 "\t type=\"NodePtr\"\n"
245 "\t cardinality=\"single\"\n"
246 "\t visibility=\"internal\"\n"
247 "\t defaultValue=\"NULL\"\n"
248 "\t access=\"protected\"\n"
249 "\t >\n"
250 " </Field>\n"
251 " <Field\n"
252 "\t name=\"graphOp\"\n"
253 "\t type=\"std::string\"\n"
254 "\t cardinality=\"single\"\n"
255 "\t visibility=\"external\"\n"
256 "\t defaultValue='\"default\"'\n"
257 "\t access=\"public\"\n"
258 "\t >\n"
259 " </Field>\n"
260 " <Field\n"
261 "\t name=\"options\"\n"
262 "\t type=\"std::string\"\n"
263 "\t cardinality=\"multi\"\n"
264 "\t visibility=\"external\"\n"
265 "\t access=\"public\"\n"
266 "\t >\n"
267 " </Field>\n"
268 "</FieldContainer>\n",
272 /*------------------------------ get -----------------------------------*/
274 FieldContainerType &InlineBase::getType(void)
276 return _type;
279 const FieldContainerType &InlineBase::getType(void) const
281 return _type;
284 UInt32 InlineBase::getContainerSize(void) const
286 return sizeof(Inline);
289 /*------------------------- decorator get ------------------------------*/
292 MFString *InlineBase::editMFUrl(void)
294 editMField(UrlFieldMask, _mfUrl);
296 return &_mfUrl;
299 const MFString *InlineBase::getMFUrl(void) const
301 return &_mfUrl;
305 SFBool *InlineBase::editSFLoaded(void)
307 editSField(LoadedFieldMask);
309 return &_sfLoaded;
312 const SFBool *InlineBase::getSFLoaded(void) const
314 return &_sfLoaded;
318 //! Get the Inline::_sfRoot field.
319 const SFUnrecNodePtr *InlineBase::getSFRoot(void) const
321 return &_sfRoot;
324 SFUnrecNodePtr *InlineBase::editSFRoot (void)
326 editSField(RootFieldMask);
328 return &_sfRoot;
331 //! Get the value of the Inline::_sfRoot field.
332 Node * InlineBase::getRoot(void) const
334 return _sfRoot.getValue();
337 //! Set the value of the Inline::_sfRoot field.
338 void InlineBase::setRoot(Node * const value)
340 editSField(RootFieldMask);
342 _sfRoot.setValue(value);
346 SFString *InlineBase::editSFGraphOp(void)
348 editSField(GraphOpFieldMask);
350 return &_sfGraphOp;
353 const SFString *InlineBase::getSFGraphOp(void) const
355 return &_sfGraphOp;
359 MFString *InlineBase::editMFOptions(void)
361 editMField(OptionsFieldMask, _mfOptions);
363 return &_mfOptions;
366 const MFString *InlineBase::getMFOptions(void) const
368 return &_mfOptions;
376 /*------------------------------ access -----------------------------------*/
378 SizeT InlineBase::getBinSize(ConstFieldMaskArg whichField)
380 SizeT returnValue = Inherited::getBinSize(whichField);
382 if(FieldBits::NoField != (UrlFieldMask & whichField))
384 returnValue += _mfUrl.getBinSize();
386 if(FieldBits::NoField != (LoadedFieldMask & whichField))
388 returnValue += _sfLoaded.getBinSize();
390 if(FieldBits::NoField != (RootFieldMask & whichField))
392 returnValue += _sfRoot.getBinSize();
394 if(FieldBits::NoField != (GraphOpFieldMask & whichField))
396 returnValue += _sfGraphOp.getBinSize();
398 if(FieldBits::NoField != (OptionsFieldMask & whichField))
400 returnValue += _mfOptions.getBinSize();
403 return returnValue;
406 void InlineBase::copyToBin(BinaryDataHandler &pMem,
407 ConstFieldMaskArg whichField)
409 Inherited::copyToBin(pMem, whichField);
411 if(FieldBits::NoField != (UrlFieldMask & whichField))
413 _mfUrl.copyToBin(pMem);
415 if(FieldBits::NoField != (LoadedFieldMask & whichField))
417 _sfLoaded.copyToBin(pMem);
419 if(FieldBits::NoField != (RootFieldMask & whichField))
421 _sfRoot.copyToBin(pMem);
423 if(FieldBits::NoField != (GraphOpFieldMask & whichField))
425 _sfGraphOp.copyToBin(pMem);
427 if(FieldBits::NoField != (OptionsFieldMask & whichField))
429 _mfOptions.copyToBin(pMem);
433 void InlineBase::copyFromBin(BinaryDataHandler &pMem,
434 ConstFieldMaskArg whichField)
436 Inherited::copyFromBin(pMem, whichField);
438 if(FieldBits::NoField != (UrlFieldMask & whichField))
440 editMField(UrlFieldMask, _mfUrl);
441 _mfUrl.copyFromBin(pMem);
443 if(FieldBits::NoField != (LoadedFieldMask & whichField))
445 editSField(LoadedFieldMask);
446 _sfLoaded.copyFromBin(pMem);
448 if(FieldBits::NoField != (RootFieldMask & whichField))
450 editSField(RootFieldMask);
451 _sfRoot.copyFromBin(pMem);
453 if(FieldBits::NoField != (GraphOpFieldMask & whichField))
455 editSField(GraphOpFieldMask);
456 _sfGraphOp.copyFromBin(pMem);
458 if(FieldBits::NoField != (OptionsFieldMask & whichField))
460 editMField(OptionsFieldMask, _mfOptions);
461 _mfOptions.copyFromBin(pMem);
465 //! create a new instance of the class
466 InlineTransitPtr InlineBase::createLocal(BitVector bFlags)
468 InlineTransitPtr fc;
470 if(getClassType().getPrototype() != NULL)
472 FieldContainerTransitPtr tmpPtr =
473 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
475 fc = dynamic_pointer_cast<Inline>(tmpPtr);
478 return fc;
481 //! create a new instance of the class, copy the container flags
482 InlineTransitPtr InlineBase::createDependent(BitVector bFlags)
484 InlineTransitPtr fc;
486 if(getClassType().getPrototype() != NULL)
488 FieldContainerTransitPtr tmpPtr =
489 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
491 fc = dynamic_pointer_cast<Inline>(tmpPtr);
494 return fc;
497 //! create a new instance of the class
498 InlineTransitPtr InlineBase::create(void)
500 InlineTransitPtr fc;
502 if(getClassType().getPrototype() != NULL)
504 FieldContainerTransitPtr tmpPtr =
505 getClassType().getPrototype()-> shallowCopy();
507 fc = dynamic_pointer_cast<Inline>(tmpPtr);
510 return fc;
513 Inline *InlineBase::createEmptyLocal(BitVector bFlags)
515 Inline *returnValue;
517 newPtr<Inline>(returnValue, bFlags);
519 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
521 return returnValue;
524 //! create an empty new instance of the class, do not copy the prototype
525 Inline *InlineBase::createEmpty(void)
527 Inline *returnValue;
529 newPtr<Inline>(returnValue, Thread::getCurrentLocalFlags());
531 returnValue->_pFieldFlags->_bNamespaceMask &=
532 ~Thread::getCurrentLocalFlags();
534 return returnValue;
538 FieldContainerTransitPtr InlineBase::shallowCopyLocal(
539 BitVector bFlags) const
541 Inline *tmpPtr;
543 newPtr(tmpPtr, dynamic_cast<const Inline *>(this), bFlags);
545 FieldContainerTransitPtr returnValue(tmpPtr);
547 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
549 return returnValue;
552 FieldContainerTransitPtr InlineBase::shallowCopyDependent(
553 BitVector bFlags) const
555 Inline *tmpPtr;
557 newPtr(tmpPtr, dynamic_cast<const Inline *>(this), ~bFlags);
559 FieldContainerTransitPtr returnValue(tmpPtr);
561 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
563 return returnValue;
566 FieldContainerTransitPtr InlineBase::shallowCopy(void) const
568 Inline *tmpPtr;
570 newPtr(tmpPtr,
571 dynamic_cast<const Inline *>(this),
572 Thread::getCurrentLocalFlags());
574 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
576 FieldContainerTransitPtr returnValue(tmpPtr);
578 return returnValue;
584 /*------------------------- constructors ----------------------------------*/
586 InlineBase::InlineBase(void) :
587 Inherited(),
588 _mfUrl (),
589 _sfLoaded (bool(true)),
590 _sfRoot (NULL),
591 _sfGraphOp (std::string("default")),
592 _mfOptions ()
596 InlineBase::InlineBase(const InlineBase &source) :
597 Inherited(source),
598 _mfUrl (source._mfUrl ),
599 _sfLoaded (source._sfLoaded ),
600 _sfRoot (NULL),
601 _sfGraphOp (source._sfGraphOp ),
602 _mfOptions (source._mfOptions )
607 /*-------------------------- destructors ----------------------------------*/
609 InlineBase::~InlineBase(void)
613 void InlineBase::onCreate(const Inline *source)
615 Inherited::onCreate(source);
617 if(source != NULL)
619 Inline *pThis = static_cast<Inline *>(this);
621 pThis->setRoot(source->getRoot());
625 GetFieldHandlePtr InlineBase::getHandleUrl (void) const
627 MFString::GetHandlePtr returnValue(
628 new MFString::GetHandle(
629 &_mfUrl,
630 this->getType().getFieldDesc(UrlFieldId),
631 const_cast<InlineBase *>(this)));
633 return returnValue;
636 EditFieldHandlePtr InlineBase::editHandleUrl (void)
638 MFString::EditHandlePtr returnValue(
639 new MFString::EditHandle(
640 &_mfUrl,
641 this->getType().getFieldDesc(UrlFieldId),
642 this));
645 editMField(UrlFieldMask, _mfUrl);
647 return returnValue;
650 GetFieldHandlePtr InlineBase::getHandleLoaded (void) const
652 SFBool::GetHandlePtr returnValue(
653 new SFBool::GetHandle(
654 &_sfLoaded,
655 this->getType().getFieldDesc(LoadedFieldId),
656 const_cast<InlineBase *>(this)));
658 return returnValue;
661 EditFieldHandlePtr InlineBase::editHandleLoaded (void)
663 SFBool::EditHandlePtr returnValue(
664 new SFBool::EditHandle(
665 &_sfLoaded,
666 this->getType().getFieldDesc(LoadedFieldId),
667 this));
670 editSField(LoadedFieldMask);
672 return returnValue;
675 GetFieldHandlePtr InlineBase::getHandleRoot (void) const
677 SFUnrecNodePtr::GetHandlePtr returnValue(
678 new SFUnrecNodePtr::GetHandle(
679 &_sfRoot,
680 this->getType().getFieldDesc(RootFieldId),
681 const_cast<InlineBase *>(this)));
683 return returnValue;
686 EditFieldHandlePtr InlineBase::editHandleRoot (void)
688 SFUnrecNodePtr::EditHandlePtr returnValue(
689 new SFUnrecNodePtr::EditHandle(
690 &_sfRoot,
691 this->getType().getFieldDesc(RootFieldId),
692 this));
694 returnValue->setSetMethod(
695 boost::bind(&Inline::setRoot,
696 static_cast<Inline *>(this), _1));
698 editSField(RootFieldMask);
700 return returnValue;
703 GetFieldHandlePtr InlineBase::getHandleGraphOp (void) const
705 SFString::GetHandlePtr returnValue(
706 new SFString::GetHandle(
707 &_sfGraphOp,
708 this->getType().getFieldDesc(GraphOpFieldId),
709 const_cast<InlineBase *>(this)));
711 return returnValue;
714 EditFieldHandlePtr InlineBase::editHandleGraphOp (void)
716 SFString::EditHandlePtr returnValue(
717 new SFString::EditHandle(
718 &_sfGraphOp,
719 this->getType().getFieldDesc(GraphOpFieldId),
720 this));
723 editSField(GraphOpFieldMask);
725 return returnValue;
728 GetFieldHandlePtr InlineBase::getHandleOptions (void) const
730 MFString::GetHandlePtr returnValue(
731 new MFString::GetHandle(
732 &_mfOptions,
733 this->getType().getFieldDesc(OptionsFieldId),
734 const_cast<InlineBase *>(this)));
736 return returnValue;
739 EditFieldHandlePtr InlineBase::editHandleOptions (void)
741 MFString::EditHandlePtr returnValue(
742 new MFString::EditHandle(
743 &_mfOptions,
744 this->getType().getFieldDesc(OptionsFieldId),
745 this));
748 editMField(OptionsFieldMask, _mfOptions);
750 return returnValue;
754 #ifdef OSG_MT_CPTR_ASPECT
755 void InlineBase::execSyncV( FieldContainer &oFrom,
756 ConstFieldMaskArg whichField,
757 AspectOffsetStore &oOffsets,
758 ConstFieldMaskArg syncMode,
759 const UInt32 uiSyncInfo)
761 Inline *pThis = static_cast<Inline *>(this);
763 pThis->execSync(static_cast<Inline *>(&oFrom),
764 whichField,
765 oOffsets,
766 syncMode,
767 uiSyncInfo);
769 #endif
772 #ifdef OSG_MT_CPTR_ASPECT
773 FieldContainer *InlineBase::createAspectCopy(
774 const FieldContainer *pRefAspect) const
776 Inline *returnValue;
778 newAspectCopy(returnValue,
779 dynamic_cast<const Inline *>(pRefAspect),
780 dynamic_cast<const Inline *>(this));
782 return returnValue;
784 #endif
786 void InlineBase::resolveLinks(void)
788 Inherited::resolveLinks();
790 static_cast<Inline *>(this)->setRoot(NULL);
792 #ifdef OSG_MT_CPTR_ASPECT
793 AspectOffsetStore oOffsets;
795 _pAspectStore->fillOffsetArray(oOffsets, this);
796 #endif
798 #ifdef OSG_MT_CPTR_ASPECT
799 _mfUrl.terminateShare(Thread::getCurrentAspect(),
800 oOffsets);
801 #endif
802 #ifdef OSG_MT_CPTR_ASPECT
803 _mfOptions.terminateShare(Thread::getCurrentAspect(),
804 oOffsets);
805 #endif
809 OSG_END_NAMESPACE