Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
StringBijection< T > Class Template Reference

#include <StringBijection.h>

Data Structures

struct  Entry
 bijection entry More...

Public Member Functions

void addAlias (const std::string str, const T key)
 add alias to the given key
void addKeysInto (std::vector< T > &list) const
 add the given list of keys
get (const std::string &str) const
 get key
std::string getMultilineString () const
 get multiline string (all strings concatenated and separated by '
')
const std::string & getString (const T key) const
 get string
std::vector< std::string > getStrings () const
 get all strings
std::vector< T > getValues () const
 get all keys
bool has (const T key) const
 check if the given key exist
bool hasString (const std::string &str) const
 check if the given string exist
void insert (const std::string str, const T key, bool checkDuplicates=true)
 insert string and their associated key
void remove (const std::string str, const T key)
 remove string
int size () const
 get number of key-attributes
 StringBijection ()
 default constructor
 StringBijection (Entry entries[], T terminatorKey, bool checkDuplicates=true)
 parameter constructor

Private Attributes

std::map< std::string, T > myString2T
 map with the keys vinculated with strings
std::map< T, std::string > myT2String
 map with the strings vinculated with keys

Detailed Description

template<class T>
class StringBijection< T >

Template container for maintaining a bidirectional map between strings and something else It is not always a bijection since it allows for duplicate entries on both sides if either checkDuplicates is set to false in the constructor or the insert function or if the addAlias function is used.

Definition at line 40 of file StringBijection.h.

Constructor & Destructor Documentation

◆ StringBijection() [1/2]

template<class T>
StringBijection< T >::StringBijection ( )
inline

default constructor

Definition at line 58 of file StringBijection.h.

◆ StringBijection() [2/2]

template<class T>
StringBijection< T >::StringBijection ( Entry entries[],
T terminatorKey,
bool checkDuplicates = true )
inline

parameter constructor

Definition at line 61 of file StringBijection.h.

References insert().

Member Function Documentation

◆ addAlias()

template<class T>
void StringBijection< T >::addAlias ( const std::string str,
const T key )
inline

add alias to the given key

Definition at line 84 of file StringBijection.h.

References myString2T.

◆ addKeysInto()

template<class T>
void StringBijection< T >::addKeysInto ( std::vector< T > & list) const
inline

add the given list of keys

Definition at line 147 of file StringBijection.h.

References myT2String.

◆ get()

template<class T>
T StringBijection< T >::get ( const std::string & str) const
inline

get key

Definition at line 95 of file StringBijection.h.

References hasString(), and myString2T.

Referenced by NWWriter_OpenDrive::getID().

Here is the caller graph for this function:

◆ getMultilineString()

template<class T>
std::string StringBijection< T >::getMultilineString ( ) const
inline

get multiline string (all strings concatenated and separated by '
')

Note
this will be removed after unifying all FXFileDialog

Definition at line 156 of file StringBijection.h.

References myT2String.

◆ getString()

template<class T>
const std::string & StringBijection< T >::getString ( const T key) const
inline

get string

Definition at line 104 of file StringBijection.h.

References has(), and myT2String.

◆ getStrings()

template<class T>
std::vector< std::string > StringBijection< T >::getStrings ( ) const
inline

get all strings

Definition at line 129 of file StringBijection.h.

References myT2String.

◆ getValues()

template<class T>
std::vector< T > StringBijection< T >::getValues ( ) const
inline

get all keys

Definition at line 138 of file StringBijection.h.

References myT2String.

◆ has()

template<class T>
bool StringBijection< T >::has ( const T key) const
inline

check if the given key exist

Definition at line 119 of file StringBijection.h.

References myT2String.

Referenced by getString(), and insert().

Here is the caller graph for this function:

◆ hasString()

template<class T>
bool StringBijection< T >::hasString ( const std::string & str) const
inline

check if the given string exist

Definition at line 114 of file StringBijection.h.

References myString2T.

Referenced by get(), NWWriter_OpenDrive::getID(), and insert().

Here is the caller graph for this function:

◆ insert()

template<class T>
void StringBijection< T >::insert ( const std::string str,
const T key,
bool checkDuplicates = true )
inline

insert string and their associated key

Definition at line 69 of file StringBijection.h.

References has(), hasString(), myString2T, and myT2String.

Referenced by NWWriter_OpenDrive::getID(), and StringBijection().

Here is the caller graph for this function:

◆ remove()

template<class T>
void StringBijection< T >::remove ( const std::string str,
const T key )
inline

remove string

Definition at line 89 of file StringBijection.h.

References myString2T, and myT2String.

◆ size()

template<class T>
int StringBijection< T >::size ( ) const
inline

get number of key-attributes

Definition at line 124 of file StringBijection.h.

References myString2T.

Field Documentation

◆ myString2T

template<class T>
std::map<std::string, T> StringBijection< T >::myString2T
private

map with the keys vinculated with strings

Definition at line 169 of file StringBijection.h.

Referenced by addAlias(), get(), hasString(), insert(), remove(), and size().

◆ myT2String

template<class T>
std::map<T, std::string> StringBijection< T >::myT2String
private

map with the strings vinculated with keys

Definition at line 172 of file StringBijection.h.

Referenced by addKeysInto(), getMultilineString(), getString(), getStrings(), getValues(), has(), insert(), and remove().


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