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 ShaderVariableMInt!
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 "OSGShaderVariableMIntBase.h"
67 #include "OSGShaderVariableMInt.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ShaderVariableMInt
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Int32 ShaderVariableMIntBase::_mfValue
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits
<ShaderVariableMInt
*, nsOSG
>::_type(
96 "ShaderVariableMIntPtr",
97 "ShaderValueVariablePtr",
98 ShaderVariableMInt::getClassType(),
102 OSG_FIELDTRAITS_GETTYPE_NS(ShaderVariableMInt
*, nsOSG
)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
105 ShaderVariableMInt
*,
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
109 ShaderVariableMInt
*,
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void ShaderVariableMIntBase::classDescInserter(TypeObject
&oType
)
118 FieldDescriptionBase
*pDesc
= NULL
;
121 pDesc
= new MFInt32::Description(
122 MFInt32::getClassType(),
125 ValueFieldId
, ValueFieldMask
,
127 (Field::MFDefaultFlags
| Field::FStdAccess
),
128 static_cast<FieldEditMethodSig
>(&ShaderVariableMInt::editHandleValue
),
129 static_cast<FieldGetMethodSig
>(&ShaderVariableMInt::getHandleValue
));
131 oType
.addInitialDesc(pDesc
);
135 ShaderVariableMIntBase::TypeObject
ShaderVariableMIntBase::_type(
136 ShaderVariableMIntBase::getClassname(),
137 Inherited::getClassname(),
140 reinterpret_cast<PrototypeCreateF
>(&ShaderVariableMIntBase::createEmptyLocal
),
141 reinterpret_cast<InitContainerF
>(&ShaderVariableMInt::initMethod
),
142 reinterpret_cast<ExitContainerF
>(&ShaderVariableMInt::exitMethod
),
143 reinterpret_cast<InitalInsertDescFunc
>(
144 reinterpret_cast<void *>(&ShaderVariableMInt::classDescInserter
)),
147 "<?xml version=\"1.0\"?>\n"
150 " name=\"ShaderVariableMInt\"\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"
162 "\t name=\"value\"\n"
163 "\t type=\"Int32\"\n"
164 "\t cardinality=\"multi\"\n"
165 "\t visibility=\"external\"\n"
166 "\t access=\"public\"\n"
170 "</FieldContainer>\n",
174 /*------------------------------ get -----------------------------------*/
176 FieldContainerType
&ShaderVariableMIntBase::getType(void)
181 const FieldContainerType
&ShaderVariableMIntBase::getType(void) const
186 UInt32
ShaderVariableMIntBase::getContainerSize(void) const
188 return sizeof(ShaderVariableMInt
);
191 /*------------------------- decorator get ------------------------------*/
194 MFInt32
*ShaderVariableMIntBase::editMFValue(void)
196 editMField(ValueFieldMask
, _mfValue
);
201 const MFInt32
*ShaderVariableMIntBase::getMFValue(void) const
211 /*------------------------------ access -----------------------------------*/
213 SizeT
ShaderVariableMIntBase::getBinSize(ConstFieldMaskArg whichField
)
215 SizeT returnValue
= Inherited::getBinSize(whichField
);
217 if(FieldBits::NoField
!= (ValueFieldMask
& whichField
))
219 returnValue
+= _mfValue
.getBinSize();
225 void ShaderVariableMIntBase::copyToBin(BinaryDataHandler
&pMem
,
226 ConstFieldMaskArg whichField
)
228 Inherited::copyToBin(pMem
, whichField
);
230 if(FieldBits::NoField
!= (ValueFieldMask
& whichField
))
232 _mfValue
.copyToBin(pMem
);
236 void ShaderVariableMIntBase::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 ShaderVariableMIntTransitPtr
ShaderVariableMIntBase::createLocal(BitVector bFlags
)
251 ShaderVariableMIntTransitPtr fc
;
253 if(getClassType().getPrototype() != NULL
)
255 FieldContainerTransitPtr tmpPtr
=
256 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
258 fc
= dynamic_pointer_cast
<ShaderVariableMInt
>(tmpPtr
);
264 //! create a new instance of the class, copy the container flags
265 ShaderVariableMIntTransitPtr
ShaderVariableMIntBase::createDependent(BitVector bFlags
)
267 ShaderVariableMIntTransitPtr fc
;
269 if(getClassType().getPrototype() != NULL
)
271 FieldContainerTransitPtr tmpPtr
=
272 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
274 fc
= dynamic_pointer_cast
<ShaderVariableMInt
>(tmpPtr
);
280 //! create a new instance of the class
281 ShaderVariableMIntTransitPtr
ShaderVariableMIntBase::create(void)
283 ShaderVariableMIntTransitPtr fc
;
285 if(getClassType().getPrototype() != NULL
)
287 FieldContainerTransitPtr tmpPtr
=
288 getClassType().getPrototype()-> shallowCopy();
290 fc
= dynamic_pointer_cast
<ShaderVariableMInt
>(tmpPtr
);
296 ShaderVariableMInt
*ShaderVariableMIntBase::createEmptyLocal(BitVector bFlags
)
298 ShaderVariableMInt
*returnValue
;
300 newPtr
<ShaderVariableMInt
>(returnValue
, bFlags
);
302 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
307 //! create an empty new instance of the class, do not copy the prototype
308 ShaderVariableMInt
*ShaderVariableMIntBase::createEmpty(void)
310 ShaderVariableMInt
*returnValue
;
312 newPtr
<ShaderVariableMInt
>(returnValue
, Thread::getCurrentLocalFlags());
314 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
315 ~Thread::getCurrentLocalFlags();
321 FieldContainerTransitPtr
ShaderVariableMIntBase::shallowCopyLocal(
322 BitVector bFlags
) const
324 ShaderVariableMInt
*tmpPtr
;
326 newPtr(tmpPtr
, dynamic_cast<const ShaderVariableMInt
*>(this), bFlags
);
328 FieldContainerTransitPtr
returnValue(tmpPtr
);
330 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
335 FieldContainerTransitPtr
ShaderVariableMIntBase::shallowCopyDependent(
336 BitVector bFlags
) const
338 ShaderVariableMInt
*tmpPtr
;
340 newPtr(tmpPtr
, dynamic_cast<const ShaderVariableMInt
*>(this), ~bFlags
);
342 FieldContainerTransitPtr
returnValue(tmpPtr
);
344 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
349 FieldContainerTransitPtr
ShaderVariableMIntBase::shallowCopy(void) const
351 ShaderVariableMInt
*tmpPtr
;
354 dynamic_cast<const ShaderVariableMInt
*>(this),
355 Thread::getCurrentLocalFlags());
357 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
359 FieldContainerTransitPtr
returnValue(tmpPtr
);
367 /*------------------------- constructors ----------------------------------*/
369 ShaderVariableMIntBase::ShaderVariableMIntBase(void) :
375 ShaderVariableMIntBase::ShaderVariableMIntBase(const ShaderVariableMIntBase
&source
) :
377 _mfValue (source
._mfValue
)
382 /*-------------------------- destructors ----------------------------------*/
384 ShaderVariableMIntBase::~ShaderVariableMIntBase(void)
389 GetFieldHandlePtr
ShaderVariableMIntBase::getHandleValue (void) const
391 MFInt32::GetHandlePtr
returnValue(
392 new MFInt32::GetHandle(
394 this->getType().getFieldDesc(ValueFieldId
),
395 const_cast<ShaderVariableMIntBase
*>(this)));
400 EditFieldHandlePtr
ShaderVariableMIntBase::editHandleValue (void)
402 MFInt32::EditHandlePtr
returnValue(
403 new MFInt32::EditHandle(
405 this->getType().getFieldDesc(ValueFieldId
),
409 editMField(ValueFieldMask
, _mfValue
);
415 #ifdef OSG_MT_CPTR_ASPECT
416 void ShaderVariableMIntBase::execSyncV( FieldContainer
&oFrom
,
417 ConstFieldMaskArg whichField
,
418 AspectOffsetStore
&oOffsets
,
419 ConstFieldMaskArg syncMode
,
420 const UInt32 uiSyncInfo
)
422 ShaderVariableMInt
*pThis
= static_cast<ShaderVariableMInt
*>(this);
424 pThis
->execSync(static_cast<ShaderVariableMInt
*>(&oFrom
),
433 #ifdef OSG_MT_CPTR_ASPECT
434 FieldContainer
*ShaderVariableMIntBase::createAspectCopy(
435 const FieldContainer
*pRefAspect
) const
437 ShaderVariableMInt
*returnValue
;
439 newAspectCopy(returnValue
,
440 dynamic_cast<const ShaderVariableMInt
*>(pRefAspect
),
441 dynamic_cast<const ShaderVariableMInt
*>(this));
447 void ShaderVariableMIntBase::resolveLinks(void)
449 Inherited::resolveLinks();
451 #ifdef OSG_MT_CPTR_ASPECT
452 AspectOffsetStore oOffsets
;
454 _pAspectStore
->fillOffsetArray(oOffsets
, this);
457 #ifdef OSG_MT_CPTR_ASPECT
458 _mfValue
.terminateShare(Thread::getCurrentAspect(),