Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGStatCollector.h

Go to the documentation of this file.
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 _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     /*==========================  PUBLIC  =================================*/
00067   public:
00068 
00069     /*---------------------------------------------------------------------*/
00073     static const char *getClassname(void) { return "StatCollector"; }
00074 
00076     /*---------------------------------------------------------------------*/
00081     inline  UInt32   getNumOfElems (void);
00082 
00083             void     refitElemNum  (void);
00084 
00085             void     clearElems    (void);
00086 
00087     inline  bool     isValidID     (Int32 id);
00088 
00089             void     reset         (void);
00090 
00091     inline  StatElem *getElem      (Int32 id, bool create = true);
00092 
00093     inline  StatElem *getElem      (StatElemDescBase &desc, bool create = true);
00094 
00095 
00096     template <class T> 
00097     inline  T        *getElem      (StatElemDesc<T> &desc, bool create = true);
00098 
00099 
00100             void      putToString  (std::string &outVal) const;
00101      
00102             bool      getFromString(const Char8 *&inVal);
00103 
00104             bool      getValue     (std::string &name, Real64 &val);
00105             
00107     /*---------------------------------------------------------------------*/
00111     StatCollector(void);
00112 
00113     StatCollector(const StatCollector &source);
00114 
00115     static StatCollector *create(void);
00116 
00117     StatCollector& operator =(const StatCollector &source);
00118 
00120     /*---------------------------------------------------------------------*/
00124     virtual ~StatCollector(void);
00125 
00127     /*---------------------------------------------------------------------*/
00131          bool operator <  (const StatCollector &other) const;
00132 
00135     /*=========================  PROTECTED  ===============================*/
00136   protected:
00137 
00138     /*==========================  PRIVATE  ================================*/
00139   private:
00140 
00141     std::vector<StatElem*> _elemVec;
00142 };
00143 
00144 typedef StatCollector *StatCollectorP;
00145 
00146 
00147 #if !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
00148 
00151 #if !defined(OSG_DOC_DEV_TRAITS)
00152 
00153 #endif
00154 
00155 template <>
00156 struct FieldDataTraits<StatCollector> : 
00157     public FieldTraitsRecurseBase<StatCollector>
00158 {
00159     static DataType       _type;
00160 
00161     enum                  { StringConvertable = ToStringConvertable | 
00162                                                 FromStringConvertable    };
00163 
00164     static DataType       &getType      (void) { return _type;          }
00165 
00166     static Char8          *getSName     (void) { return "SFStatCollector"; }
00167     static Char8          *getMName     (void) { return "MFStatCollector"; }
00168 
00169     static StatCollector getDefault   (void) { return StatCollector();   }
00170 
00171     static bool            getFromString(      StatCollector  &outVal,
00172                                          const Char8         *&inVal)
00173     {
00174         return outVal.getFromString(inVal);
00175     }
00176 
00177     static void            putToString  (const StatCollector &inVal,
00178                                                std::string   &outVal)
00179     {
00180         inVal.putToString(outVal);
00181     }
00182 
00183 };
00184 
00185 #if !defined(OSG_DOC_DEV_TRAITS)
00186 
00188 #endif
00189 
00190 #endif // !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
00191 
00192 
00193 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_FIELD_TYPEDEFS) 
00194 
00196 typedef SField<StatCollector> SFStatCollector;
00197 #endif
00198 
00199 #ifndef OSG_COMPILESTATCOLLECTORINST
00200 OSG_DLLEXPORT_DECL1(SField, StatCollector, OSG_SYSTEMLIB_DLLTMPLMAPPING)
00201 #endif
00202 
00203 
00204 OSG_END_NAMESPACE
00205 
00206 #include <OSGStatCollector.inl>
00207 
00208 #define OSGSTATCOLLECTOR_HEADER_CVSID "@(#)$Id:$"
00209 
00210 #endif /* _OSGSTATCOLLECTOR_H_ */

Generated on Thu Aug 25 04:10:38 2005 for OpenSG by  doxygen 1.4.3