.. But unlike a C++ enum, there is no efficient way to go from a String to an int.
Enumeration fields;
const Enumeration::Element Ref(fields, "Ref");
const Enumeration::Element Vel(fields, "Vel");
const Enumeration::Element Spw(fields, "Spw");
for (int i=Ref; i < fields.Last; ++i){
int no = fields[i];
std::string name = fields[i];
std::cout << no << " -> " << name << " \n";
}
Public Member Functions | |
| Enumeration (size_t start=0) | |
| Element | add (const std::string &next) |
| const Element & | operator[] (const std::string &name) const |
| WARNING! This method is inefficient as it involves a map lookup each time. | |
| const Element & | operator[] (size_t i) const |
Public Attributes | |
| const size_t | Start |
| size_t | Last |
Classes | |
| class | Element |
| code::Enumeration::Enumeration | ( | size_t | start = 0 |
) | [inline] |
| Element code::Enumeration::add | ( | const std::string & | next | ) | [inline] |
| const Element& code::Enumeration::operator[] | ( | size_t | i | ) | const [inline] |
| const Element& code::Enumeration::operator[] | ( | const std::string & | name | ) | const [inline] |
WARNING! This method is inefficient as it involves a map lookup each time.
There is also no error checking ...
| size_t code::Enumeration::Last |
| const size_t code::Enumeration::Start |
1.4.7