#include <OSGStatTimeElem.h>

Public Member Functions | |
instance | |
| virtual void | reset (void) |
| const Time & | start (void) |
| const Time & | stop (void) |
| const Time & | getTime (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 StatElem * | clone (void) const |
Operators | |
| virtual StatElem & | operator+= (const StatElem &other) |
Instance | |
| bool | isOn (void) const |
| void | setOn (bool on) |
| StatElemDescBase * | getDesc (void) const |
Comparison | |
| bool | operator< (const StatElem &other) const |
Static Public Member Functions | |
Class Get | |
| static const char * | getClassname (void) |
your_category | |
| static StatElem * | create (StatElemDescBase *desc) |
Protected Member Functions | |
Constructors | |
| StatTimeElem (StatElemDescBase *desc) | |
| virtual | ~StatTimeElem (void) |
Private Types | |
| typedef StatElem | Inherited |
Private Member Functions | |
| StatTimeElem (const StatTimeElem &source) | |
| StatTimeElem & | operator= (const StatTimeElem &source) |
Private Attributes | |
| Time | _time |
Definition at line 60 of file OSGStatTimeElem.h.
typedef StatElem osg::StatTimeElem::Inherited [private] |
Definition at line 137 of file OSGStatTimeElem.h.
| StatTimeElem::StatTimeElem | ( | StatElemDescBase * | desc | ) | [protected] |
| StatTimeElem::~StatTimeElem | ( | void | ) | [protected, virtual] |
| osg::StatTimeElem::StatTimeElem | ( | const StatTimeElem & | source | ) | [private] |
| static const char* osg::StatTimeElem::getClassname | ( | void | ) | [inline, static] |
| 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] |
| 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] |
| bool StatTimeElem::operator< | ( | const StatTimeElem & | other | ) | const |
| 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 }
Implements osg::StatElem.
Definition at line 176 of file OSGStatTimeElem.cpp.
References _time.
00177 { 00178 const StatTimeElem *o = dynamic_cast<const StatTimeElem *>(&other); 00179 00180 _time += o->_time; 00181 00182 return *this; 00183 }
| 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 osg::StatTimeStampElem::clone(), 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.
Time osg::StatTimeElem::_time [private] |
Definition at line 139 of file OSGStatTimeElem.h.
Referenced by getFromString(), getTime(), operator+=(), operator<(), operator=(), putToString(), start(), and stop().
1.5.5