osg::StatElem Class Reference

Single Statistics element, see Statistics for details. More...

#include <OSGStatElem.h>

Inheritance diagram for osg::StatElem:

osg::StatIntElem osg::StatIntOnceElem osg::StatRealElem osg::StatStringElem osg::StatTimeElem osg::StatTimeStampElem

List of all members.

Public Member Functions

Instance


bool isOn (void) const
void setOn (bool on)
StatElemDescBasegetDesc (void) const
virtual void putToString (std::string &str, const char *format=NULL) const =0
virtual bool getFromString (const Char8 *&inVal)=0
virtual Real64 getValue (void) const =0
virtual void reset (void)=0
Destructor


virtual ~StatElem (void)
Comparison


bool operator< (const StatElem &other) const
Creation


virtual StatElemclone (void) const =0
Operators


virtual StatElemoperator+= (const StatElem &other)=0

Static Public Member Functions

Class Get


static const char * getClassname (void)

Protected Member Functions

 StatElem (StatElemDescBase *desc)

Private Member Functions

 StatElem (const StatElem &source)
StatElemoperator= (const StatElem &source)

Private Attributes

bool _on
StatElemDescBase_desc


Detailed Description

The StatElem is the abstract base class for all the data types that can be recorded statistically. See Statistics for an overview of the statistics structure.

It mainly provides the general interfaces for accessing the statistics data as a Real64 value via getValue, if possible, and in ASCII via the putToString and getFromString methods. Additionally every StatElem can be switched on or off, to prevent collecting statistics that is not needed, via the setOn methods. Finally, ever StatElem can give information about itself in the form of a osg::StatElemDesc*.

/ext

To add a new StatElem type the given interface has to be implemented. There are no restrictions as to which types are possible, as long as they can be converted to and from a string. See StatIntElem for a simple example.

/endext

Definition at line 57 of file OSGStatElem.h.


Constructor & Destructor Documentation

StatElem::~StatElem ( void   )  [virtual]

Definition at line 109 of file OSGStatElem.cpp.

00110 {
00111 }

StatElem::StatElem ( StatElemDescBase desc  )  [protected]

Definition at line 103 of file OSGStatElem.cpp.

00104   : _on(true),_desc(desc)
00105 {
00106   ;
00107 }

osg::StatElem::StatElem ( const StatElem source  )  [private]


Member Function Documentation

static const char* osg::StatElem::getClassname ( void   )  [inline, static]

Reimplemented in osg::StatIntElem, osg::StatIntOnceElem, osg::StatRealElem, osg::StatStringElem, osg::StatTimeElem, and osg::StatTimeStampElem.

Definition at line 66 of file OSGStatElem.h.

00066 { return "StatElem"; }

bool osg::StatElem::isOn ( void   )  const [inline]

Definition at line 41 of file OSGStatElem.inl.

References _on.

00042 { 
00043     return _on; 
00044 }

void osg::StatElem::setOn ( bool  on  )  [inline]

Definition at line 46 of file OSGStatElem.inl.

References _on.

00047 { 
00048     _on = on; 
00049 }

StatElemDescBase * osg::StatElem::getDesc ( void   )  const [inline]

void osg::StatElem::putToString ( std::string &  str,
const char *  format = NULL 
) const [pure virtual]

The putToString method converts the value of the StatElem into a standard STL string.

The conversion can be parameterized by the format string parameter. It is modelled after the printf()-format string. It typically should contain a single "%" value to format the contents of the StatElem.

Implemented in osg::StatIntElem, osg::StatIntOnceElem, osg::StatRealElem, osg::StatStringElem, osg::StatTimeElem, and osg::StatTimeStampElem.

Referenced by osg::SimpleStatisticsForeground::draw().

virtual bool osg::StatElem::getFromString ( const Char8 *&  inVal  )  [pure virtual]

virtual Real64 osg::StatElem::getValue ( void   )  const [pure virtual]

virtual void osg::StatElem::reset ( void   )  [pure virtual]

bool StatElem::operator< ( const StatElem other  )  const

Comparison. This does not compare the actual values of the StatElem, as that may not be possible for all types.

Definition at line 134 of file OSGStatElem.cpp.

00135 {
00136     return this < &other;
00137 }

virtual StatElem* osg::StatElem::clone ( void   )  const [pure virtual]

virtual StatElem& osg::StatElem::operator+= ( const StatElem other  )  [pure virtual]

StatElem & StatElem::operator= ( const StatElem source  )  [private]

Definition at line 115 of file OSGStatElem.cpp.

References _desc, and _on.

00116 {
00117     if (this == &source)
00118         return *this;
00119         
00120     // copy 
00121 
00122     _on = source._on;
00123     _desc = source._desc;
00124     
00125     return *this;
00126 }


Member Data Documentation

bool osg::StatElem::_on [private]

Definition at line 124 of file OSGStatElem.h.

Referenced by isOn(), operator=(), and setOn().

Definition at line 126 of file OSGStatElem.h.

Referenced by getDesc(), and operator=().


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:15:08 2008 for OpenSG by  doxygen 1.5.5