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 _OSGSTATELEMDESC_H_ 00041 #define _OSGSTATELEMDESC_H_ 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 #include <OSGBaseTypes.h> 00047 #include <OSGSystemDef.h> 00048 00049 #include <OSGIDString.h> 00050 00051 OSG_BEGIN_NAMESPACE 00052 00053 class StatElemCollector; 00054 class StatElem; 00055 00062 class OSG_SYSTEMLIB_DLLMAPPING StatElemDescBase 00063 { 00064 friend class StatCollector; 00065 00066 /*========================== PUBLIC =================================*/ 00067 public: 00068 00069 /*---------------------------------------------------------------------*/ 00073 inline static bool isValidID (Int32 id); 00074 00075 inline static StatElemDescBase *getDesc (Int32 id); 00076 00077 static StatElemDescBase *findDescByName (const Char8 *name); 00078 00079 inline static Int32 getNumOfDescs(void); 00080 00081 inline static const Char8 *getClassname(void); 00082 00083 static void printAll (void); 00084 00085 void print(void); 00086 00087 inline Int32 getID(void); 00088 00089 inline const IDString &getName(void); 00090 00091 inline const IDString &getDescription (void); 00092 00094 /*---------------------------------------------------------------------*/ 00098 StatElemDescBase( const Char8 *name, const Char8 *description); 00099 00101 /*---------------------------------------------------------------------*/ 00105 virtual ~StatElemDescBase(void); 00106 00108 /*---------------------------------------------------------------------*/ 00112 bool operator < (const StatElemDescBase &other) const; 00113 00114 //OSGbool operator == (const CLASSNAME &other) const; 00115 //OSGbool operator != (const CLASSNAME &other) const; 00116 00118 /*========================= PROTECTED ===============================*/ 00119 protected: 00120 00121 00122 /*========================== PRIVATE ================================*/ 00123 private: 00124 00125 00126 // typedef PARENTCLASS Inherited; 00127 00128 static std::vector<StatElemDescBase*> *_descVec; 00129 00130 static char cvsid[]; 00131 00132 00133 Int32 _id; 00134 00135 IDString _name; 00136 00137 IDString _description; 00138 00139 // prohibit default functions (move to 'public' if you need one) 00140 00141 // only called by OSGStatCollector friend 00142 virtual StatElem* createElem(void) = 0; 00143 00144 StatElemDescBase (const StatElemDescBase &source); 00145 StatElemDescBase& operator =(const StatElemDescBase &source); 00146 00147 }; 00148 00149 template <class Type> 00150 class StatElemDesc : public StatElemDescBase 00151 { 00152 /*========================== PUBLIC =================================*/ 00153 public: 00154 00155 /*---------------------------------------------------------------------*/ 00159 StatElemDesc( const Char8 *name, const Char8 *description ); 00160 00162 /*---------------------------------------------------------------------*/ 00166 virtual ~StatElemDesc(void); 00167 00169 /*========================= PROTECTED ===============================*/ 00170 protected: 00171 00172 00173 /*========================== PRIVATE ================================*/ 00174 private: 00175 00176 00177 // typedef PARENTCLASS Inherited; 00178 00179 static char cvsid[]; 00180 00181 virtual StatElem* createElem(void); 00182 00183 StatElemDesc (const StatElemDesc &source); 00184 StatElemDesc& operator =(const StatElemDesc &source); 00185 }; 00186 00187 typedef StatElemDescBase *StatElemDescBaseP; 00188 00189 OSG_END_NAMESPACE 00190 00191 #include <OSGStatElemDesc.inl> 00192 00193 #define OSGSTATELEMDESC_HEADER_CVSID "@(#)$Id: $" 00194 00195 #endif /* _OSGSTATELEMDESC_H_ */
1.4.3