1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
10 @!AuthorsCommentText!@
12 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
15 \*---------------------------------------------------------------------------*/
16 /*---------------------------------------------------------------------------*\
19 * This library is free software; you can redistribute it and/or modify it *
20 * under the terms of the GNU Library General Public License as published *
21 * by the Free Software Foundation, version 2. *
23 * This library is distributed in the hope that it will be useful, but *
24 * WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
26 * Library General Public License for more details. *
28 * You should have received a copy of the GNU Library General Public *
29 * License along with this library; if not, write to the Free Software *
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
32 \*---------------------------------------------------------------------------*/
33 /*---------------------------------------------------------------------------*\
41 \*---------------------------------------------------------------------------*/
43 /*****************************************************************************\
44 *****************************************************************************
46 ** This file is automatically generated. **
48 ** Any changes made to this file WILL be lost when it is **
49 ** regenerated, which can become necessary at any time. **
51 ** Do not change this file, changes should be done in the derived **
52 ** class @!Classname!@!
54 *****************************************************************************
55 \*****************************************************************************/
57 @@AdditionalPriorityIncludes@@
62 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
63 #pragma warning(disable: 4290) // disable exception specification warning
66 #include "@!HeaderPrefix!@@!Package!@Config.h"
68 @@AdditionalIncludes@@
71 @@if field.needDefaultInclude
72 #include @!field.DefaultInclude:30!@ // @!field.Name!@ default header
73 @@endif // field.needDefaultInclude
78 @@if field.needTypeInclude
79 #include @!field.TypeInclude:30!@ // @!field.Name!@ Class
80 @@endif // field.isPtrField
81 @@endif // field.needTypeInclude
84 #include "OSG@!nsFilePrefix!@@!Classname!@Base.h"
85 #include "OSG@!nsFilePrefix!@@!Classname!@.h"
87 #include <boost/bind.hpp>
91 @@if inExternalNamespace
92 @!LIBNAMESPACE!@_IMPORT_NAMESPACE;
95 /***************************************************************************\
97 \***************************************************************************/
99 /*! \class OSG::@!Classname!@
103 /***************************************************************************\
104 * Field Documentation *
105 \***************************************************************************/
108 /*! \var @!Parent!@Ptr @!Classname!@Base::_sfDecoratee
109 The object being decorated
111 @@else // isDecorator
113 @@if !field.isStoreless
114 /*! \var @!field.FullType:15!@ @!Classname!@Base::_@!field.VarName!@
115 @!field.Description!@
118 @@endif // !field.isStoreless
120 @@endif // isDecorator
122 /***************************************************************************\
123 * FieldType/FieldTrait Instantiation *
124 \***************************************************************************/
126 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
127 PointerType FieldTraits<@!Classname!@ *, @!nsConst!@>::_type(
130 @!Classname!@::getClassType(),
135 OSG_FIELDTRAITS_GETTYPE_NS(@!Classname!@ *, @!nsConst!@)
138 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
141 @@endif // SFPointerField
144 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
147 @@endif // MFPointerField
148 @@else // PointerField
149 OSG_FIELDTRAITS_GETTYPE_NS(@!Classname!@ *, @!nsConst!@)
150 @@endif // PointerField
153 DataType &FieldTraits< @!Classname!@ *, @!nsConst!@ + @!ChildNS!@ >::getType(void)
155 return FieldTraits<@!Classname!@ *, @!nsConst!@>::getType();
158 @@endif // ChildField
161 OSG_EXPORT_PTR_SFIELD(ChildPointerSField,
163 UnrecordedRefCountPolicy,
164 @!nsConst!@ + @!ChildNS!@)
166 @@endif // ChildSFields
169 OSG_EXPORT_PTR_MFIELD(ChildPointerMField,
171 UnrecordedRefCountPolicy,
172 @!nsConst!@ + @!ChildNS!@)
174 @@endif // ChildMFields
177 DataType &FieldTraits<@!Classname!@ *, @!nsConst!@ + @!ParentNS!@ >::getType(void)
179 return FieldTraits<@!Classname!@ *, @!nsConst!@>::getType();
182 @@endif // ParentField
185 OSG_SFIELDTYPE_INST(ParentPointerSField,
188 @!nsConst!@ + @!ParentNS!@);
190 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField,
193 @!nsConst!@ + @!ParentNS!@)
195 @@endif // ParentSFields
198 OSG_MFIELDTYPE_INST(ParentPointerMField,
203 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerMField,
208 @@endif // ParentMFields
209 @@if inExternalNamespace
214 /***************************************************************************\
215 * Field Description *
216 \***************************************************************************/
217 @@if inExternalNamespace
219 @!LIBNAMESPACE!@_BEGIN_NAMESPACE
221 OSG_IMPORT_NAMESPACE;
222 @@endif // inExternalNamespace
224 void @!Classname!@Base::classDescInserter(TypeObject &oType)
227 Inherited::classDescInserter(oType);
231 FieldDescriptionBase *pDesc = NULL;
235 pDesc = new SFUnrec@!Parent!@Ptr::Description(
236 SFUnrec@!Parent!@Ptr::getClassType(),
238 "undocumented decoratee",
239 DecorateeFieldId, DecorateeFieldMask,
241 @!DecorateeFieldFlags!@,
242 static_cast<FieldEditMethodSig>(&@!Classname!@::editHandleDecoratee),
243 static_cast<FieldGetMethodSig >(&@!Classname!@::getHandleDecoratee ));
245 oType.addInitialDesc(pDesc);
246 @@else // isDecorator
249 pDesc = new @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@::Description(
250 @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@::getClassType(),
251 "@!field.DescName!@",
252 @!field.SafeDescription!@,
253 @!field.Name!@FieldId, @!field.Name!@FieldMask,
254 @!field.Visibility!@,
257 static_cast<FieldEditMethodSig>(&@!Classname!@::editHandle@!field.Name!@),
258 @@if !field.isStoreless
259 static_cast<FieldGetMethodSig >(&@!Classname!@::getHandle@!field.Name!@));
260 @@else // !field.isStoreless
261 static_cast <FieldGetMethodSig >(&@!Classname!@::invalidGetField));
262 @@endif // !field.isStoreless
263 @@else //!field.noAccess
264 static_cast <FieldEditMethodSig>(&@!Classname!@::invalidEditField),
265 static_cast <FieldGetMethodSig >(&@!Classname!@::invalidGetField));
266 @@endif //!field.noAccess
268 oType.addInitialDesc(pDesc);
270 @@endif // isDecorator
274 @!Classname!@Base::TypeObject @!Classname!@Base::_type(
275 @!Classname!@Base::getClassname(),
276 Inherited::getClassname(),
278 @!nsConst!@, //Namespace
282 reinterpret_cast<PrototypeCreateF>(&@!Classname!@Base::createEmptyLocal),
283 @@endif // isAbstract
284 reinterpret_cast<InitContainerF>(&@!Classname!@::initMethod),
285 reinterpret_cast<ExitContainerF>(&@!Classname!@::exitMethod),
286 reinterpret_cast<InitalInsertDescFunc>(
287 reinterpret_cast<void *>(&@!Classname!@::classDescInserter)),
289 @!FieldsUnmarkedOnCreate!@,
294 /*------------------------------ get -----------------------------------*/
296 FieldContainerType &@!Classname!@Base::getType(void)
305 const FieldContainerType &@!Classname!@Base::getType(void) const
314 UInt32 @!Classname!@Base::getContainerSize(void) const
316 return sizeof(@!Classname!@);
320 @!Classname!@Base::TypeObject &@!Classname!@Base::getFinalType(void)
325 const @!Classname!@Base::TypeObject &@!Classname!@Base::getFinalType(void) const
331 /*------------------------- decorator get ------------------------------*/
334 const SFUnrec@!Parent!@Ptr *@!Classname!@Base::getSFDecoratee(void) const
336 return &_sfDecoratee;
341 @@if field.isPtrField
342 //! Get the @!Classname!@::_@!field.VarName!@ field.
343 const @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::get@!field.CARD!@@!field.Name!@(void) const
345 if(_sfDecoratee.getValue() != NULL)
347 return getDecoratee()->get@!field.CARD!@@!field.Name!@();
354 //! Get the @!Classname!@::_@!field.VarName!@ field.
355 @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::edit@!field.CARD!@@!field.Name!@(void)
357 if(_sfDecoratee.getValue() != NULL)
359 return getDecoratee()->edit@!field.CARD!@@!field.Name!@();
366 @@else // field.isPtrField
367 @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::edit@!field.CARD!@@!field.Name!@(void)
369 if(_sfDecoratee.getValue() != NULL)
371 return getDecoratee()->edit@!field.CARD!@@!field.Name!@();
379 const @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::get@!field.CARD!@@!field.Name!@(void) const
381 if(_sfDecoratee.getValue() != NULL)
383 return getDecoratee()->get@!field.CARD!@@!field.Name!@();
390 @@endif // field.isPtrField
391 @@endif //!field.noAccess
394 @@endif // isDecorator
399 @@if !field.isStoreless
400 @@if field.isPtrField
401 @@if !field.isParentField
402 //! Get the @!Classname!@::_@!field.VarName!@ field.
403 const @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::get@!field.CARD!@@!field.Name!@(void) const
405 return &_@!field.VarName!@;
407 @@if field.ptrFieldStandardAccess
409 @!field.CARD!@@!field.FieldTypeCaps:17!@ *@!Classname!@Base::edit@!field.CARD!@@!field.Name:15!@(void)
412 editSField(@!field.Name!@FieldMask);
413 @@else // field.isSField
414 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
415 @@endif // field.isSField
417 return &_@!field.VarName!@;
419 @@endif // field.ptrFieldStandardAccess
420 @@endif // !field.isParentField
422 @@if field.ptrFieldNullCheckAccess
424 @!field.CARD!@@!field.FieldTypeCaps:17!@ *@!Classname!@Base::edit@!field.CARD!@@!field.Name:15!@(void)
427 editSField(@!field.Name!@FieldMask);
428 @@else // field.isSField
429 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
430 @@endif // field.isSField
432 return &_@!field.VarName!@;
434 @@endif // field.ptrFieldNullCheckAccess
438 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
439 @!field.FullType!@ @!Classname!@Base::get@!field.Name!@(void) const
441 return _@!field.VarName!@.getValue();
444 @@if !field.isParentField
445 @@if !field.ptrFieldCustomAccess
446 //! Set the value of the @!Classname!@::_@!field.VarName!@ field.
447 @@if field.PassFieldMask
448 void @!Classname!@Base::set@!field.Name!@(@!field.Type!@ const value,
449 const UInt16 uiStoredInFieldId)
450 @@else // field.PassFieldMask
451 void @!Classname!@Base::set@!field.Name!@(@!field.Type!@ const value)
452 @@endif // field.PassFieldMask
454 editSField(@!field.Name!@FieldMask);
456 _@!field.VarName!@.setValue(value);
458 @@endif //!field.ptrFieldCustomAccess
459 @@endif // !field.isParentField
460 @@endif // !isDecoratable
461 @@endif // !isDecorator
463 @@else // field.isSField
466 @!field.Type!@ @!Classname!@Base::get@!field.Name!@(const UInt32 index) const
468 return _@!field.VarName!@[index];
470 @@endif // !isDecoratable
471 @@endif // !isDecorator
472 @@endif // field.isSField
473 @@else // field.isPtrField
474 @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::edit@!field.CARD!@@!field.Name!@(void)
477 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
478 @@else // field.isMField
479 editSField(@!field.Name!@FieldMask);
480 @@endif // field.isMField
482 return &_@!field.VarName!@;
485 const @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps!@ *@!Classname!@Base::get@!field.CARD!@@!field.Name!@(void) const
487 return &_@!field.VarName!@;
490 @@endif // field.isPtrField
491 @@endif // !field.isStoreless
492 @@endif //!field.noAccess
495 @@endif // !isDecorator
499 @@if field.isPtrField
501 @@if !field.isParentField
502 @@if field.writePushToField
503 void @!Classname!@Base::@!field.PushToField!@(@!field.Type!@ const value)
505 @@if field.ptrFieldNullCheckAccess
509 @@endif // field.ptrFieldNullCheckAccess
510 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
512 _mf@!field.Name!@.push_back(value);
515 @@endif // field.writePushToField
516 @@if field.writeAssignMField
517 void @!Classname!@Base::@!field.AssignMField:15!@(const @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps:15!@ &value)
519 @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps:15!@::const_iterator elemIt =
521 @!field.FieldTypeNS!@@!field.CARD!@@!field.FieldTypeCaps:15!@::const_iterator elemEnd =
524 static_cast<@!Classname!@ *>(this)->@!field.ClearField!@();
526 while(elemIt != elemEnd)
528 this->@!field.PushToField!@(*elemIt);
534 @@endif // field.writeAssignMField
535 @@if field.writeInsertIntoMField
536 void @!Classname!@Base::@!field.InsertIntoMField!@(UInt32 uiIndex,
537 @!field.Type!@ const value )
539 @@if field.ptrFieldNullCheckAccess
543 @@endif // field.ptrFieldNullCheckAccess
544 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
546 MF@!field.FieldTypeCaps!@::iterator fieldIt = _mf@!field.Name!@.begin_nc();
550 _mf@!field.Name!@.insert(fieldIt, value);
553 @@endif // field.writeInsertIntoMField
554 @@if field.writeReplaceInMFieldIndex
555 void @!Classname!@Base::@!field.ReplaceInMFieldIndex!@(UInt32 uiIndex,
556 @!field.Type!@ const value )
558 @@if field.ptrFieldNullCheckAccess
562 @@endif // field.ptrFieldNullCheckAccess
563 if(uiIndex >= _mf@!field.Name!@.size())
566 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
568 _mf@!field.Name!@.replace(uiIndex, value);
571 @@endif // field.writeReplaceInMFieldIndex
572 @@if field.writeReplaceInMFieldObject
573 void @!Classname!@Base::@!field.ReplaceInMFieldObject!@(@!field.Type!@ const pOldElem,
574 @!field.Type!@ const pNewElem)
576 @@if field.ptrFieldNullCheckAccess
580 @@endif // field.ptrFieldNullCheckAccess
581 Int32 elemIdx = _mf@!field.Name!@.findIndex(pOldElem);
585 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
587 _mf@!field.Name!@.replace(elemIdx, pNewElem);
591 @@endif // field.writeReplaceInMFieldObject
592 @@if field.writeRemoveFromMFieldIndex
593 void @!Classname!@Base::@!field.RemoveFromMFieldIndex!@(UInt32 uiIndex)
595 if(uiIndex < _mf@!field.Name!@.size())
597 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
599 @@if field.isRemoveToSet
600 _mf@!field.Name!@.replace(uiIndex, @!field.RemoveTo!@);
601 @@else // field.isRemoveToSet
602 _mf@!field.Name!@.erase(uiIndex);
603 @@endif // field.isRemoveToSet
607 @@endif // field.writeRemoveFromMFieldIndex
608 @@if field.writeRemoveFromMFieldObject
609 void @!Classname!@Base::@!field.RemoveFromMFieldObject!@(@!field.Type!@ const value)
611 Int32 iElemIdx = _mf@!field.Name!@.findIndex(value);
615 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
617 @@if field.isRemoveToSet
618 _mf@!field.Name!@.replace(iElemIdx, @!field.RemoveTo!@);
619 @@else // field.isRemoveToSet
620 _mf@!field.Name!@.erase(iElemIdx);
621 @@endif // field.isRemoveToSet
624 @@endif // field.writeRemoveFromMFieldObject
625 @@if field.writeClearField
626 void @!Classname!@Base::@!field.ClearField!@(void)
628 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
630 @@if field.isRemoveToSet
631 MF@!field.FieldTypeCaps!@::iterator fieldIt = _mf@!field.Name!@.begin_nc();
632 MF@!field.FieldTypeCaps!@::const_iterator fieldEnd = _mf@!field.Name!@.end ();
634 while(fieldIt != fieldEnd)
636 _mf@!field.Name!@.replace(fieldIt, @!field.RemoveTo!@);
640 @@else // field.isRemoveToSet
641 @@if field.doClearMField
643 _mf@!field.Name!@.clear();
644 @@endif // field.doClearMField
645 @@endif // field.isRemoveToSet
647 @@endif // field.writeClearField
648 @@endif // !field.isParentField
650 @@endif //!field.noAccess
651 @@endif // field.isPtrField
655 /*------------------------------ access -----------------------------------*/
657 SizeT @!Classname!@Base::getBinSize(ConstFieldMaskArg whichField)
659 SizeT returnValue = Inherited::getBinSize(whichField);
662 if(FieldBits::NoField != (DecorateeFieldMask & whichField))
664 returnValue += _sfDecoratee.getBinSize();
666 @@else // isDecorator
668 @@if !field.customBinCopy
669 @@if !field.isStoreless
670 if(FieldBits::NoField != (@!field.Name!@FieldMask & whichField))
672 returnValue += _@!field.VarName!@.getBinSize();
674 @@endif // !field.isStoreless
675 @@endif // !field.customBinCopy
677 @@endif // isDecorator
682 void @!Classname!@Base::copyToBin(BinaryDataHandler &pMem,
683 ConstFieldMaskArg whichField)
685 Inherited::copyToBin(pMem, whichField);
688 if(FieldBits::NoField != (DecorateeFieldMask & whichField))
690 _sfDecoratee.copyToBin(pMem);
692 @@else // isDecorator
694 @@if !field.customBinCopy
695 @@if !field.isStoreless
696 if(FieldBits::NoField != (@!field.Name!@FieldMask & whichField))
698 _@!field.VarName!@.copyToBin(pMem);
700 @@endif // !field.isStoreless
701 @@endif // !field.customBinCopy
703 @@endif // isDecorator
706 void @!Classname!@Base::copyFromBin(BinaryDataHandler &pMem,
707 ConstFieldMaskArg whichField)
709 Inherited::copyFromBin(pMem, whichField);
712 if(FieldBits::NoField != (DecorateeFieldMask & whichField))
714 editSField(DecorateeFieldMask);
715 _sfDecoratee.copyFromBin(pMem);
717 @@else // isDecorator
719 @@if !field.customBinCopy
720 @@if !field.isStoreless
721 if(FieldBits::NoField != (@!field.Name!@FieldMask & whichField))
724 editSField(@!field.Name!@FieldMask);
726 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
728 _@!field.VarName!@.copyFromBin(pMem);
730 @@endif // !field.isStoreless
731 @@endif // !field.customBinCopy
733 @@endif // isDecorator
737 //! create a new instance of the class
738 @!Classname!@TransitPtr @!Classname!@Base::createLocal(BitVector bFlags)
740 @!Classname!@TransitPtr fc;
742 if(getClassType().getPrototype() != NULL)
744 FieldContainerTransitPtr tmpPtr =
745 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
747 fc = dynamic_pointer_cast<@!Classname!@>(tmpPtr);
753 //! create a new instance of the class, copy the container flags
754 @!Classname!@TransitPtr @!Classname!@Base::createDependent(BitVector bFlags)
756 @!Classname!@TransitPtr fc;
758 if(getClassType().getPrototype() != NULL)
760 FieldContainerTransitPtr tmpPtr =
761 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
763 fc = dynamic_pointer_cast<@!Classname!@>(tmpPtr);
769 //! create a new instance of the class
770 @!Classname!@TransitPtr @!Classname!@Base::create(void)
773 @!Classname!@TransitPtr fc;
775 if(getClassType().getPrototype() != NULL)
777 FieldContainerTransitPtr tmpPtr =
778 getClassType().getPrototype()-> shallowCopy();
780 fc = dynamic_pointer_cast<@!Classname!@>(tmpPtr);
785 return createLocal();
788 @@endif // !isAbstract
791 @!Classname!@ *@!Classname!@Base::createEmptyLocal(BitVector bFlags)
793 @!Classname!@ *returnValue;
795 newPtr<@!Classname!@>(returnValue, bFlags);
797 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
802 //! create an empty new instance of the class, do not copy the prototype
803 @!Classname!@ *@!Classname!@Base::createEmpty(void)
806 @!Classname!@ *returnValue;
808 newPtr<@!Classname!@>(returnValue, Thread::getCurrentLocalFlags());
810 returnValue->_pFieldFlags->_bNamespaceMask &=
811 ~Thread::getCurrentLocalFlags();
815 return createEmptyLocal();
820 FieldContainerTransitPtr @!Classname!@Base::shallowCopyLocal(
821 BitVector bFlags) const
823 @!Classname!@ *tmpPtr;
825 newPtr(tmpPtr, dynamic_cast<const @!Classname!@ *>(this), bFlags);
827 FieldContainerTransitPtr returnValue(tmpPtr);
829 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
834 FieldContainerTransitPtr @!Classname!@Base::shallowCopyDependent(
835 BitVector bFlags) const
837 @!Classname!@ *tmpPtr;
839 newPtr(tmpPtr, dynamic_cast<const @!Classname!@ *>(this), ~bFlags);
841 FieldContainerTransitPtr returnValue(tmpPtr);
843 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
848 FieldContainerTransitPtr @!Classname!@Base::shallowCopy(void) const
851 @!Classname!@ *tmpPtr;
854 dynamic_cast<const @!Classname!@ *>(this),
855 Thread::getCurrentLocalFlags());
857 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
859 FieldContainerTransitPtr returnValue(tmpPtr);
863 return shallowCopyLocal();
868 @@endif // !isAbstract
871 /*------------------------- constructors ----------------------------------*/
873 @!Classname!@Base::@!Classname!@Base(void) :
880 @@else // isDecorator
882 @@if !field.isStoreless
883 @@if field.isChildField
884 _@!field.VarName:25!@(this,
885 @!field.Name!@FieldId,
886 @!field.TypeRaw!@::@!field.linkParentField!@FieldId)@!field.Separator!@
887 @@else // field.isChildField
888 _@!field.VarName:25!@(@!field.TypedDefault!@)@!field.Separator!@
889 @@endif // field.isChildField
890 @@endif // !field.isStoreless
892 @@endif // isDecorator
893 @@endif // !hasFields
897 @!Classname!@Base::@!Classname!@Base(const @!Classname!@Base &source) :
903 _sfDecoratee(source._sfDecoratee)
904 @@else // isDecorator
906 @@if !field.isStoreless
907 @@if field.isPtrField
908 @@if field.isChildField
909 _@!field.VarName:25!@(this,
910 @!field.Name!@FieldId,
911 @!field.TypeRaw!@::@!field.linkParentField!@FieldId)@!field.Separator!@
914 _@!field.VarName:25!@(NULL)@!field.Separator!@
916 _@!field.VarName:25!@()@!field.Separator!@
918 @@endif // ChildField
919 @@else // field.isPtrField
920 _@!field.VarName:25!@(source._@!field.VarName:25!@)@!field.Separator!@
921 @@endif // field.isPtrField
922 @@endif // !field.isStoreless
924 @@endif // isDecorator
925 @@endif // !hasFields
930 /*-------------------------- destructors ----------------------------------*/
932 @!Classname!@Base::~@!Classname!@Base(void)
936 /*-------------------------------------------------------------------------*/
939 bool @!Classname!@Base::linkParent(
940 FieldContainer * const pParent,
941 UInt16 const childFieldId,
942 UInt16 const parentFieldId )
945 @@if field.isParentField
946 if(parentFieldId == @!field.Name!@FieldId)
948 @!field.Type!@ pTypedParent =
949 dynamic_cast< @!field.Type!@ >(pParent);
951 if(pTypedParent != NULL)
954 FieldContainer *pOldParent =
955 _@!field.VarName!@.getValue ();
957 UInt16 oldChildFieldId =
958 _@!field.VarName!@.getParentFieldPos();
960 if(pOldParent != NULL)
962 pOldParent->unlinkChild(this, oldChildFieldId);
965 editSField(@!field.Name!@FieldMask);
967 _@!field.VarName!@.setValue(static_cast<@!field.TypeNS!@@!field.Type!@>(pParent), childFieldId);
968 @@endif // @!field.cardinality!@ == "single"
970 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
972 _@!field.VarName!@.push_back(pTypedParent, childFieldId);
973 @@endif // @!field.cardinality!@ == "multi"
981 @@endif // @!field.category!@ == "pointer" and @!field.pointertype!@ == "parent"
983 return Inherited::linkParent(pParent, childFieldId, parentFieldId);
986 bool @!Classname!@Base::unlinkParent(
987 FieldContainer * const pParent,
988 UInt16 const parentFieldId)
991 @@if field.isParentField
992 if(parentFieldId == @!field.Name!@FieldId)
994 @!field.TypeNS!@@!field.Type!@ pTypedParent =
995 dynamic_cast< @!field.FieldTypeNS!@@!field.Type!@ >(pParent);
997 if(pTypedParent != NULL)
1000 if(_@!field.VarName!@.getValue() == pTypedParent)
1002 editSField(@!field.Name!@FieldMask);
1004 _@!field.VarName!@.setValue(NULL, 0xFFFF);
1008 @@endif // @!field.cardinality!@ == "single"
1010 Int32 iParentIdx = _@!field.VarName!@.findIndex(pTypedParent);
1012 if(iParentIdx != -1)
1014 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
1016 _@!field.VarName!@.erase(iParentIdx);
1020 @@endif // @!field.cardinality!@ == "multi"
1022 SWARNING << "Child ([" << this
1023 << "] id [" << this->getId()
1024 << "] type [" << this->getType().getCName()
1025 << "] parentFieldId [" << parentFieldId
1026 << "]) - Parent ([" << pParent
1027 << "] id [" << pParent->getId()
1028 << "] type [" << pParent->getType().getCName()
1029 << "]): link inconsistent!"
1038 @@endif // @!field.category!@ == "pointer" and @!field.pointertype!@ == "parent"
1040 return Inherited::unlinkParent(pParent, parentFieldId);
1043 @@endif // @!hasParentFields!@
1046 /*-------------------------------------------------------------------------*/
1049 bool @!Classname!@Base::unlinkChild(
1050 FieldContainer * const pChild,
1051 UInt16 const childFieldId)
1054 @@if field.isChildField
1055 if(childFieldId == @!field.Name!@FieldId)
1057 @!field.TypeNS!@@!field.Type!@ pTypedChild =
1058 dynamic_cast<@!field.TypeNS!@@!field.Type!@>(pChild);
1060 if(pTypedChild != NULL)
1063 if(_@!field.VarName!@.getValue() == pTypedChild)
1065 editSField(@!field.Name!@FieldMask);
1067 _@!field.VarName!@.setValue(NULL);
1071 @@endif // @!field.cardinality!@ == "single"
1073 Int32 iChildIdx = _@!field.VarName!@.findIndex(pTypedChild);
1077 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
1079 _@!field.VarName!@.erase(iChildIdx);
1083 @@endif // @!field.cardinality!@ == "multi"
1085 SWARNING << "Parent ([" << this
1086 << "] id [" << this->getId()
1087 << "] type [" << this->getType().getCName()
1088 << "] childFieldId [" << childFieldId
1089 << "]) - Child ([" << pChild
1090 << "] id [" << pChild->getId()
1091 << "] type [" << pChild->getType().getCName()
1092 << "]): link inconsistent!"
1101 @@endif // @!field.category!@ == "pointer" and @!field.pointertype!@ == "child"
1104 return Inherited::unlinkChild(pChild, childFieldId);
1107 @@endif // @!hasChildFields!@
1109 void @!Classname!@Base::onCreate(const @!Classname!@ *source)
1111 Inherited::onCreate(source);
1115 @!Classname!@ *pThis = static_cast<@!Classname!@ *>(this);
1117 @@if field.isPtrField
1118 @@if !field.noAccess
1119 @@if !field.isStoreless
1122 MF@!field.FieldTypeCaps!@::const_iterator @!field.Name!@It =
1123 source->_mf@!field.Name!@.begin();
1124 MF@!field.FieldTypeCaps!@::const_iterator @!field.Name!@End =
1125 source->_mf@!field.Name!@.end ();
1127 while(@!field.Name!@It != @!field.Name!@End)
1129 pThis->@!field.PushToField!@(*@!field.Name!@It);
1133 @@else // field.isMField
1135 pThis->set@!field.Name!@(source->get@!field.Name!@());
1136 @@endif // field.isMField
1137 @@endif // !field.isStoreless
1138 @@endif // !field.noAccess
1139 @@endif // field.isPtrField
1143 @@endif // hasPtrFields
1146 GetFieldHandlePtr @!Classname!@Base::getHandleDecoratee (void) const
1148 SFUnrec@!Parent!@Ptr::GetHandlePtr returnValue(
1149 new SFUnrec@!Parent!@Ptr::GetHandle(
1151 this->getType().getFieldDesc(DecorateeFieldId),
1152 const_cast<@!Classname!@Base *>(this)));
1157 EditFieldHandlePtr @!Classname!@Base::editHandleDecoratee(void)
1159 SFUnrec@!Parent!@Ptr::EditHandlePtr returnValue(
1160 new SFUnrec@!Parent!@Ptr::EditHandle(
1162 this->getType().getFieldDesc(DecorateeFieldId),
1165 returnValue->setSetMethod(boost::bind(&@!Classname!@::setDecoratee,
1166 static_cast<@!Classname!@ *>(this), _1));
1168 editSField(DecorateeFieldMask);
1173 @@endif // isDecorator
1175 @@if !field.isStoreless
1176 GetFieldHandlePtr @!Classname!@Base::getHandle@!field.Name:15!@ (void) const
1178 @@if !field.noAccess
1179 @@if !field.isParentField
1180 @!field.CARD!@@!field.FieldTypeCaps!@::GetHandlePtr returnValue(
1181 new @!field.CARD!@@!field.FieldTypeCaps!@::GetHandle(
1182 &_@!field.VarName!@,
1183 this->getType().getFieldDesc(@!field.Name!@FieldId),
1184 const_cast<@!Classname!@Base *>(this)));
1185 @@else // !field.isParentField
1186 @!field.CARD!@@!field.FieldTypeCaps!@::GetHandlePtr returnValue;
1187 @@endif // !field.isParentField
1188 @@else // !field.noAccess
1189 @!field.CARD!@@!field.FieldTypeCaps!@::GetHandlePtr returnValue;
1190 @@endif // !field.noAccess
1194 @@endif // !field.isStoreless
1196 EditFieldHandlePtr @!Classname!@Base::editHandle@!field.Name:15!@(void)
1198 @@if !field.noAccess
1199 @@if !field.isParentField
1200 @!field.CARD!@@!field.FieldTypeCaps!@::EditHandlePtr returnValue(
1201 new @!field.CARD!@@!field.FieldTypeCaps!@::EditHandle(
1202 @@if !field.isStoreless
1203 &_@!field.VarName!@,
1204 @@else // !field.isStoreless
1206 @@endif // !field.isStoreless
1207 this->getType().getFieldDesc(@!field.Name!@FieldId),
1210 @@if field.isStoreless
1211 returnValue->setStoreless();
1213 @@endif // field.isStoreless
1215 @@if field.isPtrField
1216 @@if field.hasPushToField
1217 returnValue->setAddMethod(
1218 boost::bind(&@!Classname!@::@!field.PushToField!@,
1219 static_cast<@!Classname!@ *>(this), _1));
1220 @@endif // field.hasPushToField
1221 @@if field.hasInsertIntoMField
1222 returnValue->setInsertMethod(
1223 boost::bind(&@!Classname!@::@!field.InsertIntoMField!@,
1224 static_cast<@!Classname!@ *>(this), _1, _2));
1225 @@endif // field.hasInsertIntoMField
1226 @@if field.hasReplaceInMFieldIndex
1227 returnValue->setReplaceMethod(
1228 boost::bind(&@!Classname!@::@!field.ReplaceInMFieldIndex!@,
1229 static_cast<@!Classname!@ *>(this), _1, _2));
1230 @@endif // field.hasReplaceInMFieldIndex
1231 @@if field.hasReplaceInMFieldObject
1232 returnValue->setReplaceObjMethod(
1233 boost::bind(&@!Classname!@::@!field.ReplaceInMFieldObject!@,
1234 static_cast<@!Classname!@ *>(this), _1, _2));
1235 @@endif // field.hasReplaceInMFieldObject
1236 @@if field.hasRemoveFromMFieldIndex
1237 returnValue->setRemoveMethod(
1238 boost::bind(&@!Classname!@::@!field.RemoveFromMFieldIndex!@,
1239 static_cast<@!Classname!@ *>(this), _1));
1240 @@endif // field.hasRemoveFromMFieldIndex
1241 @@if field.hasRemoveFromMFieldObject
1242 returnValue->setRemoveObjMethod(
1243 boost::bind(&@!Classname!@::@!field.RemoveFromMFieldObject!@,
1244 static_cast<@!Classname!@ *>(this), _1));
1245 @@endif // field.hasRemoveFromMFieldObject
1246 @@if field.hasClearField
1247 returnValue->setClearMethod(
1248 boost::bind(&@!Classname!@::@!field.ClearField!@,
1249 static_cast<@!Classname!@ *>(this)));
1250 @@endif // field.hasClearField
1251 @@endif // field.isPtrField
1253 @@if !field.isStoreless
1254 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
1255 @@endif // !field.isStoreless
1256 @@else // field.isMField
1257 @@if field.isPtrField
1258 returnValue->setSetMethod(
1259 boost::bind(&@!Classname!@::set@!field.Name!@,
1260 static_cast<@!Classname!@ *>(this), _1));
1261 @@endif // field.isPtrField
1263 @@if !field.isStoreless
1264 editSField(@!field.Name!@FieldMask);
1265 @@endif // !field.isStoreless
1266 @@endif // field.isMField
1267 @@else // !field.isParentField
1268 EditFieldHandlePtr returnValue;
1269 @@endif // !field.isParentField
1270 @@else // !field.noAccess
1271 EditFieldHandlePtr returnValue;
1272 @@endif // !field.noAccess
1279 #ifdef OSG_MT_CPTR_ASPECT
1280 void @!Classname!@Base::execSyncV( FieldContainer &oFrom,
1281 ConstFieldMaskArg whichField,
1282 AspectOffsetStore &oOffsets,
1283 ConstFieldMaskArg syncMode,
1284 const UInt32 uiSyncInfo)
1286 @!Classname!@ *pThis = static_cast<@!Classname!@ *>(this);
1288 pThis->execSync(static_cast<@!Classname!@ *>(&oFrom),
1298 #ifdef OSG_MT_CPTR_ASPECT
1299 FieldContainer *@!Classname!@Base::createAspectCopy(
1300 const FieldContainer *pRefAspect) const
1302 @!Classname!@ *returnValue;
1304 newAspectCopy(returnValue,
1305 dynamic_cast<const @!Classname!@ *>(pRefAspect),
1306 dynamic_cast<const @!Classname!@ *>(this));
1311 @@endif // !isAbstract
1313 void @!Classname!@Base::resolveLinks(void)
1316 static_cast<@!Classname!@ *>(this)->setDecoratee(NULL);
1319 Inherited::resolveLinks();
1321 @@if field.isPtrField
1322 @@if !field.noAccess
1323 @@if !field.isParentField
1326 static_cast<@!Classname!@ *>(this)->set@!field.Name!@(NULL);
1327 @@else // field.isSField
1329 static_cast<@!Classname!@ *>(this)->@!field.ClearField!@();
1330 @@endif // field.isSField
1331 @@endif // !field.isParentField
1332 @@endif //!field.noAccess
1333 @@endif // field.isPtrField
1337 #ifdef OSG_MT_CPTR_ASPECT
1338 AspectOffsetStore oOffsets;
1340 _pAspectStore->fillOffsetArray(oOffsets, this);
1342 @@endif // hasValueMField
1344 @@BeginMFFieldLoop@@
1345 @@if !field.isPtrField
1346 #ifdef OSG_MT_CPTR_ASPECT
1347 _@!field.VarName!@.terminateShare(Thread::getCurrentAspect(),
1350 @@endif // field.isPtrField
1355 /*------------------------------ get -----------------------------------*/
1358 @@BeginSFFieldLoop@@
1359 @@if field.isPtrField
1361 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
1362 @!field.Type!@ @!Classname!@Base::get@!field.Name!@(void) const
1364 return _@!field.VarName!@.getValue();
1367 //! Set the value of the @!Classname!@::_@!field.VarName!@ field.
1368 void @!Classname!@Base::set@!field.Name!@(@!field.Type!@ const value)
1370 editSField(@!field.Name!@FieldMask);
1372 _@!field.VarName!@.setValue(value);
1374 @@else // field.isPtrField
1375 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
1377 @!field.FullType!@ &@!Classname!@Base::edit@!field.Name!@(void)
1379 editSField(@!field.Name!@FieldMask);
1381 return _@!field.VarName!@.getValue();
1384 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
1385 @!field.RetConst!@ @!field.FullType!@ @!field.RetRef!@@!Classname!@Base::get@!field.Name!@(void) const
1387 return _@!field.VarName!@.getValue();
1391 //! Set the value of the @!Classname!@::_@!field.VarName!@ field.
1392 void @!Classname!@Base::set@!field.Name!@(const @!field.FullType!@ @!field.ArgRef!@value)
1394 editSField(@!field.Name!@FieldMask);
1396 _@!field.VarName!@.setValue(value);
1398 @@endif // field.isPtrField
1401 @@BeginMFFieldLoop@@
1402 //! Get the value of the \a index element the @!Classname!@::_@!field.VarName!@ field.
1403 @@if field.isPtrField
1404 @!field.Type!@ @!Classname!@Base::get@!field.Name!@(const UInt32 index) const
1405 @@else // field.isPtrField
1406 @!field.RetConst!@ @!field.Type!@ @!field.RetRef!@@!Classname!@Base::get@!field.Name!@(const UInt32 index) const
1407 @@endif // field.isPtrField
1409 return _@!field.VarName!@[index];
1411 @@if !field.isPtrField
1413 @!field.Type!@ &@!Classname!@Base::edit@!field.Name!@(const UInt32 index)
1415 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
1417 return _@!field.VarName!@[index];
1420 //! Get the @!Classname!@::_@!field.VarName!@ field.
1421 @!field.FieldTypeNS!@@!field.CARD!@@!field.TypeCaps!@ &@!Classname!@Base::edit@!field.Name!@(void)
1423 editMField(@!field.Name!@FieldMask, _@!field.VarName!@);
1425 return _@!field.VarName!@;
1428 @@endif // !field.isPtrField
1430 //! Get the @!Classname!@::_@!field.VarName!@ field.
1431 const @!field.FieldTypeNS!@@!field.CARD!@@!field.TypeCaps!@ &@!Classname!@Base::get@!field.Name!@(void) const
1433 return _@!field.VarName!@;
1437 @@else // !isDecorator
1438 @@BeginSFFieldLoop@@
1439 @@if field.isPtrField
1441 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
1442 @!field.Type!@ @!Classname!@Base::get@!field.Name!@(void) const
1444 if(_sfDecoratee.getValue() != NULL)
1446 return getDecoratee()->get@!field.Name!@();
1450 return Inherited::get@!field.Name!@();
1454 //! Set the value of the @!Classname!@::_@!field.VarName!@ field.
1455 void @!Classname!@Base::set@!field.Name!@(@!field.Type!@ const value)
1457 if(_sfDecoratee.getValue() != NULL)
1459 getDecoratee()->set@!field.Name!@(value);
1463 Inherited::set@!field.Name!@(value);
1466 @@else // field.isPtrField
1468 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
1469 @!field.Type!@ &@!Classname!@Base::edit@!field.Name!@(void)
1471 if(_sfDecoratee.getValue() != NULL)
1473 return getDecoratee()->edit@!field.Name!@();
1477 return Inherited::edit@!field.Name!@();
1481 //! Get the value of the @!Classname!@::_@!field.VarName!@ field.
1482 @!field.RetConst!@ @!field.Type!@ @!field.RetRef!@@!Classname!@Base::get@!field.Name!@(void) const
1484 if(_sfDecoratee.getValue() != NULL)
1486 return getDecoratee()->get@!field.Name!@();
1490 return Inherited::get@!field.Name!@();
1495 //! Set the value of the @!Classname!@::_@!field.VarName!@ field.
1496 void @!Classname!@Base::set@!field.Name!@(const @!field.Type!@ @!field.ArgRef!@value)
1498 if(_sfDecoratee.getValue() != NULL)
1500 getDecoratee()->set@!field.Name!@(value);
1504 Inherited::set@!field.Name!@(value);
1507 @@endif // field.isPtrField
1510 @@BeginMFFieldLoop@@
1511 //! Get the value of the \a index element the @!Classname!@::_@!field.VarName!@ field.
1512 @@if field.isPtrField
1513 @!field.Type!@ @!Classname!@Base::get@!field.Name!@(const UInt32 index) const
1514 @@else // field.isPtrField
1515 @!field.RetConst!@ @!field.Type!@ @!field.RetRef!@@!Classname!@Base::get@!field.Name!@(const UInt32 index) const
1516 @@endif // field.isPtrField
1518 if(_sfDecoratee.getValue() != NULL)
1520 return getDecoratee()->get@!field.Name!@(index);
1524 return Inherited::get@!field.Name!@(index);
1527 @@if !field.isPtrField
1529 @!field.Type!@ &@!Classname!@Base::edit@!field.Name!@(const UInt32 index)
1531 if(_sfDecoratee.getValue() != NULL)
1533 return getDecoratee()->edit@!field.Name!@(index);
1537 return Inherited::edit@!field.Name!@(index);
1541 //! Get the @!Classname!@::_@!field.VarName!@ field.
1542 @!field.FieldTypeNS!@@!field.CARD!@@!field.TypeCaps!@ &@!Classname!@Base::edit@!field.Name!@(void)
1544 if(_sfDecoratee.getValue() != NULL)
1546 return getDecoratee()->edit@!field.Name!@();
1550 return Inherited::edit@!field.Name!@();
1553 @@endif // !field.isPtrField
1555 //! Get the @!Classname!@::_@!field.VarName!@ field.
1556 const @!field.FieldTypeNS!@@!field.CARD!@@!field.TypeCaps!@ &@!Classname!@Base::get@!field.Name!@(void) const
1558 if(_sfDecoratee.getValue() != NULL)
1560 return getDecoratee()->get@!field.Name!@();
1564 return Inherited::get@!field.Name!@();
1569 @@endif // !isDecorator
1570 @@endif // isDecoratable
1572 @!LIBNAMESPACE!@_END_NAMESPACE