changed: gcc8 base update
[opensg.git] / Source / System / State / Shader / Base / OSGShaderVariableBase.cpp
blob09b0e025ef761d3fa3e2054569f44c5441cad911
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 ShaderVariable!
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 "OSGShaderVariableBase.h"
67 #include "OSGShaderVariable.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ShaderVariable
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var std::string ShaderVariableBase::_sfName
86 Uniform name.
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<ShaderVariable *, nsOSG>::_type(
96 "ShaderVariablePtr",
97 "FieldContainerPtr",
98 ShaderVariable::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(ShaderVariable *, nsOSG)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
105 ShaderVariable *,
106 nsOSG)
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
109 ShaderVariable *,
110 nsOSG)
112 DataType &FieldTraits< ShaderVariable *, nsOSG + 1 >::getType(void)
114 return FieldTraits<ShaderVariable *, nsOSG>::getType();
118 OSG_EXPORT_PTR_MFIELD(ChildPointerMField,
119 ShaderVariable *,
120 UnrecordedRefCountPolicy,
121 nsOSG + 1)
124 /***************************************************************************\
125 * Field Description *
126 \***************************************************************************/
128 void ShaderVariableBase::classDescInserter(TypeObject &oType)
130 FieldDescriptionBase *pDesc = NULL;
133 pDesc = new SFString::Description(
134 SFString::getClassType(),
135 "name",
136 "Uniform name.\n",
137 NameFieldId, NameFieldMask,
138 false,
139 (Field::SFDefaultFlags | Field::FStdAccess),
140 static_cast<FieldEditMethodSig>(&ShaderVariable::editHandleName),
141 static_cast<FieldGetMethodSig >(&ShaderVariable::getHandleName));
143 oType.addInitialDesc(pDesc);
147 ShaderVariableBase::TypeObject ShaderVariableBase::_type(
148 ShaderVariableBase::getClassname(),
149 Inherited::getClassname(),
150 "NULL",
151 nsOSG, //Namespace
152 NULL,
153 reinterpret_cast<InitContainerF>(&ShaderVariable::initMethod),
154 reinterpret_cast<ExitContainerF>(&ShaderVariable::exitMethod),
155 reinterpret_cast<InitalInsertDescFunc>(
156 reinterpret_cast<void *>(&ShaderVariable::classDescInserter)),
157 false,
159 "<?xml version=\"1.0\"?>\n"
160 "\n"
161 "<FieldContainer\n"
162 " name=\"ShaderVariable\"\n"
163 " parent=\"FieldContainer\"\n"
164 " library=\"System\"\n"
165 " pointerfieldtypes=\"both\"\n"
166 " structure=\"abstract\"\n"
167 " systemcomponent=\"true\"\n"
168 " parentsystemcomponent=\"true\"\n"
169 " decoratable=\"false\"\n"
170 " useLocalIncludes=\"false\"\n"
171 " childFields=\"multi\"\n"
172 " docGroupBase=\"GrpSystemShader\"\n"
173 " >\n"
174 " <Field\n"
175 " name=\"name\"\n"
176 " type=\"std::string\"\n"
177 " cardinality=\"single\"\n"
178 " visibility=\"external\"\n"
179 " access=\"protected\"\n"
180 " >\n"
181 " Uniform name.\n"
182 " </Field>\n"
183 "</FieldContainer>\n",
187 /*------------------------------ get -----------------------------------*/
189 FieldContainerType &ShaderVariableBase::getType(void)
191 return _type;
194 const FieldContainerType &ShaderVariableBase::getType(void) const
196 return _type;
199 UInt32 ShaderVariableBase::getContainerSize(void) const
201 return sizeof(ShaderVariable);
204 /*------------------------- decorator get ------------------------------*/
207 SFString *ShaderVariableBase::editSFName(void)
209 editSField(NameFieldMask);
211 return &_sfName;
214 const SFString *ShaderVariableBase::getSFName(void) const
216 return &_sfName;
224 /*------------------------------ access -----------------------------------*/
226 SizeT ShaderVariableBase::getBinSize(ConstFieldMaskArg whichField)
228 SizeT returnValue = Inherited::getBinSize(whichField);
230 if(FieldBits::NoField != (NameFieldMask & whichField))
232 returnValue += _sfName.getBinSize();
235 return returnValue;
238 void ShaderVariableBase::copyToBin(BinaryDataHandler &pMem,
239 ConstFieldMaskArg whichField)
241 Inherited::copyToBin(pMem, whichField);
243 if(FieldBits::NoField != (NameFieldMask & whichField))
245 _sfName.copyToBin(pMem);
249 void ShaderVariableBase::copyFromBin(BinaryDataHandler &pMem,
250 ConstFieldMaskArg whichField)
252 Inherited::copyFromBin(pMem, whichField);
254 if(FieldBits::NoField != (NameFieldMask & whichField))
256 editSField(NameFieldMask);
257 _sfName.copyFromBin(pMem);
264 /*------------------------- constructors ----------------------------------*/
266 ShaderVariableBase::ShaderVariableBase(void) :
267 Inherited(),
268 _sfName ()
272 ShaderVariableBase::ShaderVariableBase(const ShaderVariableBase &source) :
273 Inherited(source),
274 _sfName (source._sfName )
279 /*-------------------------- destructors ----------------------------------*/
281 ShaderVariableBase::~ShaderVariableBase(void)
286 GetFieldHandlePtr ShaderVariableBase::getHandleName (void) const
288 SFString::GetHandlePtr returnValue(
289 new SFString::GetHandle(
290 &_sfName,
291 this->getType().getFieldDesc(NameFieldId),
292 const_cast<ShaderVariableBase *>(this)));
294 return returnValue;
297 EditFieldHandlePtr ShaderVariableBase::editHandleName (void)
299 SFString::EditHandlePtr returnValue(
300 new SFString::EditHandle(
301 &_sfName,
302 this->getType().getFieldDesc(NameFieldId),
303 this));
306 editSField(NameFieldMask);
308 return returnValue;
312 #ifdef OSG_MT_CPTR_ASPECT
313 void ShaderVariableBase::execSyncV( FieldContainer &oFrom,
314 ConstFieldMaskArg whichField,
315 AspectOffsetStore &oOffsets,
316 ConstFieldMaskArg syncMode,
317 const UInt32 uiSyncInfo)
319 ShaderVariable *pThis = static_cast<ShaderVariable *>(this);
321 pThis->execSync(static_cast<ShaderVariable *>(&oFrom),
322 whichField,
323 oOffsets,
324 syncMode,
325 uiSyncInfo);
327 #endif
331 void ShaderVariableBase::resolveLinks(void)
333 Inherited::resolveLinks();
339 OSG_END_NAMESPACE