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 ShaderProcVariable!
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 "OSGShaderProcVariableBase.h"
68 #include "OSGShaderProcVariable.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::ShaderProcVariable
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var UInt32 ShaderProcVariableBase::_sfDependency
90 /*! \var FieldContainer * ShaderProcVariableBase::_mfParents
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits
<ShaderProcVariable
*, nsOSG
>::_type(
101 "ShaderProcVariablePtr",
103 ShaderProcVariable::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(ShaderProcVariable
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 ShaderProcVariable
*,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
114 ShaderProcVariable
*,
117 DataType
&FieldTraits
< ShaderProcVariable
*, nsOSG
+ 1 >::getType(void)
119 return FieldTraits
<ShaderProcVariable
*, nsOSG
>::getType();
123 OSG_EXPORT_PTR_MFIELD(ChildPointerMField
,
124 ShaderProcVariable
*,
125 UnrecordedRefCountPolicy
,
129 /***************************************************************************\
130 * Field Description *
131 \***************************************************************************/
133 void ShaderProcVariableBase::classDescInserter(TypeObject
&oType
)
135 FieldDescriptionBase
*pDesc
= NULL
;
138 pDesc
= new SFUInt32::Description(
139 SFUInt32::getClassType(),
142 DependencyFieldId
, DependencyFieldMask
,
144 (Field::SFDefaultFlags
| Field::FStdAccess
),
145 static_cast<FieldEditMethodSig
>(&ShaderProcVariable::editHandleDependency
),
146 static_cast<FieldGetMethodSig
>(&ShaderProcVariable::getHandleDependency
));
148 oType
.addInitialDesc(pDesc
);
150 pDesc
= new MFParentFieldContainerPtr::Description(
151 MFParentFieldContainerPtr::getClassType(),
154 ParentsFieldId
, ParentsFieldMask
,
156 (Field::FStdAccess
| Field::FClusterLocal
),
157 static_cast <FieldEditMethodSig
>(&ShaderProcVariable::invalidEditField
),
158 static_cast <FieldGetMethodSig
>(&ShaderProcVariable::invalidGetField
));
160 oType
.addInitialDesc(pDesc
);
164 ShaderProcVariableBase::TypeObject
ShaderProcVariableBase::_type(
165 ShaderProcVariableBase::getClassname(),
166 Inherited::getClassname(),
170 reinterpret_cast<InitContainerF
>(&ShaderProcVariable::initMethod
),
171 reinterpret_cast<ExitContainerF
>(&ShaderProcVariable::exitMethod
),
172 reinterpret_cast<InitalInsertDescFunc
>(
173 reinterpret_cast<void *>(&ShaderProcVariable::classDescInserter
)),
176 "<?xml version=\"1.0\"?>\n"
179 " name=\"ShaderProcVariable\"\n"
180 " parent=\"ShaderVariable\"\n"
181 " library=\"System\"\n"
182 " pointerfieldtypes=\"both\"\n"
183 " structure=\"abstract\"\n"
184 " systemcomponent=\"true\"\n"
185 " parentsystemcomponent=\"true\"\n"
186 " decoratable=\"false\"\n"
187 " useLocalIncludes=\"false\"\n"
188 " childFields=\"multi\"\n"
189 " docGroupBase=\"GrpSystemShader\"\n"
192 "\t name=\"dependency\"\n"
193 "\t type=\"UInt32\"\n"
194 "\t cardinality=\"single\"\n"
195 "\t visibility=\"external\"\n"
196 "\t access=\"public\"\n"
197 " defaultValue=\"ShaderProcVariable::SHDObject\"\n"
202 " name=\"parents\"\n"
203 " type=\"FieldContainer\"\n"
204 " cardinality=\"multi\"\n"
205 " visibility=\"internal\"\n"
207 " category=\"parentpointer\"\n"
208 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
211 "<!--- fieldFlags=\"FStdAccess, FClusterLocal\" -->\n"
212 "</FieldContainer>\n",
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType
&ShaderProcVariableBase::getType(void)
223 const FieldContainerType
&ShaderProcVariableBase::getType(void) const
228 UInt32
ShaderProcVariableBase::getContainerSize(void) const
230 return sizeof(ShaderProcVariable
);
233 /*------------------------- decorator get ------------------------------*/
236 SFUInt32
*ShaderProcVariableBase::editSFDependency(void)
238 editSField(DependencyFieldMask
);
240 return &_sfDependency
;
243 const SFUInt32
*ShaderProcVariableBase::getSFDependency(void) const
245 return &_sfDependency
;
254 /*------------------------------ access -----------------------------------*/
256 SizeT
ShaderProcVariableBase::getBinSize(ConstFieldMaskArg whichField
)
258 SizeT returnValue
= Inherited::getBinSize(whichField
);
260 if(FieldBits::NoField
!= (DependencyFieldMask
& whichField
))
262 returnValue
+= _sfDependency
.getBinSize();
264 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
266 returnValue
+= _mfParents
.getBinSize();
272 void ShaderProcVariableBase::copyToBin(BinaryDataHandler
&pMem
,
273 ConstFieldMaskArg whichField
)
275 Inherited::copyToBin(pMem
, whichField
);
277 if(FieldBits::NoField
!= (DependencyFieldMask
& whichField
))
279 _sfDependency
.copyToBin(pMem
);
281 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
283 _mfParents
.copyToBin(pMem
);
287 void ShaderProcVariableBase::copyFromBin(BinaryDataHandler
&pMem
,
288 ConstFieldMaskArg whichField
)
290 Inherited::copyFromBin(pMem
, whichField
);
292 if(FieldBits::NoField
!= (DependencyFieldMask
& whichField
))
294 editSField(DependencyFieldMask
);
295 _sfDependency
.copyFromBin(pMem
);
297 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
299 editMField(ParentsFieldMask
, _mfParents
);
300 _mfParents
.copyFromBin(pMem
);
307 /*------------------------- constructors ----------------------------------*/
309 ShaderProcVariableBase::ShaderProcVariableBase(void) :
311 _sfDependency (UInt32(ShaderProcVariable::SHDObject
)),
316 ShaderProcVariableBase::ShaderProcVariableBase(const ShaderProcVariableBase
&source
) :
318 _sfDependency (source
._sfDependency
),
324 /*-------------------------- destructors ----------------------------------*/
326 ShaderProcVariableBase::~ShaderProcVariableBase(void)
329 /*-------------------------------------------------------------------------*/
332 bool ShaderProcVariableBase::linkParent(
333 FieldContainer
* const pParent
,
334 UInt16
const childFieldId
,
335 UInt16
const parentFieldId
)
337 if(parentFieldId
== ParentsFieldId
)
339 FieldContainer
* pTypedParent
=
340 dynamic_cast< FieldContainer
* >(pParent
);
342 if(pTypedParent
!= NULL
)
344 editMField(ParentsFieldMask
, _mfParents
);
346 _mfParents
.push_back(pTypedParent
, childFieldId
);
354 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
357 bool ShaderProcVariableBase::unlinkParent(
358 FieldContainer
* const pParent
,
359 UInt16
const parentFieldId
)
361 if(parentFieldId
== ParentsFieldId
)
363 FieldContainer
* pTypedParent
=
364 dynamic_cast< FieldContainer
* >(pParent
);
366 if(pTypedParent
!= NULL
)
368 Int32 iParentIdx
= _mfParents
.findIndex(pTypedParent
);
372 editMField(ParentsFieldMask
, _mfParents
);
374 _mfParents
.erase(iParentIdx
);
379 SWARNING
<< "Child ([" << this
380 << "] id [" << this->getId()
381 << "] type [" << this->getType().getCName()
382 << "] parentFieldId [" << parentFieldId
383 << "]) - Parent ([" << pParent
384 << "] id [" << pParent
->getId()
385 << "] type [" << pParent
->getType().getCName()
386 << "]): link inconsistent!"
395 return Inherited::unlinkParent(pParent
, parentFieldId
);
400 GetFieldHandlePtr
ShaderProcVariableBase::getHandleDependency (void) const
402 SFUInt32::GetHandlePtr
returnValue(
403 new SFUInt32::GetHandle(
405 this->getType().getFieldDesc(DependencyFieldId
),
406 const_cast<ShaderProcVariableBase
*>(this)));
411 EditFieldHandlePtr
ShaderProcVariableBase::editHandleDependency (void)
413 SFUInt32::EditHandlePtr
returnValue(
414 new SFUInt32::EditHandle(
416 this->getType().getFieldDesc(DependencyFieldId
),
420 editSField(DependencyFieldMask
);
425 GetFieldHandlePtr
ShaderProcVariableBase::getHandleParents (void) const
427 MFParentFieldContainerPtr::GetHandlePtr returnValue
;
432 EditFieldHandlePtr
ShaderProcVariableBase::editHandleParents (void)
434 EditFieldHandlePtr returnValue
;
440 #ifdef OSG_MT_CPTR_ASPECT
441 void ShaderProcVariableBase::execSyncV( FieldContainer
&oFrom
,
442 ConstFieldMaskArg whichField
,
443 AspectOffsetStore
&oOffsets
,
444 ConstFieldMaskArg syncMode
,
445 const UInt32 uiSyncInfo
)
447 ShaderProcVariable
*pThis
= static_cast<ShaderProcVariable
*>(this);
449 pThis
->execSync(static_cast<ShaderProcVariable
*>(&oFrom
),
459 void ShaderProcVariableBase::resolveLinks(void)
461 Inherited::resolveLinks();