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 ShaderProgramFile!
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"
66 #include "OSGShaderProgramFileBase.h"
67 #include "OSGShaderProgramFile.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
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",
98 ShaderProgramFile::getClassType(),
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(),
117 ProgramUrlFieldId
, ProgramUrlFieldMask
,
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(),
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
)),
139 "<?xml version=\"1.0\"?>\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"
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"
163 "</FieldContainer>\n",
167 /*------------------------------ get -----------------------------------*/
169 FieldContainerType
&ShaderProgramFileBase::getType(void)
174 const FieldContainerType
&ShaderProgramFileBase::getType(void) const
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();
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
);
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
);
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
);
289 ShaderProgramFile
*ShaderProgramFileBase::createEmptyLocal(BitVector bFlags
)
291 ShaderProgramFile
*returnValue
;
293 newPtr
<ShaderProgramFile
>(returnValue
, bFlags
);
295 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
342 FieldContainerTransitPtr
ShaderProgramFileBase::shallowCopy(void) const
344 ShaderProgramFile
*tmpPtr
;
347 dynamic_cast<const ShaderProgramFile
*>(this),
348 Thread::getCurrentLocalFlags());
350 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
352 FieldContainerTransitPtr
returnValue(tmpPtr
);
360 /*------------------------- constructors ----------------------------------*/
362 ShaderProgramFileBase::ShaderProgramFileBase(void) :
368 ShaderProgramFileBase::ShaderProgramFileBase(const ShaderProgramFileBase
&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(
387 this->getType().getFieldDesc(ProgramUrlFieldId
),
388 const_cast<ShaderProgramFileBase
*>(this)));
393 EditFieldHandlePtr
ShaderProgramFileBase::editHandleProgramUrl (void)
395 SFString::EditHandlePtr
returnValue(
396 new SFString::EditHandle(
398 this->getType().getFieldDesc(ProgramUrlFieldId
),
402 editSField(ProgramUrlFieldMask
);
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
),
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));
440 void ShaderProgramFileBase::resolveLinks(void)
442 Inherited::resolveLinks();