This function's purpose is to provide a mapping from a 'friendly' human readable text string to an index into internal data structures.
| 177 | // This function's purpose is to provide a mapping from a 'friendly' human readable text string |
| 178 | // to an index into internal data structures. |
| 179 | StatisticalTimer::sTimerID |
| 180 | StatisticalTimer::getUniqueID( const std::string& label, unsigned int groupID ) |
| 181 | { |
| 182 | // I expect labelID will hardly ever grow beyond 30, so it's not of any use |
| 183 | // to keep this sorted and do a binary search |
| 184 | |
| 185 | labelPair sItem = std::make_pair( label, groupID ); |
| 186 | |
| 187 | stringVector::iterator iter; |
| 188 | iter = std::find( labelID.begin(), labelID.end(), sItem ); |
| 189 | |
| 190 | if( iter != labelID.end( ) ) |
| 191 | return std::distance( labelID.begin( ), iter ); |
| 192 | |
| 193 | labelID.push_back( sItem ); |
| 194 | |
| 195 | return labelID.size( ) - 1; |
| 196 | |
| 197 | } |
| 198 | |
| 199 | double |
| 200 | StatisticalTimer::getMean( sTimerID id ) const |