osg::StatRealElem Class Reference
[Statistics]

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

#include <OSGStatRealElem.h>

Inheritance diagram for osg::StatRealElem:

osg::StatElem

List of all members.

Public Member Functions

instance


void set (Real32 value)
Real32 get (void) const
void add (Real32 v)
void sub (Real32 v)
virtual void reset (void)
virtual void putToString (std::string &str, const char *format=NULL) const
virtual bool getFromString (const Char8 *&inVal)
virtual Real64 getValue (void) const
comparison


bool operator< (const StatRealElem &other) const
Creation


virtual StatElemclone (void) const
Operators


virtual StatElemoperator+= (const StatElem &other)
Instance


bool isOn (void) const
void setOn (bool on)
StatElemDescBasegetDesc (void) const
Comparison


bool operator< (const StatElem &other) const

Static Public Member Functions

Class Get


static const char * getClassname (void)
your_category


static StatElemcreate (StatElemDescBase *desc)

Protected Member Functions

Constructors


 StatRealElem (StatElemDescBase *desc)
virtual ~StatRealElem (void)

Private Types

typedef StatElem Inherited

Private Member Functions

 StatRealElem (const StatRealElem &source)
StatRealElemoperator= (const StatRealElem &source)

Private Attributes

Real32 _value


Detailed Description

The StatIntElem keeps an Real32 value, see Statistics for details.

Definition at line 59 of file OSGStatRealElem.h.


Member Typedef Documentation

Definition at line 138 of file OSGStatRealElem.h.


Constructor & Destructor Documentation

StatRealElem::StatRealElem ( StatElemDescBase desc  )  [protected]

Definition at line 71 of file OSGStatRealElem.cpp.

Referenced by clone(), and create().

00072   : StatElem(desc), _value(0)
00073 {
00074 }

StatRealElem::~StatRealElem ( void   )  [protected, virtual]

Definition at line 81 of file OSGStatRealElem.cpp.

00082 {
00083 }

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


Member Function Documentation

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

Reimplemented from osg::StatElem.

Definition at line 69 of file OSGStatRealElem.h.

00069 { return "StatRealElem"; }

StatElem * StatRealElem::create ( StatElemDescBase desc  )  [static]

Definition at line 76 of file OSGStatRealElem.cpp.

References StatRealElem().

00077 {
00078     return new StatRealElem(desc);
00079 }

void osg::StatRealElem::set ( Real32  value  )  [inline]

Definition at line 41 of file OSGStatRealElem.inl.

References _value.

00042 { 
00043     _value = value; 
00044 }

Real32 osg::StatRealElem::get ( void   )  const [inline]

Definition at line 46 of file OSGStatRealElem.inl.

References _value.

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

00047 { 
00048     return _value; 
00049 }

void osg::StatRealElem::add ( Real32  v  )  [inline]

Definition at line 51 of file OSGStatRealElem.inl.

References _value.

00052 { 
00053     _value += v; 
00054 }

void osg::StatRealElem::sub ( Real32  v  )  [inline]

Definition at line 56 of file OSGStatRealElem.inl.

References _value.

00057 { 
00058     _value -= v; 
00059 }

void StatRealElem::reset ( void   )  [virtual]

Implements osg::StatElem.

Definition at line 113 of file OSGStatRealElem.cpp.

References _value.

00114 { 
00115     _value = 0; 
00116 }

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

Implements osg::StatElem.

Definition at line 87 of file OSGStatRealElem.cpp.

References _value.

00088 {
00089     if(!format)
00090     {
00091         FieldDataTraits<Real32>::putToString(_value, str);
00092     }
00093     else
00094     {
00095         char *temp = new char [strlen(format) + 40];
00096         sprintf(temp, format, _value);
00097         str = temp;
00098         delete [] temp;
00099     }
00100 }

bool StatRealElem::getFromString ( const Char8 *&  inVal  )  [virtual]

Implements osg::StatElem.

Definition at line 102 of file OSGStatRealElem.cpp.

References _value.

00103 {
00104     return FieldDataTraits<Real32>::getFromString(_value, inVal);
00105 }

Real64 StatRealElem::getValue ( void   )  const [virtual]

Implements osg::StatElem.

Definition at line 107 of file OSGStatRealElem.cpp.

00108 {
00109     return static_cast<Real64>(get());
00110 }

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

Definition at line 132 of file OSGStatRealElem.cpp.

References get().

00133 {
00134     return this->get() < other.get();
00135 }

StatElem * StatRealElem::clone ( void   )  const [virtual]

Implements osg::StatElem.

Definition at line 139 of file OSGStatRealElem.cpp.

References osg::StatElem::getDesc(), and StatRealElem().

00140 {
00141     StatRealElem *e = new StatRealElem(getDesc());
00142     
00143     *e = *this;
00144     
00145     return e;
00146 }

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

Implements osg::StatElem.

Definition at line 150 of file OSGStatRealElem.cpp.

References _value.

00151 {
00152     const StatRealElem *o = dynamic_cast<const StatRealElem *>(&other);
00153     
00154     _value += o->_value;
00155     
00156     return *this;
00157 }

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

Definition at line 120 of file OSGStatRealElem.cpp.

References get().

00121 {
00122     if (this == &source)
00123         return *this;
00124 
00125     set(source.get());
00126     
00127     return *this;
00128 }

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

Definition at line 41 of file OSGStatElem.inl.

References osg::StatElem::_on.

00042 { 
00043     return _on; 
00044 }

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

Definition at line 46 of file OSGStatElem.inl.

References osg::StatElem::_on.

00047 { 
00048     _on = on; 
00049 }

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

bool StatElem::operator< ( const StatElem other  )  const [inherited]

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 }


Member Data Documentation

Definition at line 140 of file OSGStatRealElem.h.

Referenced by add(), get(), getFromString(), operator+=(), putToString(), reset(), set(), and sub().


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

Generated on Mon Mar 17 11:20:22 2008 for OpenSG by  doxygen 1.5.5