osg::StatIntElem Class Reference
[Statistics]

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

#include <OSGStatIntElem.h>

Inheritance diagram for osg::StatIntElem:

osg::StatElem

List of all members.

Public Member Functions

instance


void set (Int32 value)
Int32 get (void) const
void add (Int32 v)
void sub (Int32 v)
virtual void reset (void)
void inc (void)
void dec (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 StatIntElem &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


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

Private Types

typedef StatElem Inherited

Private Member Functions

 StatIntElem (const StatIntElem &source)
StatIntElemoperator= (const StatIntElem &source)

Private Attributes

Int32 _value


Detailed Description

The StatIntElem keeps an Int32 counter, see Statistics for details.

Definition at line 57 of file OSGStatIntElem.h.


Member Typedef Documentation

Definition at line 140 of file OSGStatIntElem.h.


Constructor & Destructor Documentation

StatIntElem::StatIntElem ( StatElemDescBase desc  )  [protected]

Definition at line 71 of file OSGStatIntElem.cpp.

Referenced by clone(), and create().

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

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

Definition at line 81 of file OSGStatIntElem.cpp.

00082 {
00083 }

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


Member Function Documentation

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

Reimplemented from osg::StatElem.

Definition at line 67 of file OSGStatIntElem.h.

00067 { return "StatIntElem"; }

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

Definition at line 76 of file OSGStatIntElem.cpp.

References StatIntElem().

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

void osg::StatIntElem::set ( Int32  value  )  [inline]

Definition at line 41 of file OSGStatIntElem.inl.

References _value.

00042 { 
00043     _value = value; 
00044 }

Int32 osg::StatIntElem::get ( void   )  const [inline]

Definition at line 46 of file OSGStatIntElem.inl.

References _value.

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

00047 { 
00048     return _value; 
00049 }

void osg::StatIntElem::add ( Int32  v  )  [inline]

Definition at line 51 of file OSGStatIntElem.inl.

References _value.

Referenced by osg::Slices::drawPrimitives(), and osg::Geometry::drawPrimitives().

00052 { 
00053     _value += v; 
00054 }

void osg::StatIntElem::sub ( Int32  v  )  [inline]

Definition at line 56 of file OSGStatIntElem.inl.

References _value.

00057 { 
00058     _value -= v; 
00059 }

void StatIntElem::reset ( void   )  [virtual]

Implements osg::StatElem.

Definition at line 113 of file OSGStatIntElem.cpp.

References _value.

00114 { 
00115     _value = 0; 
00116 }

void osg::StatIntElem::inc ( void   )  [inline]

Definition at line 61 of file OSGStatIntElem.inl.

References _value.

00062 { 
00063     _value++; 
00064 }

void osg::StatIntElem::dec ( void   )  [inline]

Definition at line 66 of file OSGStatIntElem.inl.

References _value.

00067 { 
00068     _value--; 
00069 }

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

Implements osg::StatElem.

Definition at line 87 of file OSGStatIntElem.cpp.

References _value.

00088 {
00089     if(!format)
00090     {
00091         FieldDataTraits<Int32>::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 StatIntElem::getFromString ( const Char8 *&  inVal  )  [virtual]

Implements osg::StatElem.

Definition at line 102 of file OSGStatIntElem.cpp.

References _value.

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

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

Implements osg::StatElem.

Definition at line 107 of file OSGStatIntElem.cpp.

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

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

Definition at line 132 of file OSGStatIntElem.cpp.

References get().

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

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

Implements osg::StatElem.

Definition at line 139 of file OSGStatIntElem.cpp.

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

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

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

Implements osg::StatElem.

Definition at line 150 of file OSGStatIntElem.cpp.

References _value.

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

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

Definition at line 120 of file OSGStatIntElem.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 142 of file OSGStatIntElem.h.

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


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

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