00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 00040 #ifndef _STATINTONCEELEM_H_ 00041 #define _STATINTONCEELEM_H_ 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 00047 #include "OSGConfig.h" 00048 #include "OSGBaseTypes.h" 00049 #include "OSGSystemDef.h" 00050 00051 #include "OSGStatElem.h" 00052 00053 #include "OSGTime.h" 00054 00055 00056 #ifdef OSG_STL_HAS_HASH_MAP 00057 #ifdef OSG_HASH_MAP_AS_EXT 00058 #include <ext/hash_set> 00059 #else 00060 #include <hash_set> 00061 #endif 00062 #else 00063 #include <set> 00064 #endif 00065 00066 OSG_BEGIN_NAMESPACE 00067 00068 class StatElemDescBase; 00069 00072 class OSG_SYSTEMLIB_DLLMAPPING StatIntOnceElem : public StatElem 00073 { 00074 00075 /*========================== PUBLIC =================================*/ 00076 public: 00077 00078 #ifdef OSG_STL_HAS_HASH_MAP 00079 typedef OSG_STDEXTENSION_NAMESPACE::hash_set< UInt32 > IdHash; 00080 #else 00081 typedef std::set< UInt32 > IdHash; 00082 #endif 00083 00084 /*---------------------------------------------------------------------*/ 00088 static const char *getClassname(void) { return "StatIntOnceElem"; } 00089 00091 /*---------------------------------------------------------------------*/ 00095 static StatElem *create ( StatElemDescBase *desc ); 00096 00098 /*---------------------------------------------------------------------*/ 00102 virtual void reset (void); 00103 00104 inline void add (UInt32 id, Int32 v); 00105 00106 inline void sub (UInt32 id, Int32 v); 00107 00108 inline void inc (UInt32 id); 00109 00110 inline void dec (UInt32 id); 00111 00112 inline Int32 get (void) const; 00113 00114 virtual void putToString (std::string &str, 00115 const char *format = NULL) const; 00116 00117 virtual bool getFromString(const Char8 *&inVal); 00118 00119 virtual Real64 getValue (void) const; 00120 00122 /*---------------------------------------------------------------------*/ 00126 bool operator < (const StatIntOnceElem &other) const; 00127 00129 /*---------------------------------------------------------------------*/ 00133 virtual StatElem *clone(void) const; 00134 00137 /*========================= PROTECTED ===============================*/ 00138 protected: 00139 00140 /*---------------------------------------------------------------------*/ 00144 StatIntOnceElem(StatElemDescBase *desc); 00145 00146 virtual ~StatIntOnceElem(void); 00147 00149 /*========================= PRIVATE ===============================*/ 00150 private: 00151 00152 typedef StatElem Inherited; 00153 00154 Int32 _value; 00155 00156 IdHash _ids; 00157 00158 StatIntOnceElem (const StatIntOnceElem &source); 00159 00160 StatIntOnceElem& operator =(const StatIntOnceElem &source); 00161 }; 00162 00163 //--------------------------------------------------------------------------- 00164 // Exported Types 00165 //--------------------------------------------------------------------------- 00166 00167 // class pointer 00168 00169 typedef StatIntOnceElem *StatIntOnceElemP; 00170 00171 OSG_END_NAMESPACE 00172 00173 #include "OSGStatIntOnceElem.inl" 00174 00175 #define OSGSTATINTONCEELEM_HEADER_CVSID "@(#)$Id: OSGStatIntOnceElem.h,v 1.1 2005/07/26 19:12:07 dirk Exp $" 00176 00177 #endif /* _STATINTONCEELEM_H_ */
1.4.3