changed: gcc8 base update
[opensg.git] / Source / Contrib / ComplexSceneManager / Helper / Shader / OSGShaderProgramFileBase.cpp
blob23560449e02cbe598ff036d31580f9ee00488091
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 ShaderProgramFile!
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 "OSGShaderProgramFileBase.h"
67 #include "OSGShaderProgramFile.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ShaderProgramFile
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var std::string ShaderProgramFileBase::_sfProgramUrl
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<ShaderProgramFile *, nsOSG>::_type(
96 "ShaderProgramFilePtr",
97 "ShaderProgramPtr",
98 ShaderProgramFile::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(ShaderProgramFile *, nsOSG)
104 /***************************************************************************\
105 * Field Description *
106 \***************************************************************************/
108 void ShaderProgramFileBase::classDescInserter(TypeObject &oType)
110 FieldDescriptionBase *pDesc = NULL;
113 pDesc = new SFString::Description(
114 SFString::getClassType(),
115 "programUrl",
117 ProgramUrlFieldId, ProgramUrlFieldMask,
118 false,
119 (Field::SFDefaultFlags | Field::FStdAccess),
120 static_cast<FieldEditMethodSig>(&ShaderProgramFile::editHandleProgramUrl),
121 static_cast<FieldGetMethodSig >(&ShaderProgramFile::getHandleProgramUrl));
123 oType.addInitialDesc(pDesc);
127 ShaderProgramFileBase::TypeObject ShaderProgramFileBase::_type(
128 ShaderProgramFileBase::getClassname(),
129 Inherited::getClassname(),
130 "NULL",
131 nsOSG, //Namespace
132 reinterpret_cast<PrototypeCreateF>(&ShaderProgramFileBase::createEmptyLocal),
133 reinterpret_cast<InitContainerF>(&ShaderProgramFile::initMethod),
134 reinterpret_cast<ExitContainerF>(&ShaderProgramFile::exitMethod),
135 reinterpret_cast<InitalInsertDescFunc>(
136 reinterpret_cast<void *>(&ShaderProgramFile::classDescInserter)),
137 false,
139 "<?xml version=\"1.0\"?>\n"
140 "\n"
141 "<FieldContainer\n"
142 " name=\"ShaderProgramFile\"\n"
143 " parent=\"ShaderProgram\"\n"
144 " library=\"ContribCSM\"\n"
145 " pointerfieldtypes=\"none\"\n"
146 " structure=\"concrete\"\n"
147 " systemcomponent=\"true\"\n"
148 " parentsystemcomponent=\"true\"\n"
149 " decoratable=\"false\"\n"
150 " useLocalIncludes=\"false\"\n"
151 " isNodeCore=\"false\"\n"
152 " isBundle=\"false\"\n"
153 " parentFields=\"none\"\n"
154 ">\n"
155 "\t<Field\n"
156 "\t\tname=\"programUrl\"\n"
157 "\t\ttype=\"std::string\"\n"
158 "\t\tcardinality=\"single\"\n"
159 "\t\tvisibility=\"external\"\n"
160 "\t\taccess=\"public\"\n"
161 "\t>\n"
162 "\t</Field>\n"
163 "</FieldContainer>\n",
167 /*------------------------------ get -----------------------------------*/
169 FieldContainerType &ShaderProgramFileBase::getType(void)
171 return _type;
174 const FieldContainerType &ShaderProgramFileBase::getType(void) const
176 return _type;
179 UInt32 ShaderProgramFileBase::getContainerSize(void) const
181 return sizeof(ShaderProgramFile);
184 /*------------------------- decorator get ------------------------------*/
187 SFString *ShaderProgramFileBase::editSFProgramUrl(void)
189 editSField(ProgramUrlFieldMask);
191 return &_sfProgramUrl;
194 const SFString *ShaderProgramFileBase::getSFProgramUrl(void) const
196 return &_sfProgramUrl;
204 /*------------------------------ access -----------------------------------*/
206 SizeT ShaderProgramFileBase::getBinSize(ConstFieldMaskArg whichField)
208 SizeT returnValue = Inherited::getBinSize(whichField);
210 if(FieldBits::NoField != (ProgramUrlFieldMask & whichField))
212 returnValue += _sfProgramUrl.getBinSize();
215 return returnValue;
218 void ShaderProgramFileBase::copyToBin(BinaryDataHandler &pMem,
219 ConstFieldMaskArg whichField)
221 Inherited::copyToBin(pMem, whichField);
223 if(FieldBits::NoField != (ProgramUrlFieldMask & whichField))
225 _sfProgramUrl.copyToBin(pMem);
229 void ShaderProgramFileBase::copyFromBin(BinaryDataHandler &pMem,
230 ConstFieldMaskArg whichField)
232 Inherited::copyFromBin(pMem, whichField);
234 if(FieldBits::NoField != (ProgramUrlFieldMask & whichField))
236 editSField(ProgramUrlFieldMask);
237 _sfProgramUrl.copyFromBin(pMem);
241 //! create a new instance of the class
242 ShaderProgramFileTransitPtr ShaderProgramFileBase::createLocal(BitVector bFlags)
244 ShaderProgramFileTransitPtr fc;
246 if(getClassType().getPrototype() != NULL)
248 FieldContainerTransitPtr tmpPtr =
249 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
251 fc = dynamic_pointer_cast<ShaderProgramFile>(tmpPtr);
254 return fc;
257 //! create a new instance of the class, copy the container flags
258 ShaderProgramFileTransitPtr ShaderProgramFileBase::createDependent(BitVector bFlags)
260 ShaderProgramFileTransitPtr fc;
262 if(getClassType().getPrototype() != NULL)
264 FieldContainerTransitPtr tmpPtr =
265 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
267 fc = dynamic_pointer_cast<ShaderProgramFile>(tmpPtr);
270 return fc;
273 //! create a new instance of the class
274 ShaderProgramFileTransitPtr ShaderProgramFileBase::create(void)
276 ShaderProgramFileTransitPtr fc;
278 if(getClassType().getPrototype() != NULL)
280 FieldContainerTransitPtr tmpPtr =
281 getClassType().getPrototype()-> shallowCopy();
283 fc = dynamic_pointer_cast<ShaderProgramFile>(tmpPtr);
286 return fc;
289 ShaderProgramFile *ShaderProgramFileBase::createEmptyLocal(BitVector bFlags)
291 ShaderProgramFile *returnValue;
293 newPtr<ShaderProgramFile>(returnValue, bFlags);
295 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
297 return returnValue;
300 //! create an empty new instance of the class, do not copy the prototype
301 ShaderProgramFile *ShaderProgramFileBase::createEmpty(void)
303 ShaderProgramFile *returnValue;
305 newPtr<ShaderProgramFile>(returnValue, Thread::getCurrentLocalFlags());
307 returnValue->_pFieldFlags->_bNamespaceMask &=
308 ~Thread::getCurrentLocalFlags();
310 return returnValue;
314 FieldContainerTransitPtr ShaderProgramFileBase::shallowCopyLocal(
315 BitVector bFlags) const
317 ShaderProgramFile *tmpPtr;
319 newPtr(tmpPtr, dynamic_cast<const ShaderProgramFile *>(this), bFlags);
321 FieldContainerTransitPtr returnValue(tmpPtr);
323 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
325 return returnValue;
328 FieldContainerTransitPtr ShaderProgramFileBase::shallowCopyDependent(
329 BitVector bFlags) const
331 ShaderProgramFile *tmpPtr;
333 newPtr(tmpPtr, dynamic_cast<const ShaderProgramFile *>(this), ~bFlags);
335 FieldContainerTransitPtr returnValue(tmpPtr);
337 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
339 return returnValue;
342 FieldContainerTransitPtr ShaderProgramFileBase::shallowCopy(void) const
344 ShaderProgramFile *tmpPtr;
346 newPtr(tmpPtr,
347 dynamic_cast<const ShaderProgramFile *>(this),
348 Thread::getCurrentLocalFlags());
350 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
352 FieldContainerTransitPtr returnValue(tmpPtr);
354 return returnValue;
360 /*------------------------- constructors ----------------------------------*/
362 ShaderProgramFileBase::ShaderProgramFileBase(void) :
363 Inherited(),
364 _sfProgramUrl ()
368 ShaderProgramFileBase::ShaderProgramFileBase(const ShaderProgramFileBase &source) :
369 Inherited(source),
370 _sfProgramUrl (source._sfProgramUrl )
375 /*-------------------------- destructors ----------------------------------*/
377 ShaderProgramFileBase::~ShaderProgramFileBase(void)
382 GetFieldHandlePtr ShaderProgramFileBase::getHandleProgramUrl (void) const
384 SFString::GetHandlePtr returnValue(
385 new SFString::GetHandle(
386 &_sfProgramUrl,
387 this->getType().getFieldDesc(ProgramUrlFieldId),
388 const_cast<ShaderProgramFileBase *>(this)));
390 return returnValue;
393 EditFieldHandlePtr ShaderProgramFileBase::editHandleProgramUrl (void)
395 SFString::EditHandlePtr returnValue(
396 new SFString::EditHandle(
397 &_sfProgramUrl,
398 this->getType().getFieldDesc(ProgramUrlFieldId),
399 this));
402 editSField(ProgramUrlFieldMask);
404 return returnValue;
408 #ifdef OSG_MT_CPTR_ASPECT
409 void ShaderProgramFileBase::execSyncV( FieldContainer &oFrom,
410 ConstFieldMaskArg whichField,
411 AspectOffsetStore &oOffsets,
412 ConstFieldMaskArg syncMode,
413 const UInt32 uiSyncInfo)
415 ShaderProgramFile *pThis = static_cast<ShaderProgramFile *>(this);
417 pThis->execSync(static_cast<ShaderProgramFile *>(&oFrom),
418 whichField,
419 oOffsets,
420 syncMode,
421 uiSyncInfo);
423 #endif
426 #ifdef OSG_MT_CPTR_ASPECT
427 FieldContainer *ShaderProgramFileBase::createAspectCopy(
428 const FieldContainer *pRefAspect) const
430 ShaderProgramFile *returnValue;
432 newAspectCopy(returnValue,
433 dynamic_cast<const ShaderProgramFile *>(pRefAspect),
434 dynamic_cast<const ShaderProgramFile *>(this));
436 return returnValue;
438 #endif
440 void ShaderProgramFileBase::resolveLinks(void)
442 Inherited::resolveLinks();
448 OSG_END_NAMESPACE