changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / PropertiesBase / OSGGeoVectorPropertyBase.cpp
blob165466a46979ad146febb49bed2bcd45ef99c4f8
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 GeoVectorProperty!
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 "OSGGeoVectorPropertyBase.h"
67 #include "OSGGeoVectorProperty.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::GeoVectorProperty
78 Abstract base class for all vector-valued GeoProperties.
79 Provides a uniform interface for accessing all vector data in geometry using
80 automatic conversion methods.
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var UInt32 GeoVectorPropertyBase::_sfDivisor
88 sets the vertex attrib divisor for instanced rendering
92 /***************************************************************************\
93 * FieldType/FieldTrait Instantiation *
94 \***************************************************************************/
96 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
97 PointerType FieldTraits<GeoVectorProperty *, nsOSG>::_type(
98 "GeoVectorPropertyPtr",
99 "GeoPropertyPtr",
100 GeoVectorProperty::getClassType(),
101 nsOSG);
102 #endif
104 OSG_FIELDTRAITS_GETTYPE_NS(GeoVectorProperty *, nsOSG)
106 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
107 GeoVectorProperty *,
108 nsOSG)
110 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
111 GeoVectorProperty *,
112 nsOSG)
114 DataType &FieldTraits< GeoVectorProperty *, nsOSG + 1 >::getType(void)
116 return FieldTraits<GeoVectorProperty *, nsOSG>::getType();
120 OSG_EXPORT_PTR_SFIELD(ChildPointerSField,
121 GeoVectorProperty *,
122 UnrecordedRefCountPolicy,
123 nsOSG + 1)
126 OSG_EXPORT_PTR_MFIELD(ChildPointerMField,
127 GeoVectorProperty *,
128 UnrecordedRefCountPolicy,
129 nsOSG + 1)
132 /***************************************************************************\
133 * Field Description *
134 \***************************************************************************/
136 void GeoVectorPropertyBase::classDescInserter(TypeObject &oType)
138 FieldDescriptionBase *pDesc = NULL;
141 pDesc = new SFUInt32::Description(
142 SFUInt32::getClassType(),
143 "divisor",
144 "sets the vertex attrib divisor for instanced rendering\n",
145 DivisorFieldId, DivisorFieldMask,
146 false,
147 (Field::SFDefaultFlags | Field::FStdAccess),
148 static_cast<FieldEditMethodSig>(&GeoVectorProperty::editHandleDivisor),
149 static_cast<FieldGetMethodSig >(&GeoVectorProperty::getHandleDivisor));
151 oType.addInitialDesc(pDesc);
155 GeoVectorPropertyBase::TypeObject GeoVectorPropertyBase::_type(
156 GeoVectorPropertyBase::getClassname(),
157 Inherited::getClassname(),
158 "NULL",
159 nsOSG, //Namespace
160 NULL,
161 reinterpret_cast<InitContainerF>(&GeoVectorProperty::initMethod),
162 reinterpret_cast<ExitContainerF>(&GeoVectorProperty::exitMethod),
163 reinterpret_cast<InitalInsertDescFunc>(
164 reinterpret_cast<void *>(&GeoVectorProperty::classDescInserter)),
165 false,
167 "<?xml version=\"1.0\"?>\n"
168 "\n"
169 "<FieldContainer\n"
170 " name=\"GeoVectorProperty\"\n"
171 " parent=\"GeoProperty\"\n"
172 " library=\"System\"\n"
173 " pointerfieldtypes=\"both\"\n"
174 " structure=\"abstract\"\n"
175 " systemcomponent=\"true\"\n"
176 " parentsystemcomponent=\"true\"\n"
177 " decoratable=\"false\"\n"
178 " childFields=\"both\"\n"
179 " docGroupBase=\"GrpDrawablesGeometry\"\n"
180 " >\n"
181 " Abstract base class for all vector-valued GeoProperties.\n"
182 " Provides a uniform interface for accessing all vector data in geometry using\n"
183 " automatic conversion methods.\n"
184 " <Field\n"
185 " name=\"divisor\"\n"
186 " type=\"UInt32\"\n"
187 " cardinality=\"single\"\n"
188 " visibility=\"external\"\n"
189 " defaultValue=\"0\"\n"
190 " access=\"public\"\n"
191 " >\n"
192 " sets the vertex attrib divisor for instanced rendering\n"
193 " </Field>\n"
194 "</FieldContainer>\n",
195 "Abstract base class for all vector-valued GeoProperties.\n"
196 "Provides a uniform interface for accessing all vector data in geometry using\n"
197 "automatic conversion methods.\n"
200 /*------------------------------ get -----------------------------------*/
202 FieldContainerType &GeoVectorPropertyBase::getType(void)
204 return _type;
207 const FieldContainerType &GeoVectorPropertyBase::getType(void) const
209 return _type;
212 UInt32 GeoVectorPropertyBase::getContainerSize(void) const
214 return sizeof(GeoVectorProperty);
217 /*------------------------- decorator get ------------------------------*/
220 SFUInt32 *GeoVectorPropertyBase::editSFDivisor(void)
222 editSField(DivisorFieldMask);
224 return &_sfDivisor;
227 const SFUInt32 *GeoVectorPropertyBase::getSFDivisor(void) const
229 return &_sfDivisor;
237 /*------------------------------ access -----------------------------------*/
239 SizeT GeoVectorPropertyBase::getBinSize(ConstFieldMaskArg whichField)
241 SizeT returnValue = Inherited::getBinSize(whichField);
243 if(FieldBits::NoField != (DivisorFieldMask & whichField))
245 returnValue += _sfDivisor.getBinSize();
248 return returnValue;
251 void GeoVectorPropertyBase::copyToBin(BinaryDataHandler &pMem,
252 ConstFieldMaskArg whichField)
254 Inherited::copyToBin(pMem, whichField);
256 if(FieldBits::NoField != (DivisorFieldMask & whichField))
258 _sfDivisor.copyToBin(pMem);
262 void GeoVectorPropertyBase::copyFromBin(BinaryDataHandler &pMem,
263 ConstFieldMaskArg whichField)
265 Inherited::copyFromBin(pMem, whichField);
267 if(FieldBits::NoField != (DivisorFieldMask & whichField))
269 editSField(DivisorFieldMask);
270 _sfDivisor.copyFromBin(pMem);
277 /*------------------------- constructors ----------------------------------*/
279 GeoVectorPropertyBase::GeoVectorPropertyBase(void) :
280 Inherited(),
281 _sfDivisor (UInt32(0))
285 GeoVectorPropertyBase::GeoVectorPropertyBase(const GeoVectorPropertyBase &source) :
286 Inherited(source),
287 _sfDivisor (source._sfDivisor )
292 /*-------------------------- destructors ----------------------------------*/
294 GeoVectorPropertyBase::~GeoVectorPropertyBase(void)
299 GetFieldHandlePtr GeoVectorPropertyBase::getHandleDivisor (void) const
301 SFUInt32::GetHandlePtr returnValue(
302 new SFUInt32::GetHandle(
303 &_sfDivisor,
304 this->getType().getFieldDesc(DivisorFieldId),
305 const_cast<GeoVectorPropertyBase *>(this)));
307 return returnValue;
310 EditFieldHandlePtr GeoVectorPropertyBase::editHandleDivisor (void)
312 SFUInt32::EditHandlePtr returnValue(
313 new SFUInt32::EditHandle(
314 &_sfDivisor,
315 this->getType().getFieldDesc(DivisorFieldId),
316 this));
319 editSField(DivisorFieldMask);
321 return returnValue;
325 #ifdef OSG_MT_CPTR_ASPECT
326 void GeoVectorPropertyBase::execSyncV( FieldContainer &oFrom,
327 ConstFieldMaskArg whichField,
328 AspectOffsetStore &oOffsets,
329 ConstFieldMaskArg syncMode,
330 const UInt32 uiSyncInfo)
332 GeoVectorProperty *pThis = static_cast<GeoVectorProperty *>(this);
334 pThis->execSync(static_cast<GeoVectorProperty *>(&oFrom),
335 whichField,
336 oOffsets,
337 syncMode,
338 uiSyncInfo);
340 #endif
344 void GeoVectorPropertyBase::resolveLinks(void)
346 Inherited::resolveLinks();
352 OSG_END_NAMESPACE