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 StringAttributeMap!
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 "OSGStringAttributeMapBase.h"
67 #include "OSGStringAttributeMap.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::StringAttributeMap
78 An attachment that stores a string-to-string mapping of keys to values.
79 User code can store any key and value pair and interpret the string value in
80 whatever ways are appropriate.
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var std::string StringAttributeMapBase::_mfKeys
91 /*! \var std::string StringAttributeMapBase::_mfValues
96 /***************************************************************************\
97 * FieldType/FieldTrait Instantiation *
98 \***************************************************************************/
100 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
101 PointerType FieldTraits
<StringAttributeMap
*, nsOSG
>::_type(
102 "StringAttributeMapPtr",
104 StringAttributeMap::getClassType(),
108 OSG_FIELDTRAITS_GETTYPE_NS(StringAttributeMap
*, nsOSG
)
110 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
111 StringAttributeMap
*,
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void StringAttributeMapBase::classDescInserter(TypeObject
&oType
)
121 FieldDescriptionBase
*pDesc
= NULL
;
124 pDesc
= new MFString::Description(
125 MFString::getClassType(),
128 KeysFieldId
, KeysFieldMask
,
130 (Field::MFDefaultFlags
| Field::FStdAccess
),
131 static_cast<FieldEditMethodSig
>(&StringAttributeMap::editHandleKeys
),
132 static_cast<FieldGetMethodSig
>(&StringAttributeMap::getHandleKeys
));
134 oType
.addInitialDesc(pDesc
);
136 pDesc
= new MFString::Description(
137 MFString::getClassType(),
140 ValuesFieldId
, ValuesFieldMask
,
142 (Field::MFDefaultFlags
| Field::FStdAccess
),
143 static_cast<FieldEditMethodSig
>(&StringAttributeMap::editHandleValues
),
144 static_cast<FieldGetMethodSig
>(&StringAttributeMap::getHandleValues
));
146 oType
.addInitialDesc(pDesc
);
150 StringAttributeMapBase::TypeObject
StringAttributeMapBase::_type(
151 StringAttributeMapBase::getClassname(),
152 Inherited::getClassname(),
153 "StringAttributeMap",
155 reinterpret_cast<PrototypeCreateF
>(&StringAttributeMapBase::createEmptyLocal
),
156 reinterpret_cast<InitContainerF
>(&StringAttributeMap::initMethod
),
157 reinterpret_cast<ExitContainerF
>(&StringAttributeMap::exitMethod
),
158 reinterpret_cast<InitalInsertDescFunc
>(
159 reinterpret_cast<void *>(&StringAttributeMap::classDescInserter
)),
162 "<?xml version=\"1.0\"?>\n"
165 " name=\"StringAttributeMap\"\n"
166 " parent=\"Attachment\"\n"
167 " library=\"System\"\n"
168 " pointerfieldtypes=\"single\"\n"
169 " structure=\"concrete\"\n"
170 " systemcomponent=\"true\"\n"
171 " parentsystemcomponent=\"true\"\n"
172 " decoratable=\"false\"\n"
173 " useLocalIncludes=\"false\"\n"
174 " docGroupBase=\"GrpSystemFieldContainer\"\n"
176 " An attachment that stores a string-to-string mapping of keys to values.\n"
177 " User code can store any key and value pair and interpret the string value in\n"
178 " whatever ways are appropriate.\n"
181 "\t type=\"std::string\"\n"
182 "\t cardinality=\"multi\"\n"
183 "\t visibility=\"external\"\n"
184 "\t access=\"protected\"\n"
188 "\t name=\"values\"\n"
189 "\t type=\"std::string\"\n"
190 "\t cardinality=\"multi\"\n"
191 "\t visibility=\"external\"\n"
192 "\t access=\"protected\"\n"
195 "</FieldContainer>\n",
196 "An attachment that stores a string-to-string mapping of keys to values.\n"
197 "User code can store any key and value pair and interpret the string value in\n"
198 "whatever ways are appropriate.\n"
201 /*------------------------------ get -----------------------------------*/
203 FieldContainerType
&StringAttributeMapBase::getType(void)
208 const FieldContainerType
&StringAttributeMapBase::getType(void) const
213 UInt32
StringAttributeMapBase::getContainerSize(void) const
215 return sizeof(StringAttributeMap
);
218 /*------------------------- decorator get ------------------------------*/
221 MFString
*StringAttributeMapBase::editMFKeys(void)
223 editMField(KeysFieldMask
, _mfKeys
);
228 const MFString
*StringAttributeMapBase::getMFKeys(void) const
234 MFString
*StringAttributeMapBase::editMFValues(void)
236 editMField(ValuesFieldMask
, _mfValues
);
241 const MFString
*StringAttributeMapBase::getMFValues(void) const
251 /*------------------------------ access -----------------------------------*/
253 SizeT
StringAttributeMapBase::getBinSize(ConstFieldMaskArg whichField
)
255 SizeT returnValue
= Inherited::getBinSize(whichField
);
257 if(FieldBits::NoField
!= (KeysFieldMask
& whichField
))
259 returnValue
+= _mfKeys
.getBinSize();
261 if(FieldBits::NoField
!= (ValuesFieldMask
& whichField
))
263 returnValue
+= _mfValues
.getBinSize();
269 void StringAttributeMapBase::copyToBin(BinaryDataHandler
&pMem
,
270 ConstFieldMaskArg whichField
)
272 Inherited::copyToBin(pMem
, whichField
);
274 if(FieldBits::NoField
!= (KeysFieldMask
& whichField
))
276 _mfKeys
.copyToBin(pMem
);
278 if(FieldBits::NoField
!= (ValuesFieldMask
& whichField
))
280 _mfValues
.copyToBin(pMem
);
284 void StringAttributeMapBase::copyFromBin(BinaryDataHandler
&pMem
,
285 ConstFieldMaskArg whichField
)
287 Inherited::copyFromBin(pMem
, whichField
);
289 if(FieldBits::NoField
!= (KeysFieldMask
& whichField
))
291 editMField(KeysFieldMask
, _mfKeys
);
292 _mfKeys
.copyFromBin(pMem
);
294 if(FieldBits::NoField
!= (ValuesFieldMask
& whichField
))
296 editMField(ValuesFieldMask
, _mfValues
);
297 _mfValues
.copyFromBin(pMem
);
301 //! create a new instance of the class
302 StringAttributeMapTransitPtr
StringAttributeMapBase::createLocal(BitVector bFlags
)
304 StringAttributeMapTransitPtr fc
;
306 if(getClassType().getPrototype() != NULL
)
308 FieldContainerTransitPtr tmpPtr
=
309 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
311 fc
= dynamic_pointer_cast
<StringAttributeMap
>(tmpPtr
);
317 //! create a new instance of the class, copy the container flags
318 StringAttributeMapTransitPtr
StringAttributeMapBase::createDependent(BitVector bFlags
)
320 StringAttributeMapTransitPtr fc
;
322 if(getClassType().getPrototype() != NULL
)
324 FieldContainerTransitPtr tmpPtr
=
325 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
327 fc
= dynamic_pointer_cast
<StringAttributeMap
>(tmpPtr
);
333 //! create a new instance of the class
334 StringAttributeMapTransitPtr
StringAttributeMapBase::create(void)
336 StringAttributeMapTransitPtr fc
;
338 if(getClassType().getPrototype() != NULL
)
340 FieldContainerTransitPtr tmpPtr
=
341 getClassType().getPrototype()-> shallowCopy();
343 fc
= dynamic_pointer_cast
<StringAttributeMap
>(tmpPtr
);
349 StringAttributeMap
*StringAttributeMapBase::createEmptyLocal(BitVector bFlags
)
351 StringAttributeMap
*returnValue
;
353 newPtr
<StringAttributeMap
>(returnValue
, bFlags
);
355 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
360 //! create an empty new instance of the class, do not copy the prototype
361 StringAttributeMap
*StringAttributeMapBase::createEmpty(void)
363 StringAttributeMap
*returnValue
;
365 newPtr
<StringAttributeMap
>(returnValue
, Thread::getCurrentLocalFlags());
367 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
368 ~Thread::getCurrentLocalFlags();
374 FieldContainerTransitPtr
StringAttributeMapBase::shallowCopyLocal(
375 BitVector bFlags
) const
377 StringAttributeMap
*tmpPtr
;
379 newPtr(tmpPtr
, dynamic_cast<const StringAttributeMap
*>(this), bFlags
);
381 FieldContainerTransitPtr
returnValue(tmpPtr
);
383 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
388 FieldContainerTransitPtr
StringAttributeMapBase::shallowCopyDependent(
389 BitVector bFlags
) const
391 StringAttributeMap
*tmpPtr
;
393 newPtr(tmpPtr
, dynamic_cast<const StringAttributeMap
*>(this), ~bFlags
);
395 FieldContainerTransitPtr
returnValue(tmpPtr
);
397 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
402 FieldContainerTransitPtr
StringAttributeMapBase::shallowCopy(void) const
404 StringAttributeMap
*tmpPtr
;
407 dynamic_cast<const StringAttributeMap
*>(this),
408 Thread::getCurrentLocalFlags());
410 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
412 FieldContainerTransitPtr
returnValue(tmpPtr
);
420 /*------------------------- constructors ----------------------------------*/
422 StringAttributeMapBase::StringAttributeMapBase(void) :
429 StringAttributeMapBase::StringAttributeMapBase(const StringAttributeMapBase
&source
) :
431 _mfKeys (source
._mfKeys
),
432 _mfValues (source
._mfValues
)
437 /*-------------------------- destructors ----------------------------------*/
439 StringAttributeMapBase::~StringAttributeMapBase(void)
444 GetFieldHandlePtr
StringAttributeMapBase::getHandleKeys (void) const
446 MFString::GetHandlePtr
returnValue(
447 new MFString::GetHandle(
449 this->getType().getFieldDesc(KeysFieldId
),
450 const_cast<StringAttributeMapBase
*>(this)));
455 EditFieldHandlePtr
StringAttributeMapBase::editHandleKeys (void)
457 MFString::EditHandlePtr
returnValue(
458 new MFString::EditHandle(
460 this->getType().getFieldDesc(KeysFieldId
),
464 editMField(KeysFieldMask
, _mfKeys
);
469 GetFieldHandlePtr
StringAttributeMapBase::getHandleValues (void) const
471 MFString::GetHandlePtr
returnValue(
472 new MFString::GetHandle(
474 this->getType().getFieldDesc(ValuesFieldId
),
475 const_cast<StringAttributeMapBase
*>(this)));
480 EditFieldHandlePtr
StringAttributeMapBase::editHandleValues (void)
482 MFString::EditHandlePtr
returnValue(
483 new MFString::EditHandle(
485 this->getType().getFieldDesc(ValuesFieldId
),
489 editMField(ValuesFieldMask
, _mfValues
);
495 #ifdef OSG_MT_CPTR_ASPECT
496 void StringAttributeMapBase::execSyncV( FieldContainer
&oFrom
,
497 ConstFieldMaskArg whichField
,
498 AspectOffsetStore
&oOffsets
,
499 ConstFieldMaskArg syncMode
,
500 const UInt32 uiSyncInfo
)
502 StringAttributeMap
*pThis
= static_cast<StringAttributeMap
*>(this);
504 pThis
->execSync(static_cast<StringAttributeMap
*>(&oFrom
),
513 #ifdef OSG_MT_CPTR_ASPECT
514 FieldContainer
*StringAttributeMapBase::createAspectCopy(
515 const FieldContainer
*pRefAspect
) const
517 StringAttributeMap
*returnValue
;
519 newAspectCopy(returnValue
,
520 dynamic_cast<const StringAttributeMap
*>(pRefAspect
),
521 dynamic_cast<const StringAttributeMap
*>(this));
527 void StringAttributeMapBase::resolveLinks(void)
529 Inherited::resolveLinks();
531 #ifdef OSG_MT_CPTR_ASPECT
532 AspectOffsetStore oOffsets
;
534 _pAspectStore
->fillOffsetArray(oOffsets
, this);
537 #ifdef OSG_MT_CPTR_ASPECT
538 _mfKeys
.terminateShare(Thread::getCurrentAspect(),
541 #ifdef OSG_MT_CPTR_ASPECT
542 _mfValues
.terminateShare(Thread::getCurrentAspect(),