netxsimdg
|
#include <EnumWrapper.hpp>
Public Types | |
typedef std::map< std::string, E > | MapType |
Public Member Functions | |
E | operator() (const std::string &key) |
operator E () const | |
Cast the wrapped enum back to a plain one. | |
Static Public Member Functions | |
static void | setMap (const MapType &inMap) |
Friends | |
std::istream & | operator>> (std::istream &is, EnumWrapper< E > &e) |
A templated input operator that uses the defined map to set the value of the wrapped enum. | |
A helper class to make configuring enums easier with boost::program_options.
This class provides a templated implementation of the instream operator necessary for enums to be read by boost::program_options. Also provided is a macro which will format the map that is required to go from the string representation in the config file to the values of the enum.
Definition at line 58 of file EnumWrapper.hpp.
std::map<std::string, E> EnumWrap::EnumWrapper< E >::MapType |
Definition at line 60 of file EnumWrapper.hpp.
|
inline |
Cast the wrapped enum back to a plain one.
Definition at line 75 of file EnumWrapper.hpp.
|
inline |
Set and return the value of the wrapped enum, based on the passed string and the set map.
key | a key corresponding to one in the templated map which will set the value of the wrapped enum. |
Definition at line 69 of file EnumWrapper.hpp.
|
inlinestatic |
Set the mapping between strings and enum types
inMap | the mapping to be used. |
Definition at line 82 of file EnumWrapper.hpp.
|
friend |
A templated input operator that uses the defined map to set the value of the wrapped enum.
Definition at line 101 of file EnumWrapper.hpp.