00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _OSGSTATCOLLECTOR_H_
00041 #define _OSGSTATCOLLECTOR_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045
00046 #include <OSGConfig.h>
00047 #include <OSGSystemDef.h>
00048
00049 #include <OSGBaseTypes.h>
00050 #include <OSGFieldDataType.h>
00051 #include <OSGSField.h>
00052 #include <OSGMField.h>
00053
00054 #include <OSGStatElemDesc.h>
00055
00056 OSG_BEGIN_NAMESPACE
00057
00058 class StatElem;
00059 class StatElemDescBase;
00060
00063 class OSG_SYSTEMLIB_DLLMAPPING StatCollector
00064 {
00065
00066
00067 public:
00068
00069
00073 static const char *getClassname(void) { return "StatCollector"; }
00074
00076
00081 inline UInt32 getNumOfElems (void) const;
00082
00083 void refitElemNum (void);
00084
00085 void clearElems (void);
00086
00087 inline bool isValidID (Int32 elemId) const;
00088
00089 void reset (void);
00090
00091 inline StatElem *getElem (Int32 elemId) const;
00092
00093 inline StatElem *getElem (Int32 elemId, bool create = true);
00094
00095 inline StatElem *getElem (StatElemDescBase &desc, bool create = true);
00096
00097
00098 template <class T>
00099 inline T *getElem (StatElemDesc<T> &desc, bool create = true);
00100
00101
00102 void putToString (std::string &outVal) const;
00103
00104 bool getFromString(const Char8 *&inVal);
00105
00106 bool getValue (std::string &name, Real64 &val);
00107
00109
00113 StatCollector(void);
00114
00115 StatCollector(const StatCollector &source);
00116
00117 static StatCollector *create(void);
00118
00119 const StatCollector& operator =(const StatCollector &source);
00120
00122
00126 virtual ~StatCollector(void);
00127
00129
00133 bool operator < (const StatCollector &other) const;
00134
00136
00140 StatCollector operator + (const StatCollector &other);
00141 StatCollector &operator += (const StatCollector &other);
00142
00145
00146 protected:
00147
00148
00149 private:
00150
00151 std::vector<StatElem*> _elemVec;
00152 };
00153
00154 typedef StatCollector *StatCollectorP;
00155
00156
00157 #if !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
00158
00161 #if !defined(OSG_DOC_DEV_TRAITS)
00162
00163 #endif
00164
00165 template <>
00166 struct FieldDataTraits<StatCollector> :
00167 public FieldTraitsRecurseBase<StatCollector>
00168 {
00169 static DataType _type;
00170
00171 enum { StringConvertable = ToStringConvertable |
00172 FromStringConvertable };
00173
00174 static DataType &getType (void) { return _type; }
00175
00176 static Char8 *getSName (void) { return "SFStatCollector"; }
00177 static Char8 *getMName (void) { return "MFStatCollector"; }
00178
00179 static StatCollector getDefault (void) { return StatCollector(); }
00180
00181 static bool getFromString( StatCollector &outVal,
00182 const Char8 *&inVal)
00183 {
00184 return outVal.getFromString(inVal);
00185 }
00186
00187 static void putToString (const StatCollector &inVal,
00188 std::string &outVal)
00189 {
00190 inVal.putToString(outVal);
00191 }
00192
00193 };
00194
00195 #if !defined(OSG_DOC_DEV_TRAITS)
00196
00198 #endif
00199
00200 #endif // !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
00201
00202
00203 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_FIELD_TYPEDEFS)
00204
00206 typedef SField<StatCollector> SFStatCollector;
00207 #endif
00208
00209 #ifndef OSG_COMPILESTATCOLLECTORINST
00210 OSG_DLLEXPORT_DECL1(SField, StatCollector, OSG_SYSTEMLIB_DLLTMPLMAPPING)
00211 #endif
00212
00213
00214 OSG_END_NAMESPACE
00215
00216 #include <OSGStatCollector.inl>
00217
00218 #define OSGSTATCOLLECTOR_HEADER_CVSID "@(#)$Id:$"
00219
00220 #endif