30#ifndef APF_PARAMETER_MAP_H
31#define APF_PARAMETER_MAP_H
72 template<
typename... Args>
74 : std::map<std::string, std::string>(std::forward<Args>(args)...)
84 const std::string&
operator[](
const std::string& k)
const
90 catch (
const std::out_of_range&)
92 throw std::out_of_range(
"Parameter \"" + k +
"\" does not exist in map!");
112 catch (
const std::out_of_range&)
114 throw std::out_of_range(
"Parameter \"" + k +
"\" does not exist in map!");
135 T
get(
const std::string& k,
const T& def)
const
139 return this->get<T>(k);
141 catch (
const std::out_of_range&)
145 catch (
const std::invalid_argument&)
172 template<
typename char_T>
173 std::basic_string<char_T>
174 get(
const std::string& k,
const char_T*
const def)
const
176 return this->
get(k, std::basic_string<char_T>(def));
186 T
get(
const std::string& k)
const
191 temp = str::S2RV<T>(this->
operator[](k));
193 catch (std::invalid_argument& e)
195 throw std::invalid_argument(
196 "parameter_map key \"" + k +
"\": " + e.what());
209 const std::string&
set(
const std::string& k,
const T& v)
211 return std::map<std::string, std::string>::operator[](k) =
str::A2S(v);
220 return this->count(k) > 0;
std::string A2S(const T &input)
Converter "Anything to String".
Audio Processing Framework.
A "dictionary" for parameters.
std::string & operator[](const std::string &k)
"Setter".
T get(const std::string &k, const T &def) const
Get value converted to given type.
std::basic_string< char_T > get(const std::string &k, const char_T *const def) const
Overloaded function for character array (aka C-string).
const std::string & operator[](const std::string &k) const
"Getter".
const std::string & set(const std::string &k, const T &v)
Set value.
T get(const std::string &k) const
Throwing getter.
parameter_map(Args &&... args)
Constructor.
bool has_key(const std::string &k) const
Check if a given parameter is available.