changed: gcc8 base update
[opensg.git] / Source / System / State / Shader / Variables / OSGShaderValueVariableBase.cpp
blob440abef73c01b8aa7e22c16dfdfa827516ef152e
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 ShaderValueVariable!
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"
65 #include "OSGFieldContainer.h" // Parents Class
67 #include "OSGShaderValueVariableBase.h"
68 #include "OSGShaderValueVariable.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
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",
110 "ShaderVariablePtr",
111 ShaderValueVariable::getClassType(),
112 nsOSG);
113 #endif
115 OSG_FIELDTRAITS_GETTYPE_NS(ShaderValueVariable *, nsOSG)
117 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
118 ShaderValueVariable *,
119 nsOSG)
121 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
122 ShaderValueVariable *,
123 nsOSG)
125 /***************************************************************************\
126 * Field Description *
127 \***************************************************************************/
129 void ShaderValueVariableBase::classDescInserter(TypeObject &oType)
131 FieldDescriptionBase *pDesc = NULL;
134 pDesc = new MFUInt16::Description(
135 MFUInt16::getClassType(),
136 "variableIdx",
138 VariableIdxFieldId, VariableIdxFieldMask,
139 true,
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(),
148 "parents",
150 ParentsFieldId, ParentsFieldMask,
151 true,
152 (Field::FStdAccess),
153 static_cast <FieldEditMethodSig>(&ShaderValueVariable::invalidEditField),
154 static_cast <FieldGetMethodSig >(&ShaderValueVariable::invalidGetField));
156 oType.addInitialDesc(pDesc);
158 pDesc = new MFUInt16::Description(
159 MFUInt16::getClassType(),
160 "exeVariableIdx",
162 ExeVariableIdxFieldId, ExeVariableIdxFieldMask,
163 true,
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(),
172 "exeParents",
174 ExeParentsFieldId, ExeParentsFieldMask,
175 true,
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(),
187 "NULL",
188 nsOSG, //Namespace
189 NULL,
190 reinterpret_cast<InitContainerF>(&ShaderValueVariable::initMethod),
191 reinterpret_cast<ExitContainerF>(&ShaderValueVariable::exitMethod),
192 reinterpret_cast<InitalInsertDescFunc>(
193 reinterpret_cast<void *>(&ShaderValueVariable::classDescInserter)),
194 false,
196 "<?xml version=\"1.0\"?>\n"
197 "\n"
198 "<FieldContainer\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"
209 " >\n"
210 " <Field\n"
211 " name=\"variableIdx\"\n"
212 " type=\"UInt16\"\n"
213 " cardinality=\"multi\"\n"
214 " visibility=\"internal\"\n"
215 " access=\"none\"\n"
216 " >\n"
217 " </Field>\n"
218 " <Field\n"
219 " name=\"parents\"\n"
220 " type=\"FieldContainer\"\n"
221 " cardinality=\"multi\"\n"
222 " visibility=\"internal\"\n"
223 " access=\"none\"\n"
224 " category=\"parentpointer\"\n"
225 " fieldFlags=\"FStdAccess\"\n"
226 " >\n"
227 " </Field>\n"
228 "\n"
229 "\n"
230 " <Field\n"
231 " name=\"exeVariableIdx\"\n"
232 " type=\"UInt16\"\n"
233 " cardinality=\"multi\"\n"
234 " visibility=\"internal\"\n"
235 " access=\"none\"\n"
236 " fieldFlags=\"FClusterLocal\"\n"
237 " >\n"
238 " </Field>\n"
239 " <Field\n"
240 " name=\"exeParents\"\n"
241 " type=\"FieldContainer\"\n"
242 " cardinality=\"multi\"\n"
243 " visibility=\"internal\"\n"
244 " access=\"none\"\n"
245 " category=\"parentpointer\"\n"
246 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
247 " >\n"
248 " </Field>\n"
249 "<!--- fieldFlags=\"FStdAccess, FClusterLocal\" -->\n"
250 "</FieldContainer>\n",
254 /*------------------------------ get -----------------------------------*/
256 FieldContainerType &ShaderValueVariableBase::getType(void)
258 return _type;
261 const FieldContainerType &ShaderValueVariableBase::getType(void) const
263 return _type;
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();
305 return returnValue;
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) :
364 Inherited(),
365 _mfVariableIdx (),
366 _mfParents (),
367 _mfExeVariableIdx (),
368 _mfExeParents ()
372 ShaderValueVariableBase::ShaderValueVariableBase(const ShaderValueVariableBase &source) :
373 Inherited(source),
374 _mfVariableIdx (source._mfVariableIdx ),
375 _mfParents (),
376 _mfExeVariableIdx (source._mfExeVariableIdx ),
377 _mfExeParents ()
382 /*-------------------------- destructors ----------------------------------*/
384 ShaderValueVariableBase::~ShaderValueVariableBase(void)
387 /*-------------------------------------------------------------------------*/
388 /* Parent linking */
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);
406 return true;
409 return false;
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);
423 return true;
426 return false;
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);
445 if(iParentIdx != -1)
447 editMField(ParentsFieldMask, _mfParents);
449 _mfParents.erase(iParentIdx);
451 return true;
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!"
462 << std::endl;
464 return false;
467 return false;
470 if(parentFieldId == ExeParentsFieldId)
472 FieldContainer * pTypedParent =
473 dynamic_cast< FieldContainer * >(pParent);
475 if(pTypedParent != NULL)
477 Int32 iParentIdx = _mfExeParents.findIndex(pTypedParent);
479 if(iParentIdx != -1)
481 editMField(ExeParentsFieldMask, _mfExeParents);
483 _mfExeParents.erase(iParentIdx);
485 return true;
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!"
496 << std::endl;
498 return false;
501 return false;
504 return Inherited::unlinkParent(pParent, parentFieldId);
509 GetFieldHandlePtr ShaderValueVariableBase::getHandleVariableIdx (void) const
511 MFUInt16::GetHandlePtr returnValue;
513 return returnValue;
516 EditFieldHandlePtr ShaderValueVariableBase::editHandleVariableIdx (void)
518 EditFieldHandlePtr returnValue;
520 return returnValue;
523 GetFieldHandlePtr ShaderValueVariableBase::getHandleParents (void) const
525 MFParentFieldContainerPtr::GetHandlePtr returnValue;
527 return returnValue;
530 EditFieldHandlePtr ShaderValueVariableBase::editHandleParents (void)
532 EditFieldHandlePtr returnValue;
534 return returnValue;
537 GetFieldHandlePtr ShaderValueVariableBase::getHandleExeVariableIdx (void) const
539 MFUInt16::GetHandlePtr returnValue;
541 return returnValue;
544 EditFieldHandlePtr ShaderValueVariableBase::editHandleExeVariableIdx (void)
546 EditFieldHandlePtr returnValue;
548 return returnValue;
551 GetFieldHandlePtr ShaderValueVariableBase::getHandleExeParents (void) const
553 MFParentFieldContainerPtr::GetHandlePtr returnValue;
555 return returnValue;
558 EditFieldHandlePtr ShaderValueVariableBase::editHandleExeParents (void)
560 EditFieldHandlePtr returnValue;
562 return 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),
576 whichField,
577 oOffsets,
578 syncMode,
579 uiSyncInfo);
581 #endif
585 void ShaderValueVariableBase::resolveLinks(void)
587 Inherited::resolveLinks();
589 #ifdef OSG_MT_CPTR_ASPECT
590 AspectOffsetStore oOffsets;
592 _pAspectStore->fillOffsetArray(oOffsets, this);
593 #endif
595 #ifdef OSG_MT_CPTR_ASPECT
596 _mfVariableIdx.terminateShare(Thread::getCurrentAspect(),
597 oOffsets);
598 #endif
599 #ifdef OSG_MT_CPTR_ASPECT
600 _mfExeVariableIdx.terminateShare(Thread::getCurrentAspect(),
601 oOffsets);
602 #endif
606 OSG_END_NAMESPACE