changed: gcc8 base update
[opensg.git] / Source / System / State / OpenGL / OSGLogicOpChunkBase.cpp
bloba99777b4d0bfe33be6e3262bfdd340621957781b
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 LogicOpChunk!
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"
64 #include "OSGGL.h" // LogicOp default header
67 #include "OSGLogicOpChunkBase.h"
68 #include "OSGLogicOpChunk.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::LogicOpChunk
79 The logic op chunk contains the parameters that specify the logic operation
80 applied to fragments before writing them to the framebuffer. The following
81 OpenGL functionality is wrapped here:
82 glLogicOp(OSG::LogicOpChunk::_sfLogicOp).
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var GLenum LogicOpChunkBase::_sfLogicOp
90 The logic operation applied to fragments.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<LogicOpChunk *, nsOSG>::_type(
100 "LogicOpChunkPtr",
101 "StateChunkPtr",
102 LogicOpChunk::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(LogicOpChunk *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 LogicOpChunk *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 LogicOpChunk *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void LogicOpChunkBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFGLenum::Description(
126 SFGLenum::getClassType(),
127 "LogicOp",
128 "The logic operation applied to fragments.\n",
129 LogicOpFieldId, LogicOpFieldMask,
130 false,
131 (Field::SFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&LogicOpChunk::editHandleLogicOp),
133 static_cast<FieldGetMethodSig >(&LogicOpChunk::getHandleLogicOp));
135 oType.addInitialDesc(pDesc);
139 LogicOpChunkBase::TypeObject LogicOpChunkBase::_type(
140 LogicOpChunkBase::getClassname(),
141 Inherited::getClassname(),
142 "NULL",
143 nsOSG, //Namespace
144 reinterpret_cast<PrototypeCreateF>(&LogicOpChunkBase::createEmptyLocal),
145 reinterpret_cast<InitContainerF>(&LogicOpChunk::initMethod),
146 reinterpret_cast<ExitContainerF>(&LogicOpChunk::exitMethod),
147 reinterpret_cast<InitalInsertDescFunc>(
148 reinterpret_cast<void *>(&LogicOpChunk::classDescInserter)),
149 false,
151 "<?xml version=\"1.0\"?>\n"
152 "\n"
153 "<FieldContainer\n"
154 " name=\"LogicOpChunk\"\n"
155 " parent=\"StateChunk\"\n"
156 " library=\"State\"\n"
157 " pointerfieldtypes=\"both\"\n"
158 " structure=\"concrete\"\n"
159 " systemcomponent=\"true\"\n"
160 " parentsystemcomponent=\"true\"\n"
161 " docGroupBase=\"GrpStateOpenGL\"\n"
162 " >\n"
163 " The logic op chunk contains the parameters that specify the logic operation\n"
164 " applied to fragments before writing them to the framebuffer. The following\n"
165 " OpenGL functionality is wrapped here: \n"
166 " glLogicOp(OSG::LogicOpChunk::_sfLogicOp). \n"
167 " <Field\n"
168 " name=\"LogicOp\"\n"
169 " category=\"data\"\n"
170 " type=\"GLenum\"\n"
171 " cardinality=\"single\"\n"
172 " visibility=\"external\"\n"
173 " defaultValue=\"GL_COPY\"\n"
174 " defaultHeader=\"OSGGL.h\"\n"
175 " access=\"public\"\n"
176 " >\n"
177 " The logic operation applied to fragments.\n"
178 " </Field>\n"
179 "</FieldContainer>\n",
180 "The logic op chunk contains the parameters that specify the logic operation\n"
181 "applied to fragments before writing them to the framebuffer. The following\n"
182 "OpenGL functionality is wrapped here: \n"
183 "glLogicOp(OSG::LogicOpChunk::_sfLogicOp). \n"
186 /*------------------------------ get -----------------------------------*/
188 FieldContainerType &LogicOpChunkBase::getType(void)
190 return _type;
193 const FieldContainerType &LogicOpChunkBase::getType(void) const
195 return _type;
198 UInt32 LogicOpChunkBase::getContainerSize(void) const
200 return sizeof(LogicOpChunk);
203 /*------------------------- decorator get ------------------------------*/
206 SFGLenum *LogicOpChunkBase::editSFLogicOp(void)
208 editSField(LogicOpFieldMask);
210 return &_sfLogicOp;
213 const SFGLenum *LogicOpChunkBase::getSFLogicOp(void) const
215 return &_sfLogicOp;
223 /*------------------------------ access -----------------------------------*/
225 SizeT LogicOpChunkBase::getBinSize(ConstFieldMaskArg whichField)
227 SizeT returnValue = Inherited::getBinSize(whichField);
229 if(FieldBits::NoField != (LogicOpFieldMask & whichField))
231 returnValue += _sfLogicOp.getBinSize();
234 return returnValue;
237 void LogicOpChunkBase::copyToBin(BinaryDataHandler &pMem,
238 ConstFieldMaskArg whichField)
240 Inherited::copyToBin(pMem, whichField);
242 if(FieldBits::NoField != (LogicOpFieldMask & whichField))
244 _sfLogicOp.copyToBin(pMem);
248 void LogicOpChunkBase::copyFromBin(BinaryDataHandler &pMem,
249 ConstFieldMaskArg whichField)
251 Inherited::copyFromBin(pMem, whichField);
253 if(FieldBits::NoField != (LogicOpFieldMask & whichField))
255 editSField(LogicOpFieldMask);
256 _sfLogicOp.copyFromBin(pMem);
260 //! create a new instance of the class
261 LogicOpChunkTransitPtr LogicOpChunkBase::createLocal(BitVector bFlags)
263 LogicOpChunkTransitPtr fc;
265 if(getClassType().getPrototype() != NULL)
267 FieldContainerTransitPtr tmpPtr =
268 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
270 fc = dynamic_pointer_cast<LogicOpChunk>(tmpPtr);
273 return fc;
276 //! create a new instance of the class, copy the container flags
277 LogicOpChunkTransitPtr LogicOpChunkBase::createDependent(BitVector bFlags)
279 LogicOpChunkTransitPtr fc;
281 if(getClassType().getPrototype() != NULL)
283 FieldContainerTransitPtr tmpPtr =
284 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
286 fc = dynamic_pointer_cast<LogicOpChunk>(tmpPtr);
289 return fc;
292 //! create a new instance of the class
293 LogicOpChunkTransitPtr LogicOpChunkBase::create(void)
295 LogicOpChunkTransitPtr fc;
297 if(getClassType().getPrototype() != NULL)
299 FieldContainerTransitPtr tmpPtr =
300 getClassType().getPrototype()-> shallowCopy();
302 fc = dynamic_pointer_cast<LogicOpChunk>(tmpPtr);
305 return fc;
308 LogicOpChunk *LogicOpChunkBase::createEmptyLocal(BitVector bFlags)
310 LogicOpChunk *returnValue;
312 newPtr<LogicOpChunk>(returnValue, bFlags);
314 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
316 return returnValue;
319 //! create an empty new instance of the class, do not copy the prototype
320 LogicOpChunk *LogicOpChunkBase::createEmpty(void)
322 LogicOpChunk *returnValue;
324 newPtr<LogicOpChunk>(returnValue, Thread::getCurrentLocalFlags());
326 returnValue->_pFieldFlags->_bNamespaceMask &=
327 ~Thread::getCurrentLocalFlags();
329 return returnValue;
333 FieldContainerTransitPtr LogicOpChunkBase::shallowCopyLocal(
334 BitVector bFlags) const
336 LogicOpChunk *tmpPtr;
338 newPtr(tmpPtr, dynamic_cast<const LogicOpChunk *>(this), bFlags);
340 FieldContainerTransitPtr returnValue(tmpPtr);
342 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
344 return returnValue;
347 FieldContainerTransitPtr LogicOpChunkBase::shallowCopyDependent(
348 BitVector bFlags) const
350 LogicOpChunk *tmpPtr;
352 newPtr(tmpPtr, dynamic_cast<const LogicOpChunk *>(this), ~bFlags);
354 FieldContainerTransitPtr returnValue(tmpPtr);
356 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
358 return returnValue;
361 FieldContainerTransitPtr LogicOpChunkBase::shallowCopy(void) const
363 LogicOpChunk *tmpPtr;
365 newPtr(tmpPtr,
366 dynamic_cast<const LogicOpChunk *>(this),
367 Thread::getCurrentLocalFlags());
369 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
371 FieldContainerTransitPtr returnValue(tmpPtr);
373 return returnValue;
379 /*------------------------- constructors ----------------------------------*/
381 LogicOpChunkBase::LogicOpChunkBase(void) :
382 Inherited(),
383 _sfLogicOp (GLenum(GL_COPY))
387 LogicOpChunkBase::LogicOpChunkBase(const LogicOpChunkBase &source) :
388 Inherited(source),
389 _sfLogicOp (source._sfLogicOp )
394 /*-------------------------- destructors ----------------------------------*/
396 LogicOpChunkBase::~LogicOpChunkBase(void)
401 GetFieldHandlePtr LogicOpChunkBase::getHandleLogicOp (void) const
403 SFGLenum::GetHandlePtr returnValue(
404 new SFGLenum::GetHandle(
405 &_sfLogicOp,
406 this->getType().getFieldDesc(LogicOpFieldId),
407 const_cast<LogicOpChunkBase *>(this)));
409 return returnValue;
412 EditFieldHandlePtr LogicOpChunkBase::editHandleLogicOp (void)
414 SFGLenum::EditHandlePtr returnValue(
415 new SFGLenum::EditHandle(
416 &_sfLogicOp,
417 this->getType().getFieldDesc(LogicOpFieldId),
418 this));
421 editSField(LogicOpFieldMask);
423 return returnValue;
427 #ifdef OSG_MT_CPTR_ASPECT
428 void LogicOpChunkBase::execSyncV( FieldContainer &oFrom,
429 ConstFieldMaskArg whichField,
430 AspectOffsetStore &oOffsets,
431 ConstFieldMaskArg syncMode,
432 const UInt32 uiSyncInfo)
434 LogicOpChunk *pThis = static_cast<LogicOpChunk *>(this);
436 pThis->execSync(static_cast<LogicOpChunk *>(&oFrom),
437 whichField,
438 oOffsets,
439 syncMode,
440 uiSyncInfo);
442 #endif
445 #ifdef OSG_MT_CPTR_ASPECT
446 FieldContainer *LogicOpChunkBase::createAspectCopy(
447 const FieldContainer *pRefAspect) const
449 LogicOpChunk *returnValue;
451 newAspectCopy(returnValue,
452 dynamic_cast<const LogicOpChunk *>(pRefAspect),
453 dynamic_cast<const LogicOpChunk *>(this));
455 return returnValue;
457 #endif
459 void LogicOpChunkBase::resolveLinks(void)
461 Inherited::resolveLinks();
467 OSG_END_NAMESPACE