#include <OSGStatCollector.h>
Constructor | |
| * | StatCollector (void) |
| StatCollector (const StatCollector &source) | |
| StatCollector & | operator= (const StatCollector &source) |
| static StatCollector * | create (void) |
Public Member Functions | |
Instance | |
| *UInt32 | getNumOfElems (void) |
| void | refitElemNum (void) |
| void | clearElems (void) |
| bool | isValidID (Int32 id) |
| void | reset (void) |
| StatElem * | getElem (Int32 id, bool create=true) |
| StatElem * | getElem (StatElemDescBase &desc, bool create=true) |
| template<class T> | |
| T * | getElem (StatElemDesc< T > &desc, bool create=true) |
| void | putToString (std::string &outVal) const |
| bool | getFromString (const Char8 *&inVal) |
| bool | getValue (std::string &name, Real64 &val) |
Destructor | |
| *virtual | ~StatCollector (void) |
Comparison | |
| *bool | operator< (const StatCollector &other) const |
Static Public Member Functions | |
Class Get | |
| *static const char * | getClassname (void) |
Private Attributes | |
| std::vector< StatElem * > | _elemVec |
Definition at line 63 of file OSGStatCollector.h.
|
|
Definition at line 78 of file OSGStatCollector.cpp. References refitElemNum(). Referenced by create(). 00079 { 00080 refitElemNum(); 00081 }
|
|
|
Definition at line 83 of file OSGStatCollector.cpp. References _elemVec. 00084 { 00085 _elemVec.resize(source._elemVec.size()); 00086 00087 for(UInt32 i = 0; i < source._elemVec.size(); ++i) 00088 { 00089 if(source._elemVec[i]) 00090 { 00091 _elemVec[i] = source._elemVec[i]->clone(); 00092 } 00093 else 00094 { 00095 _elemVec[i] = NULL; 00096 } 00097 } 00098 }
|
|
|
Definition at line 105 of file OSGStatCollector.cpp. References _elemVec.
|
|
|
Definition at line 73 of file OSGStatCollector.h.
|
|
|
Definition at line 43 of file OSGStatCollector.inl. References _elemVec. Referenced by osg::SimpleStatisticsForeground::draw(). 00044 { 00045 return _elemVec.size(); 00046 }
|
|
|
Increase the size of the StatCollector's data array. This is called during construction and will only be needed later, when a new StatElem has been added after the StatCollector was instanced. This will very rarely be the case. Definition at line 117 of file OSGStatCollector.cpp. References _elemVec, and osg::StatElemDescBase::getNumOfDescs(). Referenced by getElem(), and StatCollector(). 00118 { 00119 unsigned eN = _elemVec.size(), dN = StatElemDescBase::getNumOfDescs(); 00120 00121 if(eN != dN) 00122 { 00123 _elemVec.resize(dN,0); 00124 } 00125 }
|
|
|
Remove all elements from the collector. Definition at line 228 of file OSGStatCollector.cpp. References _elemVec. Referenced by getFromString(). 00229 { 00230 for(std::vector<StatElem*>::iterator i = _elemVec.begin(); 00231 i != _elemVec.end(); 00232 ++i) 00233 { 00234 if(*i != NULL) 00235 { 00236 delete *i; 00237 *i = NULL; 00238 } 00239 } 00240 }
|
|
|
Definition at line 49 of file OSGStatCollector.inl. References _elemVec.
|
|
|
Reset all elements to the start value. Definition at line 245 of file OSGStatCollector.cpp. References _elemVec. Referenced by osg::RenderAction::start(). 00246 { 00247 for(std::vector<StatElem*>::iterator i = _elemVec.begin(); 00248 i != _elemVec.end(); 00249 ++i) 00250 { 00251 if(*i != NULL) 00252 { 00253 (*i)->reset(); 00254 } 00255 } 00256 }
|
|
||||||||||||
|
||||||||||||
|
Definition at line 87 of file OSGStatCollector.inl. References getElem(), and osg::StatElemDescBase::getID().
|
|
||||||||||||||||
|
Definition at line 94 of file OSGStatCollector.inl. References getElem(), and osg::StatElemDescBase::getID().
|
|
|
Convert the current contents into a string. This string can be used as a compact representation of the data, and as input for StatCollector::getFromString. Definition at line 131 of file OSGStatCollector.cpp. References _elemVec. Referenced by osg::FieldDataTraits< StatCollector >::putToString(). 00132 { 00133 std::vector<StatElem*>::const_iterator it; 00134 bool first = true; 00135 00136 str = "{"; 00137 00138 for(it = _elemVec.begin(); it != _elemVec.end(); ++it) 00139 { 00140 if(*it != NULL) 00141 { 00142 std::string elem; 00143 00144 if(!first) 00145 str.append("|"); 00146 str.append((*it)->getDesc()->getName().str()); 00147 str.append("="); 00148 (*it)->putToString(elem); 00149 str.append(elem); 00150 first = false; 00151 } 00152 } 00153 str.append("}"); 00154 }
|
|
|
Set the contents from a string. The string has to have the format that is used by StatCollector::putToString. Definition at line 160 of file OSGStatCollector.cpp. References clearElems(), osg::StatElemDescBase::findDescByName(), getElem(), and osg::StatElem::getFromString(). Referenced by osg::FieldDataTraits< StatCollector >::getFromString(). 00161 { 00162 const Char8 *c = inVal; 00163 00164 if(*c++ != '{') 00165 return false; 00166 00167 StatElemDescBase *desc; 00168 StatElem *elem; 00169 00170 clearElems(); 00171 00172 while(*c && *c != '}') 00173 { 00174 const Char8 *end = c; 00175 00176 while(*end != 0 && *end != '=' && *end != '}' && *end != '|') 00177 end++; 00178 00179 if(*end == 0 || *end == '}' || *end == '|') 00180 return false; 00181 00182 std::string name(c, end - c); 00183 desc = StatElemDescBase::findDescByName(name.c_str()); 00184 00185 if(!desc) 00186 return false; 00187 00188 elem = getElem(*desc); 00189 00190 c = end = end + 1; 00191 while(*end != 0 && *end != '}' && *end != '|') 00192 end++; 00193 00194 if(*end == 0) 00195 return false; 00196 00197 std::string val(c, end - c); 00198 const Char8 *valp = val.c_str(); 00199 if(!elem->getFromString(valp)) 00200 return false; 00201 00202 c = end + 1; 00203 } 00204 return true; 00205 }
|
|
||||||||||||
|
Get the value of the named element, if it exists, return false if not. Definition at line 209 of file OSGStatCollector.cpp. References osg::StatElemDescBase::findDescByName(), getElem(), and osg::StatElem::getValue(). 00210 { 00211 StatElemDescBase *desc = StatElemDescBase::findDescByName(name.c_str()); 00212 00213 if(!desc) 00214 return false; 00215 00216 StatElem *el = getElem(*desc, false); 00217 00218 if(!el) 00219 return false; 00220 00221 val = el->getValue(); 00222 00223 return true; 00224 }
|
|
|
Definition at line 100 of file OSGStatCollector.cpp. References StatCollector(). Referenced by osg::DrawActionBase::getStatistics(), osg::DrawActionBase::start(), and osg::NewActionBase::startEvent(). 00101 { 00102 return new StatCollector(); 00103 }
|
|
|
Definition at line 260 of file OSGStatCollector.cpp. References _elemVec. 00261 { 00262 if (this == &source) 00263 return *this; 00264 00265 _elemVec = source._elemVec; 00266 00267 return *this; 00268 }
|
|
|
The comparison is only done on the addresses, as a real comparison is not well defined on a StatCollector. Definition at line 275 of file OSGStatCollector.cpp.
|
|
|
Definition at line 141 of file OSGStatCollector.h. Referenced by clearElems(), getElem(), getNumOfElems(), isValidID(), operator=(), putToString(), refitElemNum(), reset(), StatCollector(), and ~StatCollector(). |
1.4.3