TDictMap< T > Class Template Reference
Command line and parameter parsing

A mapper from emums to string values. - usefull for names flags. More...

`#include <mia/core/dictmap.hh>`

Inheritance diagram for TDictMap< T >:
[legend]

## Data Structures

struct | Table

## Public Types

typedef std::map< T, std::pair< std::string, std::string > > | THelpMap

## Public Member Functions

const char * | get_help (T value) const
THelpMap::const_iterator | get_help_begin () const
THelpMap::const_iterator | get_help_end () const
const char * | get_name (T value) const
const std::set< std::string > | get_name_set () const
T | get_value (const char *name) const
| TDictMap (const Table *table, bool last_is_default=false)

## Detailed Description

template<typename T>
class TDictMap< T >

A mapper from emums to string values. - usefull for names flags.

Todo
  extend it to also contain help strings for each flag.

Definition at line 45 of file dictmap.hh.

## Member Typedef Documentation

## THelpMap

template<typename T>

typedef std::map<T, std::pair<std::string, std::string> > TDictMap< T >::THelpMap

This map is used to reference the help strings

Definition at line 51 of file dictmap.hh.

## Constructor & Destructor Documentation

## TDictMap()

template<typename T>

TDictMap< T >::TDictMap | ( | const Table * | table,
|  | bool | last_is_default = false )

Create the map by providing an initialisation map

Parameters

  table | the initialisation table, needs to be terminated by a {NULL, some_value} pair.
  last_is_default | true if the value provided with the NULL name is the default return value if unknown names are given. If false, an unknown name in get_value() will throw std::invalid_argument exception.

Definition at line 134 of file dictmap.hh.

References TDictMap< T >::Table::help, TDictMap< T >::Table::name, and TDictMap< T >::Table::value.

Referenced by get_help_begin(), and get_help_end().

## Member Function Documentation

## get_help()

template<typename T>

const char * TDictMap< T >::get_help | ( | T | value | ) | const

Parameters

  value |

Returns
  corresponding flag

Remarks
  throws std::invalid_argument if the value is unknown

Definition at line 187 of file dictmap.hh.

References create_exception().

## get_help_begin()

template<typename T>

TDictMap< T >::THelpMap::const_iterator TDictMap< T >::get_help_begin | ( |  | ) | const

Returns
  start of help map

Definition at line 206 of file dictmap.hh.

References TDictMap().

## get_help_end()

template<typename T>

TDictMap< T >::THelpMap::const_iterator TDictMap< T >::get_help_end | ( |  | ) | const

Returns
  end of help map

Definition at line 212 of file dictmap.hh.

References TDictMap().

## get_name()

template<typename T>

const char * TDictMap< T >::get_name | ( | T | value | ) | const

Parameters

  value |

Returns
  corresponding flag

Remarks
  throws std::invalid_argument if the value is unknown

Definition at line 172 of file dictmap.hh.

References create_exception().

## get_name_set()

template<typename T>

const std::set< std::string > TDictMap< T >::get_name_set | ( |  | ) | const

Returns
  a set of all available names

Definition at line 198 of file dictmap.hh.

## get_value()

template<typename T>

T TDictMap< T >::get_value | ( | const char * | name | ) | const

Parameters

  name |

Returns
  corresponding flag

Remarks
  throws std::invalid_argument if the name is unknown

Definition at line 156 of file dictmap.hh.

The documentation for this class was generated from the following file:

- dictmap.hh