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

osg::StatTimeElem Class Reference
[Statistics]

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

#include <OSGStatTimeElem.h>

Inheritance diagram for osg::StatTimeElem:

osg::StatElem List of all members.

Public Member Functions

instance
*virtual void reset (void)
const Timestart (void)
const Timestop (void)
const TimegetTime (void) const
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 StatTimeElem &other) const
Creation
*virtual StatElemclone (void) const
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
StatTimeElem (StatElemDescBase *desc)
virtual ~StatTimeElem (void)

Private Types

typedef StatElem Inherited

Private Member Functions

 StatTimeElem (const StatTimeElem &source)
StatTimeElemoperator= (const StatTimeElem &source)

Private Attributes

Time _time

Detailed Description

The StatIntElem keeps a osg::Time value for time measurements, see Statistics for details.

Definition at line 60 of file OSGStatTimeElem.h.


Member Typedef Documentation

typedef StatElem osg::StatTimeElem::Inherited [private]
 

Definition at line 130 of file OSGStatTimeElem.h.


Constructor & Destructor Documentation

StatTimeElem::StatTimeElem StatElemDescBase desc  )  [protected]
 

Definition at line 71 of file OSGStatTimeElem.cpp.

Referenced by clone(), and create().

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

StatTimeElem::~StatTimeElem void   )  [protected, virtual]
 

Definition at line 82 of file OSGStatTimeElem.cpp.

00083 {
00084 }

osg::StatTimeElem::StatTimeElem const StatTimeElem source  )  [private]
 


Member Function Documentation

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

Reimplemented from osg::StatElem.

Definition at line 70 of file OSGStatTimeElem.h.

00070 { return "StatTimeElem"; }

StatElem * StatTimeElem::create StatElemDescBase desc  )  [static]
 

Definition at line 76 of file OSGStatTimeElem.cpp.

References StatTimeElem().

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

void StatTimeElem::reset void   )  [virtual]
 

Implements osg::StatElem.

Definition at line 139 of file OSGStatTimeElem.cpp.

00140 { 
00141     // Time elements need to be started and stopped and can't be reset
00142 }

const Time & osg::StatTimeElem::start void   )  [inline]
 

Definition at line 41 of file OSGStatTimeElem.inl.

References _time, and osg::getSystemTime().

00042 { 
00043     return (_time = getSystemTime()); 
00044 }

const Time & osg::StatTimeElem::stop void   )  [inline]
 

Definition at line 46 of file OSGStatTimeElem.inl.

References _time, and osg::getSystemTime().

Referenced by osg::RenderAction::stop().

00047 { 
00048     return (_time = (getSystemTime() - _time)); 
00049 }

const Time & osg::StatTimeElem::getTime void   )  const [inline]
 

Definition at line 51 of file OSGStatTimeElem.inl.

References _time.

Referenced by getValue(), and osg::RenderAction::stop().

00052 { 
00053     return _time; 
00054 }

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

Implements osg::StatElem.

Definition at line 88 of file OSGStatTimeElem.cpp.

References _time.

00089 {
00090     if(!format)
00091     {
00092         FieldDataTraits1<Time>::putToString(_time, str);
00093     }
00094     else
00095     {
00096         const char *proc = strchr(format,'%');        
00097               char *temp = new char [strlen(format) + 60];
00098 
00099         if(proc)
00100         {
00101             if(! strncmp(proc, "%ms", 3))
00102             {
00103                 std::string fcopy(format);
00104                 fcopy.insert((proc - format) + 1,".2f ");
00105                 sprintf(temp, fcopy.c_str(), ((double)_time)*1000.);
00106             }
00107             else if(! strncmp(proc, "%r", 2))
00108             {
00109                 std::string fcopy(format);
00110                 fcopy.erase((proc - format) + 1, 1);
00111                 sprintf(temp, fcopy.c_str(), 1./(double)_time);
00112             }
00113             else
00114             {
00115                 sprintf(temp, format, (double)_time);
00116             }
00117            
00118         }
00119         else
00120         {
00121             sprintf(temp, format, (double)_time);
00122         }
00123         
00124         str = temp;
00125         delete [] temp;
00126     }
00127 }

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

Implements osg::StatElem.

Definition at line 129 of file OSGStatTimeElem.cpp.

References _time.

00130 {
00131     return FieldDataTraits1<Time>::getFromString(_time, inVal);
00132 }

Real64 StatTimeElem::getValue void   )  const [virtual]
 

Implements osg::StatElem.

Definition at line 134 of file OSGStatTimeElem.cpp.

References getTime().

00135 {
00136     return static_cast<Real64>(getTime());
00137 }

bool StatTimeElem::operator< const StatTimeElem other  )  const
 

Definition at line 158 of file OSGStatTimeElem.cpp.

References _time.

00159 {
00160     return _time < other._time;
00161 }

StatElem * StatTimeElem::clone void   )  const [virtual]
 

Implements osg::StatElem.

Definition at line 165 of file OSGStatTimeElem.cpp.

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

00166 {
00167     StatTimeElem *e = new StatTimeElem(getDesc());
00168     
00169     *e = *this;
00170     
00171     return e;
00172 }

StatTimeElem & StatTimeElem::operator= const StatTimeElem source  )  [private]
 

Definition at line 146 of file OSGStatTimeElem.cpp.

References _time.

00147 {
00148     if (this == &source)
00149         return *this;
00150 
00151     _time = source._time;
00152     
00153     return *this;
00154 }

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]
 

Definition at line 51 of file OSGStatElem.inl.

References osg::StatElem::_desc.

Referenced by clone(), osg::StatStringElem::clone(), osg::StatRealElem::clone(), osg::StatIntOnceElem::clone(), osg::StatIntElem::clone(), and osg::SimpleStatisticsForeground::draw().

00052 { 
00053     return _desc; 
00054 }

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

Time osg::StatTimeElem::_time [private]
 

Definition at line 132 of file OSGStatTimeElem.h.

Referenced by getFromString(), getTime(), operator<(), operator=(), putToString(), start(), and stop().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:23:00 2005 for OpenSG by  doxygen 1.4.3