fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Base / Statistics / OSGStatIntOnceElem.h
blobfe25bbeab0138efa40c980904e4a2aee49e93965
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 \*---------------------------------------------------------------------------*/
39 #ifndef _STATINTONCEELEM_H_
40 #define _STATINTONCEELEM_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGStatElem.h"
47 #include "OSGTime.h"
49 #include "OSGDeprecatedCPP.h"
52 OSG_BEGIN_NAMESPACE
54 class StatElemDescBase;
56 /*! \brief Time Statistics element, see \ref PageSystemStatistics for details.
57 \ingroup GrpBaseStatistics
58 \ingroup GrpLibOSGBase
61 class OSG_BASE_DLLMAPPING StatIntOnceElem : public StatElem
64 /*========================== PUBLIC =================================*/
66 public:
68 typedef OSG_HASH_SET(UInt32) IdHash;
70 /*---------------------------------------------------------------------*/
71 /*! \name your_category */
72 /*! \{ */
74 static StatElem *create(StatElemDescBase *desc);
76 /*! \} */
77 /*---------------------------------------------------------------------*/
78 /*! \name instance */
79 /*! \{ */
81 virtual void reset(void );
83 void add (UInt32 contributorId,
84 Int64 v );
85 void sub (UInt32 contributorId,
86 Int64 v );
88 void inc (UInt32 contributorId);
89 void dec (UInt32 contributorId);
91 Int64 get (void ) const;
93 /*! \} */
94 /*---------------------------------------------------------------------*/
95 /*! \name instance */
96 /*! \{ */
98 virtual void putToString ( std::string & str,
99 const std::string &format = std::string()) const;
101 virtual bool getFromCString(const Char8 *&inVal );
103 virtual Real64 getValue ( void ) const;
105 /*! \} */
106 /*---------------------------------------------------------------------*/
107 /*! \name comparison */
108 /*! \{ */
110 bool operator < (const StatIntOnceElem &other) const;
112 /*! \} */
113 /*---------------------------------------------------------------------*/
114 /*! \name Creation */
115 /*! \{ */
117 virtual StatElem *clone(void) const;
119 /*! \} */
120 /*---------------------------------------------------------------------*/
121 /*! \name Operators */
122 /*! \{ */
124 virtual StatElem &operator += (const StatElem &other);
126 /*! \} */
127 /*========================= PROTECTED ===============================*/
129 protected:
131 /*---------------------------------------------------------------------*/
132 /*! \name Constructors */
133 /*! \{ */
135 StatIntOnceElem(StatElemDescBase *desc);
137 virtual ~StatIntOnceElem(void);
139 /*! \} */
140 /*========================= PRIVATE ===============================*/
141 private:
143 typedef StatElem Inherited;
145 Int64 _value;
147 IdHash _ids;
149 // prohibit default functions (move to 'public' if you need one)
150 StatIntOnceElem (const StatIntOnceElem &source);
151 StatIntOnceElem& operator =(const StatIntOnceElem &source);
154 //---------------------------------------------------------------------------
155 // Exported Types
156 //---------------------------------------------------------------------------
158 typedef StatIntOnceElem *StatIntOnceElemP;
160 OSG_END_NAMESPACE
162 #include "OSGStatIntOnceElem.inl"
164 #endif /* _STATINTONCEELEM_H_ */