fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / Variables / OSGShaderVariableMUIntBase.cpp
blobd53c9158c53bf76568e11058142b0a339f6385bc
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 ShaderVariableMUInt!
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 "OSGShaderVariableMUIntBase.h"
67 #include "OSGShaderVariableMUInt.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ShaderVariableMUInt
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt32 ShaderVariableMUIntBase::_mfValue
86 variable value
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<ShaderVariableMUInt *, nsOSG>::_type(
96 "ShaderVariableMUIntPtr",
97 "ShaderValueVariablePtr",
98 ShaderVariableMUInt::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(ShaderVariableMUInt *, nsOSG)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
105 ShaderVariableMUInt *,
106 nsOSG)
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
109 ShaderVariableMUInt *,
110 nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void ShaderVariableMUIntBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new MFUInt32::Description(
122 MFUInt32::getClassType(),
123 "value",
124 "variable value\n",
125 ValueFieldId, ValueFieldMask,
126 false,
127 (Field::MFDefaultFlags | Field::FStdAccess),
128 static_cast<FieldEditMethodSig>(&ShaderVariableMUInt::editHandleValue),
129 static_cast<FieldGetMethodSig >(&ShaderVariableMUInt::getHandleValue));
131 oType.addInitialDesc(pDesc);
135 ShaderVariableMUIntBase::TypeObject ShaderVariableMUIntBase::_type(
136 ShaderVariableMUIntBase::getClassname(),
137 Inherited::getClassname(),
138 "NULL",
139 nsOSG, //Namespace
140 reinterpret_cast<PrototypeCreateF>(&ShaderVariableMUIntBase::createEmptyLocal),
141 reinterpret_cast<InitContainerF>(&ShaderVariableMUInt::initMethod),
142 reinterpret_cast<ExitContainerF>(&ShaderVariableMUInt::exitMethod),
143 reinterpret_cast<InitalInsertDescFunc>(
144 reinterpret_cast<void *>(&ShaderVariableMUInt::classDescInserter)),
145 false,
147 "<?xml version=\"1.0\"?>\n"
148 "\n"
149 "<FieldContainer\n"
150 " name=\"ShaderVariableMUInt\"\n"
151 " parent=\"ShaderValueVariable\"\n"
152 " library=\"System\"\n"
153 " pointerfieldtypes=\"both\"\n"
154 " structure=\"concrete\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " decoratable=\"false\"\n"
158 " useLocalIncludes=\"false\"\n"
159 " docGroupBase=\"GrpSystemShader\"\n"
160 " >\n"
161 " <Field\n"
162 "\t name=\"value\"\n"
163 "\t type=\"UInt32\"\n"
164 "\t cardinality=\"multi\"\n"
165 "\t visibility=\"external\"\n"
166 "\t access=\"public\"\n"
167 "\t >\n"
168 "\tvariable value\n"
169 " </Field>\n"
170 "</FieldContainer>\n",
174 /*------------------------------ get -----------------------------------*/
176 FieldContainerType &ShaderVariableMUIntBase::getType(void)
178 return _type;
181 const FieldContainerType &ShaderVariableMUIntBase::getType(void) const
183 return _type;
186 UInt32 ShaderVariableMUIntBase::getContainerSize(void) const
188 return sizeof(ShaderVariableMUInt);
191 /*------------------------- decorator get ------------------------------*/
194 MFUInt32 *ShaderVariableMUIntBase::editMFValue(void)
196 editMField(ValueFieldMask, _mfValue);
198 return &_mfValue;
201 const MFUInt32 *ShaderVariableMUIntBase::getMFValue(void) const
203 return &_mfValue;
211 /*------------------------------ access -----------------------------------*/
213 SizeT ShaderVariableMUIntBase::getBinSize(ConstFieldMaskArg whichField)
215 SizeT returnValue = Inherited::getBinSize(whichField);
217 if(FieldBits::NoField != (ValueFieldMask & whichField))
219 returnValue += _mfValue.getBinSize();
222 return returnValue;
225 void ShaderVariableMUIntBase::copyToBin(BinaryDataHandler &pMem,
226 ConstFieldMaskArg whichField)
228 Inherited::copyToBin(pMem, whichField);
230 if(FieldBits::NoField != (ValueFieldMask & whichField))
232 _mfValue.copyToBin(pMem);
236 void ShaderVariableMUIntBase::copyFromBin(BinaryDataHandler &pMem,
237 ConstFieldMaskArg whichField)
239 Inherited::copyFromBin(pMem, whichField);
241 if(FieldBits::NoField != (ValueFieldMask & whichField))
243 editMField(ValueFieldMask, _mfValue);
244 _mfValue.copyFromBin(pMem);
248 //! create a new instance of the class
249 ShaderVariableMUIntTransitPtr ShaderVariableMUIntBase::createLocal(BitVector bFlags)
251 ShaderVariableMUIntTransitPtr fc;
253 if(getClassType().getPrototype() != NULL)
255 FieldContainerTransitPtr tmpPtr =
256 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
258 fc = dynamic_pointer_cast<ShaderVariableMUInt>(tmpPtr);
261 return fc;
264 //! create a new instance of the class, copy the container flags
265 ShaderVariableMUIntTransitPtr ShaderVariableMUIntBase::createDependent(BitVector bFlags)
267 ShaderVariableMUIntTransitPtr fc;
269 if(getClassType().getPrototype() != NULL)
271 FieldContainerTransitPtr tmpPtr =
272 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
274 fc = dynamic_pointer_cast<ShaderVariableMUInt>(tmpPtr);
277 return fc;
280 //! create a new instance of the class
281 ShaderVariableMUIntTransitPtr ShaderVariableMUIntBase::create(void)
283 ShaderVariableMUIntTransitPtr fc;
285 if(getClassType().getPrototype() != NULL)
287 FieldContainerTransitPtr tmpPtr =
288 getClassType().getPrototype()-> shallowCopy();
290 fc = dynamic_pointer_cast<ShaderVariableMUInt>(tmpPtr);
293 return fc;
296 ShaderVariableMUInt *ShaderVariableMUIntBase::createEmptyLocal(BitVector bFlags)
298 ShaderVariableMUInt *returnValue;
300 newPtr<ShaderVariableMUInt>(returnValue, bFlags);
302 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
304 return returnValue;
307 //! create an empty new instance of the class, do not copy the prototype
308 ShaderVariableMUInt *ShaderVariableMUIntBase::createEmpty(void)
310 ShaderVariableMUInt *returnValue;
312 newPtr<ShaderVariableMUInt>(returnValue, Thread::getCurrentLocalFlags());
314 returnValue->_pFieldFlags->_bNamespaceMask &=
315 ~Thread::getCurrentLocalFlags();
317 return returnValue;
321 FieldContainerTransitPtr ShaderVariableMUIntBase::shallowCopyLocal(
322 BitVector bFlags) const
324 ShaderVariableMUInt *tmpPtr;
326 newPtr(tmpPtr, dynamic_cast<const ShaderVariableMUInt *>(this), bFlags);
328 FieldContainerTransitPtr returnValue(tmpPtr);
330 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
332 return returnValue;
335 FieldContainerTransitPtr ShaderVariableMUIntBase::shallowCopyDependent(
336 BitVector bFlags) const
338 ShaderVariableMUInt *tmpPtr;
340 newPtr(tmpPtr, dynamic_cast<const ShaderVariableMUInt *>(this), ~bFlags);
342 FieldContainerTransitPtr returnValue(tmpPtr);
344 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
346 return returnValue;
349 FieldContainerTransitPtr ShaderVariableMUIntBase::shallowCopy(void) const
351 ShaderVariableMUInt *tmpPtr;
353 newPtr(tmpPtr,
354 dynamic_cast<const ShaderVariableMUInt *>(this),
355 Thread::getCurrentLocalFlags());
357 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
359 FieldContainerTransitPtr returnValue(tmpPtr);
361 return returnValue;
367 /*------------------------- constructors ----------------------------------*/
369 ShaderVariableMUIntBase::ShaderVariableMUIntBase(void) :
370 Inherited(),
371 _mfValue ()
375 ShaderVariableMUIntBase::ShaderVariableMUIntBase(const ShaderVariableMUIntBase &source) :
376 Inherited(source),
377 _mfValue (source._mfValue )
382 /*-------------------------- destructors ----------------------------------*/
384 ShaderVariableMUIntBase::~ShaderVariableMUIntBase(void)
389 GetFieldHandlePtr ShaderVariableMUIntBase::getHandleValue (void) const
391 MFUInt32::GetHandlePtr returnValue(
392 new MFUInt32::GetHandle(
393 &_mfValue,
394 this->getType().getFieldDesc(ValueFieldId),
395 const_cast<ShaderVariableMUIntBase *>(this)));
397 return returnValue;
400 EditFieldHandlePtr ShaderVariableMUIntBase::editHandleValue (void)
402 MFUInt32::EditHandlePtr returnValue(
403 new MFUInt32::EditHandle(
404 &_mfValue,
405 this->getType().getFieldDesc(ValueFieldId),
406 this));
409 editMField(ValueFieldMask, _mfValue);
411 return returnValue;
415 #ifdef OSG_MT_CPTR_ASPECT
416 void ShaderVariableMUIntBase::execSyncV( FieldContainer &oFrom,
417 ConstFieldMaskArg whichField,
418 AspectOffsetStore &oOffsets,
419 ConstFieldMaskArg syncMode,
420 const UInt32 uiSyncInfo)
422 ShaderVariableMUInt *pThis = static_cast<ShaderVariableMUInt *>(this);
424 pThis->execSync(static_cast<ShaderVariableMUInt *>(&oFrom),
425 whichField,
426 oOffsets,
427 syncMode,
428 uiSyncInfo);
430 #endif
433 #ifdef OSG_MT_CPTR_ASPECT
434 FieldContainer *ShaderVariableMUIntBase::createAspectCopy(
435 const FieldContainer *pRefAspect) const
437 ShaderVariableMUInt *returnValue;
439 newAspectCopy(returnValue,
440 dynamic_cast<const ShaderVariableMUInt *>(pRefAspect),
441 dynamic_cast<const ShaderVariableMUInt *>(this));
443 return returnValue;
445 #endif
447 void ShaderVariableMUIntBase::resolveLinks(void)
449 Inherited::resolveLinks();
451 #ifdef OSG_MT_CPTR_ASPECT
452 AspectOffsetStore oOffsets;
454 _pAspectStore->fillOffsetArray(oOffsets, this);
455 #endif
457 #ifdef OSG_MT_CPTR_ASPECT
458 _mfValue.terminateShare(Thread::getCurrentAspect(),
459 oOffsets);
460 #endif
464 OSG_END_NAMESPACE