changed: gcc8 base update
[opensg.git] / Source / System / FieldContainer / Attachments / OSGStringAttributeMapBase.cpp
blob43a47b42bb9d594f92cebb741ca7c3279fc714f7
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 StringAttributeMap!
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"
66 #include "OSGStringAttributeMapBase.h"
67 #include "OSGStringAttributeMap.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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",
103 "AttachmentPtr",
104 StringAttributeMap::getClassType(),
105 nsOSG);
106 #endif
108 OSG_FIELDTRAITS_GETTYPE_NS(StringAttributeMap *, nsOSG)
110 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
111 StringAttributeMap *,
112 nsOSG)
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void StringAttributeMapBase::classDescInserter(TypeObject &oType)
121 FieldDescriptionBase *pDesc = NULL;
124 pDesc = new MFString::Description(
125 MFString::getClassType(),
126 "keys",
128 KeysFieldId, KeysFieldMask,
129 false,
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(),
138 "values",
140 ValuesFieldId, ValuesFieldMask,
141 false,
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",
154 nsOSG, //Namespace
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)),
160 false,
162 "<?xml version=\"1.0\"?>\n"
163 "\n"
164 "<FieldContainer\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"
175 " >\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"
179 " <Field\n"
180 "\t name=\"keys\"\n"
181 "\t type=\"std::string\"\n"
182 "\t cardinality=\"multi\"\n"
183 "\t visibility=\"external\"\n"
184 "\t access=\"protected\"\n"
185 "\t >\n"
186 " </Field>\n"
187 " <Field\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"
193 "\t >\n"
194 " </Field>\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)
205 return _type;
208 const FieldContainerType &StringAttributeMapBase::getType(void) const
210 return _type;
213 UInt32 StringAttributeMapBase::getContainerSize(void) const
215 return sizeof(StringAttributeMap);
218 /*------------------------- decorator get ------------------------------*/
221 MFString *StringAttributeMapBase::editMFKeys(void)
223 editMField(KeysFieldMask, _mfKeys);
225 return &_mfKeys;
228 const MFString *StringAttributeMapBase::getMFKeys(void) const
230 return &_mfKeys;
234 MFString *StringAttributeMapBase::editMFValues(void)
236 editMField(ValuesFieldMask, _mfValues);
238 return &_mfValues;
241 const MFString *StringAttributeMapBase::getMFValues(void) const
243 return &_mfValues;
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();
266 return returnValue;
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);
314 return fc;
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);
330 return fc;
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);
346 return fc;
349 StringAttributeMap *StringAttributeMapBase::createEmptyLocal(BitVector bFlags)
351 StringAttributeMap *returnValue;
353 newPtr<StringAttributeMap>(returnValue, bFlags);
355 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
357 return returnValue;
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();
370 return returnValue;
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;
385 return returnValue;
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;
399 return returnValue;
402 FieldContainerTransitPtr StringAttributeMapBase::shallowCopy(void) const
404 StringAttributeMap *tmpPtr;
406 newPtr(tmpPtr,
407 dynamic_cast<const StringAttributeMap *>(this),
408 Thread::getCurrentLocalFlags());
410 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
412 FieldContainerTransitPtr returnValue(tmpPtr);
414 return returnValue;
420 /*------------------------- constructors ----------------------------------*/
422 StringAttributeMapBase::StringAttributeMapBase(void) :
423 Inherited(),
424 _mfKeys (),
425 _mfValues ()
429 StringAttributeMapBase::StringAttributeMapBase(const StringAttributeMapBase &source) :
430 Inherited(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(
448 &_mfKeys,
449 this->getType().getFieldDesc(KeysFieldId),
450 const_cast<StringAttributeMapBase *>(this)));
452 return returnValue;
455 EditFieldHandlePtr StringAttributeMapBase::editHandleKeys (void)
457 MFString::EditHandlePtr returnValue(
458 new MFString::EditHandle(
459 &_mfKeys,
460 this->getType().getFieldDesc(KeysFieldId),
461 this));
464 editMField(KeysFieldMask, _mfKeys);
466 return returnValue;
469 GetFieldHandlePtr StringAttributeMapBase::getHandleValues (void) const
471 MFString::GetHandlePtr returnValue(
472 new MFString::GetHandle(
473 &_mfValues,
474 this->getType().getFieldDesc(ValuesFieldId),
475 const_cast<StringAttributeMapBase *>(this)));
477 return returnValue;
480 EditFieldHandlePtr StringAttributeMapBase::editHandleValues (void)
482 MFString::EditHandlePtr returnValue(
483 new MFString::EditHandle(
484 &_mfValues,
485 this->getType().getFieldDesc(ValuesFieldId),
486 this));
489 editMField(ValuesFieldMask, _mfValues);
491 return returnValue;
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),
505 whichField,
506 oOffsets,
507 syncMode,
508 uiSyncInfo);
510 #endif
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));
523 return returnValue;
525 #endif
527 void StringAttributeMapBase::resolveLinks(void)
529 Inherited::resolveLinks();
531 #ifdef OSG_MT_CPTR_ASPECT
532 AspectOffsetStore oOffsets;
534 _pAspectStore->fillOffsetArray(oOffsets, this);
535 #endif
537 #ifdef OSG_MT_CPTR_ASPECT
538 _mfKeys.terminateShare(Thread::getCurrentAspect(),
539 oOffsets);
540 #endif
541 #ifdef OSG_MT_CPTR_ASPECT
542 _mfValues.terminateShare(Thread::getCurrentAspect(),
543 oOffsets);
544 #endif
548 OSG_END_NAMESPACE