changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / Statistics / OSGStatElemDesc.h
blob7a7d04f3aa78b6ca81a79a4c0c4be1c2d7945640
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 \*---------------------------------------------------------------------------*/
40 #ifndef _OSGSTATELEMDESC_H_
41 #define _OSGSTATELEMDESC_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGBaseTypes.h"
48 #include "string"
50 OSG_BEGIN_NAMESPACE
52 class StatElemCollector;
53 class StatElem;
55 /*! \brief Single Statistics element, see \ref PageSystemStatistics for
56 details.
57 \ingroup GrpBaseStatistics
58 \ingroup GrpLibOSGBase
59 \nohierarchy
62 class OSG_BASE_DLLMAPPING StatElemDescBase
64 /*========================== PUBLIC =================================*/
65 public:
67 /*---------------------------------------------------------------------*/
68 /*! \name Class */
69 /*! \{ */
71 static bool isValidID ( Int32 descId);
73 static StatElemDescBase *getDesc ( Int32 descId);
74 static StatElemDescBase *findDescByName(const Char8 *name );
75 static UInt32 getNumOfDescs ( void );
77 static void printAll ( void );
79 /*! \} */
80 /*---------------------------------------------------------------------*/
81 /*! \name Instance */
82 /*! \{ */
84 void print (void);
86 Int32 getID (void);
87 const std::string &getName (void);
88 const std::string &getDescription(void);
90 typedef enum {
91 RESET_NEVER = 0, //!< Never reset by the system
92 RESET_DRAW, //!< Reset when drawing
93 RESET_ALWAYS //!< Reset when StatCollector::reset is called
94 } ResetMode;
96 ResetMode getResetMode(void ) const;
98 /*! \} */
99 /*---------------------------------------------------------------------*/
100 /*! \name Constructors */
101 /*! \{ */
103 StatElemDescBase(const Char8 *name,
104 const Char8 *description,
105 ResetMode reset = RESET_DRAW);
107 /*! \} */
108 /*---------------------------------------------------------------------*/
109 /*! \name Destructor */
110 /*! \{ */
112 virtual ~StatElemDescBase(void);
114 /*! \} */
115 /*---------------------------------------------------------------------*/
116 /*! \name Comparison */
117 /*! \{ */
119 bool operator < (const StatElemDescBase &other) const;
121 /*! \} */
122 /*========================= PROTECTED ===============================*/
123 protected:
124 static bool terminate(void);
126 /*========================== PRIVATE ================================*/
127 private:
128 friend class StatCollector;
130 typedef std::vector<StatElemDescBase*> DescStorage;
132 static DescStorage *_descVec;
134 Int32 _id;
135 std::string _name;
136 std::string _description;
137 ResetMode _resetMode;
139 // only called by OSGStatCollector friend
140 virtual StatElem *createElem(void) = 0;
142 // prohibit default functions (move to 'public' if you need one)
143 StatElemDescBase(const StatElemDescBase &source);
144 StatElemDescBase &operator =(const StatElemDescBase &source);
147 /*! \brief Single Statistics element, see \ref PageSystemStatistics for
148 details.
149 \ingroup GrpBaseStatistics
150 \ingroup GrpLibOSGBase
151 \nohierarchy
154 template <class Type>
155 class StatElemDesc : public StatElemDescBase
157 /*========================== PUBLIC =================================*/
158 public:
160 /*---------------------------------------------------------------------*/
161 /*! \name Constructors */
162 /*! \{ */
164 StatElemDesc(const Char8 *name,
165 const Char8 *description,
166 ResetMode reset = RESET_DRAW);
168 /*! \} */
169 /*---------------------------------------------------------------------*/
170 /*! \name Destructor */
171 /*! \{ */
173 virtual ~StatElemDesc(void);
175 /*! \} */
176 /*========================= PROTECTED ===============================*/
177 protected:
179 /*========================== PRIVATE ================================*/
180 private:
182 virtual StatElem* createElem(void);
184 // prohibit default functions (move to 'public' if you need one)
185 StatElemDesc (const StatElemDesc &source);
186 StatElemDesc &operator =(const StatElemDesc &source);
189 typedef StatElemDescBase *StatElemDescBaseP;
191 OSG_END_NAMESPACE
193 #include "OSGStatElemDesc.inl"
195 #endif /* _OSGSTATELEMDESC_H_ */