fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Drawables / Base / OSGDrawableStatsAttachmentBase.cpp
blobf405ee8fdbff399581142654a8fdc306262978e7
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 DrawableStatsAttachment!
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 "OSGDrawableStatsAttachmentBase.h"
67 #include "OSGDrawableStatsAttachment.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::DrawableStatsAttachment
78 The base class for drawable statistics.
80 It is designed as an attachment so that it can be kept inside the graph. It
81 can also be used to keep aggregated information about subtrees, by adding up
82 the contributions of the underlying nodes. It can invalidate itself by using
83 changed callbacks, so that no manual bookkeeping is necessary.
85 \warning To use the automatic update you have to use the
86 OSG::GeoStatsAttachment::addTo() or OSG::GeoStatsAttachment::attachTo()
87 methods! Otherwise the necessary callbacks are not set!
89 \warning Before accessing the data OSG::GeoStatsAttachment::validate() needs
90 to be called to calculate and aggregate the results.
93 /***************************************************************************\
94 * Field Documentation *
95 \***************************************************************************/
97 /*! \var UInt32 DrawableStatsAttachmentBase::_sfVertices
98 The number of vertices in the subtree.
101 /*! \var UInt32 DrawableStatsAttachmentBase::_sfPoints
102 The number of points in the subtree.
105 /*! \var UInt32 DrawableStatsAttachmentBase::_sfLines
106 The number of lines in the subtree.
109 /*! \var UInt32 DrawableStatsAttachmentBase::_sfTriangles
110 The number of triangles in the subtree.
113 /*! \var UInt32 DrawableStatsAttachmentBase::_sfPatches
114 The number of lines in the subtree.
117 /*! \var UInt32 DrawableStatsAttachmentBase::_sfProcessedAttributeBytes
118 The number of bytes in vertex attribute data that are processed while rendering.
121 /*! \var UInt32 DrawableStatsAttachmentBase::_sfStoredAttributeBytes
122 The number of bytes in vertex attribute data that are stored.
125 /*! \var bool DrawableStatsAttachmentBase::_sfValid
126 Flags whether the data is valid or needs to be updated.
130 /***************************************************************************\
131 * FieldType/FieldTrait Instantiation *
132 \***************************************************************************/
134 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
135 PointerType FieldTraits<DrawableStatsAttachment *, nsOSG>::_type(
136 "DrawableStatsAttachmentPtr",
137 "StatsAttachmentPtr",
138 DrawableStatsAttachment::getClassType(),
139 nsOSG);
140 #endif
142 OSG_FIELDTRAITS_GETTYPE_NS(DrawableStatsAttachment *, nsOSG)
144 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
145 DrawableStatsAttachment *,
146 nsOSG)
148 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
149 DrawableStatsAttachment *,
150 nsOSG)
152 /***************************************************************************\
153 * Field Description *
154 \***************************************************************************/
156 void DrawableStatsAttachmentBase::classDescInserter(TypeObject &oType)
158 FieldDescriptionBase *pDesc = NULL;
161 pDesc = new SFUInt32::Description(
162 SFUInt32::getClassType(),
163 "vertices",
164 "The number of vertices in the subtree.\n",
165 VerticesFieldId, VerticesFieldMask,
166 false,
167 (Field::SFDefaultFlags | Field::FStdAccess),
168 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandleVertices),
169 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandleVertices));
171 oType.addInitialDesc(pDesc);
173 pDesc = new SFUInt32::Description(
174 SFUInt32::getClassType(),
175 "points",
176 "The number of points in the subtree.\n",
177 PointsFieldId, PointsFieldMask,
178 false,
179 (Field::SFDefaultFlags | Field::FStdAccess),
180 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandlePoints),
181 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandlePoints));
183 oType.addInitialDesc(pDesc);
185 pDesc = new SFUInt32::Description(
186 SFUInt32::getClassType(),
187 "lines",
188 "The number of lines in the subtree.\n",
189 LinesFieldId, LinesFieldMask,
190 false,
191 (Field::SFDefaultFlags | Field::FStdAccess),
192 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandleLines),
193 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandleLines));
195 oType.addInitialDesc(pDesc);
197 pDesc = new SFUInt32::Description(
198 SFUInt32::getClassType(),
199 "triangles",
200 "The number of triangles in the subtree.\n",
201 TrianglesFieldId, TrianglesFieldMask,
202 false,
203 (Field::SFDefaultFlags | Field::FStdAccess),
204 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandleTriangles),
205 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandleTriangles));
207 oType.addInitialDesc(pDesc);
209 pDesc = new SFUInt32::Description(
210 SFUInt32::getClassType(),
211 "patches",
212 "The number of lines in the subtree.\n",
213 PatchesFieldId, PatchesFieldMask,
214 false,
215 (Field::SFDefaultFlags | Field::FStdAccess),
216 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandlePatches),
217 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandlePatches));
219 oType.addInitialDesc(pDesc);
221 pDesc = new SFUInt32::Description(
222 SFUInt32::getClassType(),
223 "processedAttributeBytes",
224 "The number of bytes in vertex attribute data that are processed while rendering.\n",
225 ProcessedAttributeBytesFieldId, ProcessedAttributeBytesFieldMask,
226 false,
227 (Field::SFDefaultFlags | Field::FStdAccess),
228 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandleProcessedAttributeBytes),
229 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandleProcessedAttributeBytes));
231 oType.addInitialDesc(pDesc);
233 pDesc = new SFUInt32::Description(
234 SFUInt32::getClassType(),
235 "storedAttributeBytes",
236 "The number of bytes in vertex attribute data that are stored.\n",
237 StoredAttributeBytesFieldId, StoredAttributeBytesFieldMask,
238 false,
239 (Field::SFDefaultFlags | Field::FStdAccess),
240 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandleStoredAttributeBytes),
241 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandleStoredAttributeBytes));
243 oType.addInitialDesc(pDesc);
245 pDesc = new SFBool::Description(
246 SFBool::getClassType(),
247 "valid",
248 "Flags whether the data is valid or needs to be updated.\n",
249 ValidFieldId, ValidFieldMask,
250 true,
251 (Field::SFDefaultFlags | Field::FStdAccess),
252 static_cast<FieldEditMethodSig>(&DrawableStatsAttachment::editHandleValid),
253 static_cast<FieldGetMethodSig >(&DrawableStatsAttachment::getHandleValid));
255 oType.addInitialDesc(pDesc);
259 DrawableStatsAttachmentBase::TypeObject DrawableStatsAttachmentBase::_type(
260 DrawableStatsAttachmentBase::getClassname(),
261 Inherited::getClassname(),
262 "DrawableStatsAttachment",
263 nsOSG, //Namespace
264 reinterpret_cast<PrototypeCreateF>(&DrawableStatsAttachmentBase::createEmptyLocal),
265 reinterpret_cast<InitContainerF>(&DrawableStatsAttachment::initMethod),
266 reinterpret_cast<ExitContainerF>(&DrawableStatsAttachment::exitMethod),
267 reinterpret_cast<InitalInsertDescFunc>(
268 reinterpret_cast<void *>(&DrawableStatsAttachment::classDescInserter)),
269 false,
271 "<?xml version=\"1.0\"?>\n"
272 "\n"
273 "<FieldContainer\n"
274 " name=\"DrawableStatsAttachment\"\n"
275 " parent=\"StatsAttachment\"\n"
276 " library=\"System\"\n"
277 " pointerfieldtypes=\"both\"\n"
278 " structure=\"concrete\"\n"
279 " systemcomponent=\"true\"\n"
280 " parentsystemcomponent=\"true\"\n"
281 " decoratable=\"false\"\n"
282 " docGroupBase=\"GrpSystemNodeCoreDrawables\"\n"
283 " >\n"
284 "\n"
285 " The base class for drawable statistics.\n"
286 "\n"
287 " It is designed as an attachment so that it can be kept inside the graph. It\n"
288 " can also be used to keep aggregated information about subtrees, by adding up\n"
289 " the contributions of the underlying nodes. It can invalidate itself by using\n"
290 " changed callbacks, so that no manual bookkeeping is necessary.\n"
291 "\n"
292 " \\warning To use the automatic update you have to use the\n"
293 " OSG::GeoStatsAttachment::addTo() or OSG::GeoStatsAttachment::attachTo()\n"
294 " methods! Otherwise the necessary callbacks are not set!\n"
295 "\n"
296 " \\warning Before accessing the data OSG::GeoStatsAttachment::validate() needs\n"
297 " to be called to calculate and aggregate the results.\n"
298 "\n"
299 " <Field\n"
300 "\t name=\"vertices\"\n"
301 "\t type=\"UInt32\"\n"
302 "\t cardinality=\"single\"\n"
303 "\t visibility=\"external\"\n"
304 "\t access=\"public\"\n"
305 "\t >\n"
306 " The number of vertices in the subtree.\n"
307 " </Field>\n"
308 " <Field\n"
309 "\t name=\"points\"\n"
310 "\t type=\"UInt32\"\n"
311 "\t cardinality=\"single\"\n"
312 "\t visibility=\"external\"\n"
313 "\t access=\"public\"\n"
314 "\t >\n"
315 " The number of points in the subtree.\n"
316 " </Field>\n"
317 " <Field\n"
318 "\t name=\"lines\"\n"
319 "\t type=\"UInt32\"\n"
320 "\t cardinality=\"single\"\n"
321 "\t visibility=\"external\"\n"
322 "\t access=\"public\"\n"
323 "\t >\n"
324 " The number of lines in the subtree.\n"
325 " </Field>\n"
326 " <Field\n"
327 "\t name=\"triangles\"\n"
328 "\t type=\"UInt32\"\n"
329 "\t cardinality=\"single\"\n"
330 "\t visibility=\"external\"\n"
331 "\t access=\"public\"\n"
332 "\t >\n"
333 " The number of triangles in the subtree.\n"
334 " </Field>\n"
335 " <Field\n"
336 "\t name=\"patches\"\n"
337 "\t type=\"UInt32\"\n"
338 "\t cardinality=\"single\"\n"
339 "\t visibility=\"external\"\n"
340 "\t access=\"public\"\n"
341 "\t >\n"
342 " The number of lines in the subtree.\n"
343 " </Field>\n"
344 " <Field\n"
345 "\t name=\"processedAttributeBytes\"\n"
346 "\t type=\"UInt32\"\n"
347 "\t cardinality=\"single\"\n"
348 "\t visibility=\"external\"\n"
349 "\t access=\"public\"\n"
350 "\t >\n"
351 " The number of bytes in vertex attribute data that are processed while rendering.\n"
352 " </Field>\n"
353 " <Field\n"
354 "\t name=\"storedAttributeBytes\"\n"
355 "\t type=\"UInt32\"\n"
356 "\t cardinality=\"single\"\n"
357 "\t visibility=\"external\"\n"
358 "\t access=\"public\"\n"
359 "\t >\n"
360 " The number of bytes in vertex attribute data that are stored.\n"
361 " </Field>\n"
362 " <Field\n"
363 "\t name=\"valid\"\n"
364 "\t type=\"bool\"\n"
365 "\t cardinality=\"single\"\n"
366 "\t visibility=\"internal\"\n"
367 "\t access=\"public\"\n"
368 " defaultValue=\"false\"\n"
369 "\t >\n"
370 " Flags whether the data is valid or needs to be updated.\n"
371 " </Field>\n"
372 "</FieldContainer>\n",
373 "The base class for drawable statistics.\n"
374 "\n"
375 "It is designed as an attachment so that it can be kept inside the graph. It\n"
376 "can also be used to keep aggregated information about subtrees, by adding up\n"
377 "the contributions of the underlying nodes. It can invalidate itself by using\n"
378 "changed callbacks, so that no manual bookkeeping is necessary.\n"
379 "\n"
380 "\\warning To use the automatic update you have to use the\n"
381 "OSG::GeoStatsAttachment::addTo() or OSG::GeoStatsAttachment::attachTo()\n"
382 "methods! Otherwise the necessary callbacks are not set!\n"
383 "\n"
384 "\\warning Before accessing the data OSG::GeoStatsAttachment::validate() needs\n"
385 "to be called to calculate and aggregate the results.\n"
388 /*------------------------------ get -----------------------------------*/
390 FieldContainerType &DrawableStatsAttachmentBase::getType(void)
392 return _type;
395 const FieldContainerType &DrawableStatsAttachmentBase::getType(void) const
397 return _type;
400 UInt32 DrawableStatsAttachmentBase::getContainerSize(void) const
402 return sizeof(DrawableStatsAttachment);
405 /*------------------------- decorator get ------------------------------*/
408 SFUInt32 *DrawableStatsAttachmentBase::editSFVertices(void)
410 editSField(VerticesFieldMask);
412 return &_sfVertices;
415 const SFUInt32 *DrawableStatsAttachmentBase::getSFVertices(void) const
417 return &_sfVertices;
421 SFUInt32 *DrawableStatsAttachmentBase::editSFPoints(void)
423 editSField(PointsFieldMask);
425 return &_sfPoints;
428 const SFUInt32 *DrawableStatsAttachmentBase::getSFPoints(void) const
430 return &_sfPoints;
434 SFUInt32 *DrawableStatsAttachmentBase::editSFLines(void)
436 editSField(LinesFieldMask);
438 return &_sfLines;
441 const SFUInt32 *DrawableStatsAttachmentBase::getSFLines(void) const
443 return &_sfLines;
447 SFUInt32 *DrawableStatsAttachmentBase::editSFTriangles(void)
449 editSField(TrianglesFieldMask);
451 return &_sfTriangles;
454 const SFUInt32 *DrawableStatsAttachmentBase::getSFTriangles(void) const
456 return &_sfTriangles;
460 SFUInt32 *DrawableStatsAttachmentBase::editSFPatches(void)
462 editSField(PatchesFieldMask);
464 return &_sfPatches;
467 const SFUInt32 *DrawableStatsAttachmentBase::getSFPatches(void) const
469 return &_sfPatches;
473 SFUInt32 *DrawableStatsAttachmentBase::editSFProcessedAttributeBytes(void)
475 editSField(ProcessedAttributeBytesFieldMask);
477 return &_sfProcessedAttributeBytes;
480 const SFUInt32 *DrawableStatsAttachmentBase::getSFProcessedAttributeBytes(void) const
482 return &_sfProcessedAttributeBytes;
486 SFUInt32 *DrawableStatsAttachmentBase::editSFStoredAttributeBytes(void)
488 editSField(StoredAttributeBytesFieldMask);
490 return &_sfStoredAttributeBytes;
493 const SFUInt32 *DrawableStatsAttachmentBase::getSFStoredAttributeBytes(void) const
495 return &_sfStoredAttributeBytes;
499 SFBool *DrawableStatsAttachmentBase::editSFValid(void)
501 editSField(ValidFieldMask);
503 return &_sfValid;
506 const SFBool *DrawableStatsAttachmentBase::getSFValid(void) const
508 return &_sfValid;
516 /*------------------------------ access -----------------------------------*/
518 SizeT DrawableStatsAttachmentBase::getBinSize(ConstFieldMaskArg whichField)
520 SizeT returnValue = Inherited::getBinSize(whichField);
522 if(FieldBits::NoField != (VerticesFieldMask & whichField))
524 returnValue += _sfVertices.getBinSize();
526 if(FieldBits::NoField != (PointsFieldMask & whichField))
528 returnValue += _sfPoints.getBinSize();
530 if(FieldBits::NoField != (LinesFieldMask & whichField))
532 returnValue += _sfLines.getBinSize();
534 if(FieldBits::NoField != (TrianglesFieldMask & whichField))
536 returnValue += _sfTriangles.getBinSize();
538 if(FieldBits::NoField != (PatchesFieldMask & whichField))
540 returnValue += _sfPatches.getBinSize();
542 if(FieldBits::NoField != (ProcessedAttributeBytesFieldMask & whichField))
544 returnValue += _sfProcessedAttributeBytes.getBinSize();
546 if(FieldBits::NoField != (StoredAttributeBytesFieldMask & whichField))
548 returnValue += _sfStoredAttributeBytes.getBinSize();
550 if(FieldBits::NoField != (ValidFieldMask & whichField))
552 returnValue += _sfValid.getBinSize();
555 return returnValue;
558 void DrawableStatsAttachmentBase::copyToBin(BinaryDataHandler &pMem,
559 ConstFieldMaskArg whichField)
561 Inherited::copyToBin(pMem, whichField);
563 if(FieldBits::NoField != (VerticesFieldMask & whichField))
565 _sfVertices.copyToBin(pMem);
567 if(FieldBits::NoField != (PointsFieldMask & whichField))
569 _sfPoints.copyToBin(pMem);
571 if(FieldBits::NoField != (LinesFieldMask & whichField))
573 _sfLines.copyToBin(pMem);
575 if(FieldBits::NoField != (TrianglesFieldMask & whichField))
577 _sfTriangles.copyToBin(pMem);
579 if(FieldBits::NoField != (PatchesFieldMask & whichField))
581 _sfPatches.copyToBin(pMem);
583 if(FieldBits::NoField != (ProcessedAttributeBytesFieldMask & whichField))
585 _sfProcessedAttributeBytes.copyToBin(pMem);
587 if(FieldBits::NoField != (StoredAttributeBytesFieldMask & whichField))
589 _sfStoredAttributeBytes.copyToBin(pMem);
591 if(FieldBits::NoField != (ValidFieldMask & whichField))
593 _sfValid.copyToBin(pMem);
597 void DrawableStatsAttachmentBase::copyFromBin(BinaryDataHandler &pMem,
598 ConstFieldMaskArg whichField)
600 Inherited::copyFromBin(pMem, whichField);
602 if(FieldBits::NoField != (VerticesFieldMask & whichField))
604 editSField(VerticesFieldMask);
605 _sfVertices.copyFromBin(pMem);
607 if(FieldBits::NoField != (PointsFieldMask & whichField))
609 editSField(PointsFieldMask);
610 _sfPoints.copyFromBin(pMem);
612 if(FieldBits::NoField != (LinesFieldMask & whichField))
614 editSField(LinesFieldMask);
615 _sfLines.copyFromBin(pMem);
617 if(FieldBits::NoField != (TrianglesFieldMask & whichField))
619 editSField(TrianglesFieldMask);
620 _sfTriangles.copyFromBin(pMem);
622 if(FieldBits::NoField != (PatchesFieldMask & whichField))
624 editSField(PatchesFieldMask);
625 _sfPatches.copyFromBin(pMem);
627 if(FieldBits::NoField != (ProcessedAttributeBytesFieldMask & whichField))
629 editSField(ProcessedAttributeBytesFieldMask);
630 _sfProcessedAttributeBytes.copyFromBin(pMem);
632 if(FieldBits::NoField != (StoredAttributeBytesFieldMask & whichField))
634 editSField(StoredAttributeBytesFieldMask);
635 _sfStoredAttributeBytes.copyFromBin(pMem);
637 if(FieldBits::NoField != (ValidFieldMask & whichField))
639 editSField(ValidFieldMask);
640 _sfValid.copyFromBin(pMem);
644 //! create a new instance of the class
645 DrawableStatsAttachmentTransitPtr DrawableStatsAttachmentBase::createLocal(BitVector bFlags)
647 DrawableStatsAttachmentTransitPtr fc;
649 if(getClassType().getPrototype() != NULL)
651 FieldContainerTransitPtr tmpPtr =
652 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
654 fc = dynamic_pointer_cast<DrawableStatsAttachment>(tmpPtr);
657 return fc;
660 //! create a new instance of the class, copy the container flags
661 DrawableStatsAttachmentTransitPtr DrawableStatsAttachmentBase::createDependent(BitVector bFlags)
663 DrawableStatsAttachmentTransitPtr fc;
665 if(getClassType().getPrototype() != NULL)
667 FieldContainerTransitPtr tmpPtr =
668 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
670 fc = dynamic_pointer_cast<DrawableStatsAttachment>(tmpPtr);
673 return fc;
676 //! create a new instance of the class
677 DrawableStatsAttachmentTransitPtr DrawableStatsAttachmentBase::create(void)
679 DrawableStatsAttachmentTransitPtr fc;
681 if(getClassType().getPrototype() != NULL)
683 FieldContainerTransitPtr tmpPtr =
684 getClassType().getPrototype()-> shallowCopy();
686 fc = dynamic_pointer_cast<DrawableStatsAttachment>(tmpPtr);
689 return fc;
692 DrawableStatsAttachment *DrawableStatsAttachmentBase::createEmptyLocal(BitVector bFlags)
694 DrawableStatsAttachment *returnValue;
696 newPtr<DrawableStatsAttachment>(returnValue, bFlags);
698 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
700 return returnValue;
703 //! create an empty new instance of the class, do not copy the prototype
704 DrawableStatsAttachment *DrawableStatsAttachmentBase::createEmpty(void)
706 DrawableStatsAttachment *returnValue;
708 newPtr<DrawableStatsAttachment>(returnValue, Thread::getCurrentLocalFlags());
710 returnValue->_pFieldFlags->_bNamespaceMask &=
711 ~Thread::getCurrentLocalFlags();
713 return returnValue;
717 FieldContainerTransitPtr DrawableStatsAttachmentBase::shallowCopyLocal(
718 BitVector bFlags) const
720 DrawableStatsAttachment *tmpPtr;
722 newPtr(tmpPtr, dynamic_cast<const DrawableStatsAttachment *>(this), bFlags);
724 FieldContainerTransitPtr returnValue(tmpPtr);
726 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
728 return returnValue;
731 FieldContainerTransitPtr DrawableStatsAttachmentBase::shallowCopyDependent(
732 BitVector bFlags) const
734 DrawableStatsAttachment *tmpPtr;
736 newPtr(tmpPtr, dynamic_cast<const DrawableStatsAttachment *>(this), ~bFlags);
738 FieldContainerTransitPtr returnValue(tmpPtr);
740 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
742 return returnValue;
745 FieldContainerTransitPtr DrawableStatsAttachmentBase::shallowCopy(void) const
747 DrawableStatsAttachment *tmpPtr;
749 newPtr(tmpPtr,
750 dynamic_cast<const DrawableStatsAttachment *>(this),
751 Thread::getCurrentLocalFlags());
753 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
755 FieldContainerTransitPtr returnValue(tmpPtr);
757 return returnValue;
763 /*------------------------- constructors ----------------------------------*/
765 DrawableStatsAttachmentBase::DrawableStatsAttachmentBase(void) :
766 Inherited(),
767 _sfVertices (),
768 _sfPoints (),
769 _sfLines (),
770 _sfTriangles (),
771 _sfPatches (),
772 _sfProcessedAttributeBytes(),
773 _sfStoredAttributeBytes (),
774 _sfValid (bool(false))
778 DrawableStatsAttachmentBase::DrawableStatsAttachmentBase(const DrawableStatsAttachmentBase &source) :
779 Inherited(source),
780 _sfVertices (source._sfVertices ),
781 _sfPoints (source._sfPoints ),
782 _sfLines (source._sfLines ),
783 _sfTriangles (source._sfTriangles ),
784 _sfPatches (source._sfPatches ),
785 _sfProcessedAttributeBytes(source._sfProcessedAttributeBytes),
786 _sfStoredAttributeBytes (source._sfStoredAttributeBytes ),
787 _sfValid (source._sfValid )
792 /*-------------------------- destructors ----------------------------------*/
794 DrawableStatsAttachmentBase::~DrawableStatsAttachmentBase(void)
799 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandleVertices (void) const
801 SFUInt32::GetHandlePtr returnValue(
802 new SFUInt32::GetHandle(
803 &_sfVertices,
804 this->getType().getFieldDesc(VerticesFieldId),
805 const_cast<DrawableStatsAttachmentBase *>(this)));
807 return returnValue;
810 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandleVertices (void)
812 SFUInt32::EditHandlePtr returnValue(
813 new SFUInt32::EditHandle(
814 &_sfVertices,
815 this->getType().getFieldDesc(VerticesFieldId),
816 this));
819 editSField(VerticesFieldMask);
821 return returnValue;
824 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandlePoints (void) const
826 SFUInt32::GetHandlePtr returnValue(
827 new SFUInt32::GetHandle(
828 &_sfPoints,
829 this->getType().getFieldDesc(PointsFieldId),
830 const_cast<DrawableStatsAttachmentBase *>(this)));
832 return returnValue;
835 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandlePoints (void)
837 SFUInt32::EditHandlePtr returnValue(
838 new SFUInt32::EditHandle(
839 &_sfPoints,
840 this->getType().getFieldDesc(PointsFieldId),
841 this));
844 editSField(PointsFieldMask);
846 return returnValue;
849 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandleLines (void) const
851 SFUInt32::GetHandlePtr returnValue(
852 new SFUInt32::GetHandle(
853 &_sfLines,
854 this->getType().getFieldDesc(LinesFieldId),
855 const_cast<DrawableStatsAttachmentBase *>(this)));
857 return returnValue;
860 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandleLines (void)
862 SFUInt32::EditHandlePtr returnValue(
863 new SFUInt32::EditHandle(
864 &_sfLines,
865 this->getType().getFieldDesc(LinesFieldId),
866 this));
869 editSField(LinesFieldMask);
871 return returnValue;
874 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandleTriangles (void) const
876 SFUInt32::GetHandlePtr returnValue(
877 new SFUInt32::GetHandle(
878 &_sfTriangles,
879 this->getType().getFieldDesc(TrianglesFieldId),
880 const_cast<DrawableStatsAttachmentBase *>(this)));
882 return returnValue;
885 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandleTriangles (void)
887 SFUInt32::EditHandlePtr returnValue(
888 new SFUInt32::EditHandle(
889 &_sfTriangles,
890 this->getType().getFieldDesc(TrianglesFieldId),
891 this));
894 editSField(TrianglesFieldMask);
896 return returnValue;
899 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandlePatches (void) const
901 SFUInt32::GetHandlePtr returnValue(
902 new SFUInt32::GetHandle(
903 &_sfPatches,
904 this->getType().getFieldDesc(PatchesFieldId),
905 const_cast<DrawableStatsAttachmentBase *>(this)));
907 return returnValue;
910 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandlePatches (void)
912 SFUInt32::EditHandlePtr returnValue(
913 new SFUInt32::EditHandle(
914 &_sfPatches,
915 this->getType().getFieldDesc(PatchesFieldId),
916 this));
919 editSField(PatchesFieldMask);
921 return returnValue;
924 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandleProcessedAttributeBytes (void) const
926 SFUInt32::GetHandlePtr returnValue(
927 new SFUInt32::GetHandle(
928 &_sfProcessedAttributeBytes,
929 this->getType().getFieldDesc(ProcessedAttributeBytesFieldId),
930 const_cast<DrawableStatsAttachmentBase *>(this)));
932 return returnValue;
935 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandleProcessedAttributeBytes(void)
937 SFUInt32::EditHandlePtr returnValue(
938 new SFUInt32::EditHandle(
939 &_sfProcessedAttributeBytes,
940 this->getType().getFieldDesc(ProcessedAttributeBytesFieldId),
941 this));
944 editSField(ProcessedAttributeBytesFieldMask);
946 return returnValue;
949 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandleStoredAttributeBytes (void) const
951 SFUInt32::GetHandlePtr returnValue(
952 new SFUInt32::GetHandle(
953 &_sfStoredAttributeBytes,
954 this->getType().getFieldDesc(StoredAttributeBytesFieldId),
955 const_cast<DrawableStatsAttachmentBase *>(this)));
957 return returnValue;
960 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandleStoredAttributeBytes(void)
962 SFUInt32::EditHandlePtr returnValue(
963 new SFUInt32::EditHandle(
964 &_sfStoredAttributeBytes,
965 this->getType().getFieldDesc(StoredAttributeBytesFieldId),
966 this));
969 editSField(StoredAttributeBytesFieldMask);
971 return returnValue;
974 GetFieldHandlePtr DrawableStatsAttachmentBase::getHandleValid (void) const
976 SFBool::GetHandlePtr returnValue(
977 new SFBool::GetHandle(
978 &_sfValid,
979 this->getType().getFieldDesc(ValidFieldId),
980 const_cast<DrawableStatsAttachmentBase *>(this)));
982 return returnValue;
985 EditFieldHandlePtr DrawableStatsAttachmentBase::editHandleValid (void)
987 SFBool::EditHandlePtr returnValue(
988 new SFBool::EditHandle(
989 &_sfValid,
990 this->getType().getFieldDesc(ValidFieldId),
991 this));
994 editSField(ValidFieldMask);
996 return returnValue;
1000 #ifdef OSG_MT_CPTR_ASPECT
1001 void DrawableStatsAttachmentBase::execSyncV( FieldContainer &oFrom,
1002 ConstFieldMaskArg whichField,
1003 AspectOffsetStore &oOffsets,
1004 ConstFieldMaskArg syncMode,
1005 const UInt32 uiSyncInfo)
1007 DrawableStatsAttachment *pThis = static_cast<DrawableStatsAttachment *>(this);
1009 pThis->execSync(static_cast<DrawableStatsAttachment *>(&oFrom),
1010 whichField,
1011 oOffsets,
1012 syncMode,
1013 uiSyncInfo);
1015 #endif
1018 #ifdef OSG_MT_CPTR_ASPECT
1019 FieldContainer *DrawableStatsAttachmentBase::createAspectCopy(
1020 const FieldContainer *pRefAspect) const
1022 DrawableStatsAttachment *returnValue;
1024 newAspectCopy(returnValue,
1025 dynamic_cast<const DrawableStatsAttachment *>(pRefAspect),
1026 dynamic_cast<const DrawableStatsAttachment *>(this));
1028 return returnValue;
1030 #endif
1032 void DrawableStatsAttachmentBase::resolveLinks(void)
1034 Inherited::resolveLinks();
1040 OSG_END_NAMESPACE