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 ShaderValueVariable!
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"
65 #include "OSGFieldContainer.h" // Parents Class
67 #include "OSGShaderValueVariableBase.h"
68 #include "OSGShaderValueVariable.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::ShaderValueVariable
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var UInt16 ShaderValueVariableBase::_mfVariableIdx
90 /*! \var FieldContainer * ShaderValueVariableBase::_mfParents
94 /*! \var UInt16 ShaderValueVariableBase::_mfExeVariableIdx
98 /*! \var FieldContainer * ShaderValueVariableBase::_mfExeParents
103 /***************************************************************************\
104 * FieldType/FieldTrait Instantiation *
105 \***************************************************************************/
107 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
108 PointerType FieldTraits
<ShaderValueVariable
*, nsOSG
>::_type(
109 "ShaderValueVariablePtr",
111 ShaderValueVariable::getClassType(),
115 OSG_FIELDTRAITS_GETTYPE_NS(ShaderValueVariable
*, nsOSG
)
117 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
118 ShaderValueVariable
*,
121 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
122 ShaderValueVariable
*,
125 /***************************************************************************\
126 * Field Description *
127 \***************************************************************************/
129 void ShaderValueVariableBase::classDescInserter(TypeObject
&oType
)
131 FieldDescriptionBase
*pDesc
= NULL
;
134 pDesc
= new MFUInt16::Description(
135 MFUInt16::getClassType(),
138 VariableIdxFieldId
, VariableIdxFieldMask
,
140 (Field::MFDefaultFlags
| Field::FStdAccess
),
141 static_cast <FieldEditMethodSig
>(&ShaderValueVariable::invalidEditField
),
142 static_cast <FieldGetMethodSig
>(&ShaderValueVariable::invalidGetField
));
144 oType
.addInitialDesc(pDesc
);
146 pDesc
= new MFParentFieldContainerPtr::Description(
147 MFParentFieldContainerPtr::getClassType(),
150 ParentsFieldId
, ParentsFieldMask
,
153 static_cast <FieldEditMethodSig
>(&ShaderValueVariable::invalidEditField
),
154 static_cast <FieldGetMethodSig
>(&ShaderValueVariable::invalidGetField
));
156 oType
.addInitialDesc(pDesc
);
158 pDesc
= new MFUInt16::Description(
159 MFUInt16::getClassType(),
162 ExeVariableIdxFieldId
, ExeVariableIdxFieldMask
,
164 (Field::FClusterLocal
),
165 static_cast <FieldEditMethodSig
>(&ShaderValueVariable::invalidEditField
),
166 static_cast <FieldGetMethodSig
>(&ShaderValueVariable::invalidGetField
));
168 oType
.addInitialDesc(pDesc
);
170 pDesc
= new MFParentFieldContainerPtr::Description(
171 MFParentFieldContainerPtr::getClassType(),
174 ExeParentsFieldId
, ExeParentsFieldMask
,
176 (Field::FStdAccess
| Field::FClusterLocal
),
177 static_cast <FieldEditMethodSig
>(&ShaderValueVariable::invalidEditField
),
178 static_cast <FieldGetMethodSig
>(&ShaderValueVariable::invalidGetField
));
180 oType
.addInitialDesc(pDesc
);
184 ShaderValueVariableBase::TypeObject
ShaderValueVariableBase::_type(
185 ShaderValueVariableBase::getClassname(),
186 Inherited::getClassname(),
190 reinterpret_cast<InitContainerF
>(&ShaderValueVariable::initMethod
),
191 reinterpret_cast<ExitContainerF
>(&ShaderValueVariable::exitMethod
),
192 reinterpret_cast<InitalInsertDescFunc
>(
193 reinterpret_cast<void *>(&ShaderValueVariable::classDescInserter
)),
196 "<?xml version=\"1.0\"?>\n"
199 " name=\"ShaderValueVariable\"\n"
200 " parent=\"ShaderVariable\"\n"
201 " library=\"System\"\n"
202 " pointerfieldtypes=\"both\"\n"
203 " structure=\"abstract\"\n"
204 " systemcomponent=\"true\"\n"
205 " parentsystemcomponent=\"true\"\n"
206 " decoratable=\"false\"\n"
207 " useLocalIncludes=\"false\"\n"
208 " docGroupBase=\"GrpSystemShader\"\n"
211 " name=\"variableIdx\"\n"
213 " cardinality=\"multi\"\n"
214 " visibility=\"internal\"\n"
219 " name=\"parents\"\n"
220 " type=\"FieldContainer\"\n"
221 " cardinality=\"multi\"\n"
222 " visibility=\"internal\"\n"
224 " category=\"parentpointer\"\n"
225 " fieldFlags=\"FStdAccess\"\n"
231 " name=\"exeVariableIdx\"\n"
233 " cardinality=\"multi\"\n"
234 " visibility=\"internal\"\n"
236 " fieldFlags=\"FClusterLocal\"\n"
240 " name=\"exeParents\"\n"
241 " type=\"FieldContainer\"\n"
242 " cardinality=\"multi\"\n"
243 " visibility=\"internal\"\n"
245 " category=\"parentpointer\"\n"
246 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
249 "<!--- fieldFlags=\"FStdAccess, FClusterLocal\" -->\n"
250 "</FieldContainer>\n",
254 /*------------------------------ get -----------------------------------*/
256 FieldContainerType
&ShaderValueVariableBase::getType(void)
261 const FieldContainerType
&ShaderValueVariableBase::getType(void) const
266 UInt32
ShaderValueVariableBase::getContainerSize(void) const
268 return sizeof(ShaderValueVariable
);
271 /*------------------------- decorator get ------------------------------*/
282 /*------------------------------ access -----------------------------------*/
284 SizeT
ShaderValueVariableBase::getBinSize(ConstFieldMaskArg whichField
)
286 SizeT returnValue
= Inherited::getBinSize(whichField
);
288 if(FieldBits::NoField
!= (VariableIdxFieldMask
& whichField
))
290 returnValue
+= _mfVariableIdx
.getBinSize();
292 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
294 returnValue
+= _mfParents
.getBinSize();
296 if(FieldBits::NoField
!= (ExeVariableIdxFieldMask
& whichField
))
298 returnValue
+= _mfExeVariableIdx
.getBinSize();
300 if(FieldBits::NoField
!= (ExeParentsFieldMask
& whichField
))
302 returnValue
+= _mfExeParents
.getBinSize();
308 void ShaderValueVariableBase::copyToBin(BinaryDataHandler
&pMem
,
309 ConstFieldMaskArg whichField
)
311 Inherited::copyToBin(pMem
, whichField
);
313 if(FieldBits::NoField
!= (VariableIdxFieldMask
& whichField
))
315 _mfVariableIdx
.copyToBin(pMem
);
317 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
319 _mfParents
.copyToBin(pMem
);
321 if(FieldBits::NoField
!= (ExeVariableIdxFieldMask
& whichField
))
323 _mfExeVariableIdx
.copyToBin(pMem
);
325 if(FieldBits::NoField
!= (ExeParentsFieldMask
& whichField
))
327 _mfExeParents
.copyToBin(pMem
);
331 void ShaderValueVariableBase::copyFromBin(BinaryDataHandler
&pMem
,
332 ConstFieldMaskArg whichField
)
334 Inherited::copyFromBin(pMem
, whichField
);
336 if(FieldBits::NoField
!= (VariableIdxFieldMask
& whichField
))
338 editMField(VariableIdxFieldMask
, _mfVariableIdx
);
339 _mfVariableIdx
.copyFromBin(pMem
);
341 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
343 editMField(ParentsFieldMask
, _mfParents
);
344 _mfParents
.copyFromBin(pMem
);
346 if(FieldBits::NoField
!= (ExeVariableIdxFieldMask
& whichField
))
348 editMField(ExeVariableIdxFieldMask
, _mfExeVariableIdx
);
349 _mfExeVariableIdx
.copyFromBin(pMem
);
351 if(FieldBits::NoField
!= (ExeParentsFieldMask
& whichField
))
353 editMField(ExeParentsFieldMask
, _mfExeParents
);
354 _mfExeParents
.copyFromBin(pMem
);
361 /*------------------------- constructors ----------------------------------*/
363 ShaderValueVariableBase::ShaderValueVariableBase(void) :
367 _mfExeVariableIdx (),
372 ShaderValueVariableBase::ShaderValueVariableBase(const ShaderValueVariableBase
&source
) :
374 _mfVariableIdx (source
._mfVariableIdx
),
376 _mfExeVariableIdx (source
._mfExeVariableIdx
),
382 /*-------------------------- destructors ----------------------------------*/
384 ShaderValueVariableBase::~ShaderValueVariableBase(void)
387 /*-------------------------------------------------------------------------*/
390 bool ShaderValueVariableBase::linkParent(
391 FieldContainer
* const pParent
,
392 UInt16
const childFieldId
,
393 UInt16
const parentFieldId
)
395 if(parentFieldId
== ParentsFieldId
)
397 FieldContainer
* pTypedParent
=
398 dynamic_cast< FieldContainer
* >(pParent
);
400 if(pTypedParent
!= NULL
)
402 editMField(ParentsFieldMask
, _mfParents
);
404 _mfParents
.push_back(pTypedParent
, childFieldId
);
412 if(parentFieldId
== ExeParentsFieldId
)
414 FieldContainer
* pTypedParent
=
415 dynamic_cast< FieldContainer
* >(pParent
);
417 if(pTypedParent
!= NULL
)
419 editMField(ExeParentsFieldMask
, _mfExeParents
);
421 _mfExeParents
.push_back(pTypedParent
, childFieldId
);
429 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
432 bool ShaderValueVariableBase::unlinkParent(
433 FieldContainer
* const pParent
,
434 UInt16
const parentFieldId
)
436 if(parentFieldId
== ParentsFieldId
)
438 FieldContainer
* pTypedParent
=
439 dynamic_cast< FieldContainer
* >(pParent
);
441 if(pTypedParent
!= NULL
)
443 Int32 iParentIdx
= _mfParents
.findIndex(pTypedParent
);
447 editMField(ParentsFieldMask
, _mfParents
);
449 _mfParents
.erase(iParentIdx
);
454 SWARNING
<< "Child ([" << this
455 << "] id [" << this->getId()
456 << "] type [" << this->getType().getCName()
457 << "] parentFieldId [" << parentFieldId
458 << "]) - Parent ([" << pParent
459 << "] id [" << pParent
->getId()
460 << "] type [" << pParent
->getType().getCName()
461 << "]): link inconsistent!"
470 if(parentFieldId
== ExeParentsFieldId
)
472 FieldContainer
* pTypedParent
=
473 dynamic_cast< FieldContainer
* >(pParent
);
475 if(pTypedParent
!= NULL
)
477 Int32 iParentIdx
= _mfExeParents
.findIndex(pTypedParent
);
481 editMField(ExeParentsFieldMask
, _mfExeParents
);
483 _mfExeParents
.erase(iParentIdx
);
488 SWARNING
<< "Child ([" << this
489 << "] id [" << this->getId()
490 << "] type [" << this->getType().getCName()
491 << "] parentFieldId [" << parentFieldId
492 << "]) - Parent ([" << pParent
493 << "] id [" << pParent
->getId()
494 << "] type [" << pParent
->getType().getCName()
495 << "]): link inconsistent!"
504 return Inherited::unlinkParent(pParent
, parentFieldId
);
509 GetFieldHandlePtr
ShaderValueVariableBase::getHandleVariableIdx (void) const
511 MFUInt16::GetHandlePtr returnValue
;
516 EditFieldHandlePtr
ShaderValueVariableBase::editHandleVariableIdx (void)
518 EditFieldHandlePtr returnValue
;
523 GetFieldHandlePtr
ShaderValueVariableBase::getHandleParents (void) const
525 MFParentFieldContainerPtr::GetHandlePtr returnValue
;
530 EditFieldHandlePtr
ShaderValueVariableBase::editHandleParents (void)
532 EditFieldHandlePtr returnValue
;
537 GetFieldHandlePtr
ShaderValueVariableBase::getHandleExeVariableIdx (void) const
539 MFUInt16::GetHandlePtr returnValue
;
544 EditFieldHandlePtr
ShaderValueVariableBase::editHandleExeVariableIdx (void)
546 EditFieldHandlePtr returnValue
;
551 GetFieldHandlePtr
ShaderValueVariableBase::getHandleExeParents (void) const
553 MFParentFieldContainerPtr::GetHandlePtr returnValue
;
558 EditFieldHandlePtr
ShaderValueVariableBase::editHandleExeParents (void)
560 EditFieldHandlePtr returnValue
;
566 #ifdef OSG_MT_CPTR_ASPECT
567 void ShaderValueVariableBase::execSyncV( FieldContainer
&oFrom
,
568 ConstFieldMaskArg whichField
,
569 AspectOffsetStore
&oOffsets
,
570 ConstFieldMaskArg syncMode
,
571 const UInt32 uiSyncInfo
)
573 ShaderValueVariable
*pThis
= static_cast<ShaderValueVariable
*>(this);
575 pThis
->execSync(static_cast<ShaderValueVariable
*>(&oFrom
),
585 void ShaderValueVariableBase::resolveLinks(void)
587 Inherited::resolveLinks();
589 #ifdef OSG_MT_CPTR_ASPECT
590 AspectOffsetStore oOffsets
;
592 _pAspectStore
->fillOffsetArray(oOffsets
, this);
595 #ifdef OSG_MT_CPTR_ASPECT
596 _mfVariableIdx
.terminateShare(Thread::getCurrentAspect(),
599 #ifdef OSG_MT_CPTR_ASPECT
600 _mfExeVariableIdx
.terminateShare(Thread::getCurrentAspect(),