1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 \*---------------------------------------------------------------------------*/
40 #ifndef _OSGSTATELEMDESC_H_
41 #define _OSGSTATELEMDESC_H_
46 #include "OSGBaseTypes.h"
52 class StatElemCollector
;
55 /*! \brief Single Statistics element, see \ref PageSystemStatistics for
57 \ingroup GrpBaseStatistics
58 \ingroup GrpLibOSGBase
62 class OSG_BASE_DLLMAPPING StatElemDescBase
64 /*========================== PUBLIC =================================*/
67 /*---------------------------------------------------------------------*/
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 );
80 /*---------------------------------------------------------------------*/
87 const std::string
&getName (void);
88 const std::string
&getDescription(void);
91 RESET_NEVER
= 0, //!< Never reset by the system
92 RESET_DRAW
, //!< Reset when drawing
93 RESET_ALWAYS
//!< Reset when StatCollector::reset is called
96 ResetMode
getResetMode(void ) const;
99 /*---------------------------------------------------------------------*/
100 /*! \name Constructors */
103 StatElemDescBase(const Char8
*name
,
104 const Char8
*description
,
105 ResetMode reset
= RESET_DRAW
);
108 /*---------------------------------------------------------------------*/
109 /*! \name Destructor */
112 virtual ~StatElemDescBase(void);
115 /*---------------------------------------------------------------------*/
116 /*! \name Comparison */
119 bool operator < (const StatElemDescBase
&other
) const;
122 /*========================= PROTECTED ===============================*/
124 static bool terminate(void);
126 /*========================== PRIVATE ================================*/
128 friend class StatCollector
;
130 typedef std::vector
<StatElemDescBase
*> DescStorage
;
132 static DescStorage
*_descVec
;
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
149 \ingroup GrpBaseStatistics
150 \ingroup GrpLibOSGBase
154 template <class Type
>
155 class StatElemDesc
: public StatElemDescBase
157 /*========================== PUBLIC =================================*/
160 /*---------------------------------------------------------------------*/
161 /*! \name Constructors */
164 StatElemDesc(const Char8
*name
,
165 const Char8
*description
,
166 ResetMode reset
= RESET_DRAW
);
169 /*---------------------------------------------------------------------*/
170 /*! \name Destructor */
173 virtual ~StatElemDesc(void);
176 /*========================= PROTECTED ===============================*/
179 /*========================== 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
;
193 #include "OSGStatElemDesc.inl"
195 #endif /* _OSGSTATELEMDESC_H_ */