osg::StatStringElem Class Reference
[Statistics]

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

#include <OSGStatStringElem.h>

Inheritance diagram for osg::StatStringElem:

osg::StatElem

List of all members.

Public Member Functions

instance


const std::string & get (void) const
void set (const std::string &value)
void set (const Char8 *value)
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 StatStringElem &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


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

Private Types

typedef StatElem Inherited

Private Member Functions

 StatStringElem (const StatStringElem &source)
StatStringElemoperator= (const StatStringElem &source)

Private Attributes

std::string _value


Detailed Description

The StatIntElem keeps a std::string for messages, states or status information, see Statistics for details.

Definition at line 57 of file OSGStatStringElem.h.


Member Typedef Documentation

Definition at line 134 of file OSGStatStringElem.h.


Constructor & Destructor Documentation

StatStringElem::StatStringElem ( StatElemDescBase desc  )  [protected]

Definition at line 71 of file OSGStatStringElem.cpp.

Referenced by clone(), and create().

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

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

Definition at line 81 of file OSGStatStringElem.cpp.

00082 {
00083 }

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


Member Function Documentation

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

Reimplemented from osg::StatElem.

Definition at line 66 of file OSGStatStringElem.h.

00066 { return "StatStringElem"; }

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

Definition at line 76 of file OSGStatStringElem.cpp.

References StatStringElem().

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

const std::string & osg::StatStringElem::get ( void   )  const [inline]

Definition at line 41 of file OSGStatStringElem.inl.

References _value.

Referenced by operator=().

00042 { 
00043     return _value; 
00044 }

void osg::StatStringElem::set ( const std::string &  value  )  [inline]

Definition at line 46 of file OSGStatStringElem.inl.

References _value.

00047 { 
00048     _value = value; 
00049 }

void osg::StatStringElem::set ( const Char8 value  )  [inline]

Definition at line 51 of file OSGStatStringElem.inl.

References _value.

00052 { 
00053     _value = (value ? value : ""); 
00054 }

void StatStringElem::reset ( void   )  [virtual]

Implements osg::StatElem.

Definition at line 118 of file OSGStatStringElem.cpp.

References _value.

00119 { 
00120     _value.resize(0); 
00121 }

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

Implements osg::StatElem.

Definition at line 87 of file OSGStatStringElem.cpp.

References _value.

00088 {
00089     if(!format)
00090     {
00091         str = _value;
00092     }
00093     else
00094     {
00095         char *temp = new char [strlen(format) + _value.size() + 10];
00096         sprintf(temp, format, _value.c_str());
00097         str = temp;
00098         delete [] temp;
00099     }
00100 }

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

Implements osg::StatElem.

Definition at line 102 of file OSGStatStringElem.cpp.

References _value.

00103 {
00104     if(inVal != 0)
00105     {
00106         _value = inVal;
00107     }
00108 
00109     return true;
00110 }

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

Implements osg::StatElem.

Definition at line 112 of file OSGStatStringElem.cpp.

00113 {
00114     return 0;
00115 }

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

Definition at line 137 of file OSGStatStringElem.cpp.

00138 {
00139     return this < &other;
00140 }

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

Implements osg::StatElem.

Definition at line 144 of file OSGStatStringElem.cpp.

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

00145 {
00146     StatStringElem *e = new StatStringElem(getDesc());
00147     
00148     *e = *this;
00149     
00150     return e;
00151 }

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

Implements osg::StatElem.

Definition at line 155 of file OSGStatStringElem.cpp.

References _value.

00156 {
00157     const StatStringElem *o = dynamic_cast<const StatStringElem *>(&other);
00158     
00159     _value += " " + o->_value;
00160     
00161     return *this;
00162 }

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

Definition at line 125 of file OSGStatStringElem.cpp.

References get().

00126 {
00127     if (this == &source)
00128         return *this;
00129 
00130     set(source.get());
00131 
00132     return *this;
00133 }

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

std::string osg::StatStringElem::_value [private]

Definition at line 136 of file OSGStatStringElem.h.

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


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

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