a container for keyword/value pairs More...
#include <measures.h>
Inherits std::vector< measure_t >.
Public Member Functions | |
void | entry (std::string s, int i) |
void | entry (std::string s, double d) |
void | entry (std::string s, std::string s2) |
Friends | |
std::ostream & | operator<< (std::ostream &os, const measures &m) |
void | print_labels (std::ostream &os, const measures &m) |
a container for keyword/value pairs
The measures class is a generic container for string/value pairs. It can be used for any purpose but was constructed to make it easy to collect computed measures into a single structure for output.
Measures accepts a string as the keyword. The value part can an int
, a double
or a string
. Any values that can be automatically converted to one of these types is also accepted.
The measures class is a vector
type and can contain an unlimited number of string/value pairs. The pairs are initialized by calling the entry
member function to add a new pair to the measures object.
Example:
measures myExperimentalMeasures; int lanex=4; myExperimentalMeasures.entry("lane deviations",lanex); float laneStdDev=7.2; myExperimentalMeasures.entry("lane std. dev.", laneStdDev); myExperimentalMeasures.entry("lane departure direction", "Left");
Two output functions are provided: operator<<(std::ostream&,const measures&) and print_labels()
void measures::entry | ( | std::string | s, | |
std::string | s2 | |||
) | [inline] |
add a key/value pair
s | a string containing the label associated with the measure | |
s2 | a string value |
void measures::entry | ( | std::string | s, | |
double | d | |||
) | [inline] |
add a key/value pair
s | a string containing the label associated with the measure | |
d | a floating point value |
void measures::entry | ( | std::string | s, | |
int | i | |||
) | [inline] |
add a key/value pair
s | a string containing the label associated with the measure | |
i | an integer value |