Chi-Tech
|
#include <basic_options.h>
Public Member Functions | |
BasicOptions ()=default | |
BasicOptions (std::initializer_list< BasicOption > in_options) | |
const BasicOption & | operator() (const std::string &option_name) const |
const BasicOption & | operator() (size_t index) const |
BasicOption & | operator[] (const std::string &option_name) |
BasicOption & | operator[] (size_t index) |
template<typename T > | |
void | AddOption (const std::string &option_name, const T &value) |
size_t | GetOptionIndexFromName (const std::string &option_name) const |
template<> | |
void | AddOption (const std::string &option_name, const bool &value) |
template<> | |
void | AddOption (const std::string &option_name, const int64_t &value) |
template<> | |
void | AddOption (const std::string &option_name, const double &value) |
Private Attributes | |
std::vector< BasicOption > | options_ |
Class for basic options
Definition at line 46 of file basic_options.h.
|
default |
|
inline |
Constructor with initializer list.
Definition at line 55 of file basic_options.h.
void chi_physics::BasicOptions::AddOption | ( | const std::string & | option_name, |
const bool & | value | ||
) |
Definition at line 73 of file basic_options.cc.
void chi_physics::BasicOptions::AddOption | ( | const std::string & | option_name, |
const double & | value | ||
) |
Definition at line 87 of file basic_options.cc.
void chi_physics::BasicOptions::AddOption | ( | const std::string & | option_name, |
const int64_t & | value | ||
) |
Definition at line 80 of file basic_options.cc.
void chi_physics::BasicOptions::AddOption | ( | const std::string & | option_name, |
const T & | value | ||
) |
size_t chi_physics::BasicOptions::GetOptionIndexFromName | ( | const std::string & | option_name | ) | const |
Attempts to find an option that matches the requested name. If one is found then its corresponding index is returned. If it is not found then a std::out_of_range exception is thrown.
Definition at line 97 of file basic_options.cc.
const chi_physics::BasicOption & chi_physics::BasicOptions::operator() | ( | const std::string & | option_name | ) | const |
Returns a constant reference to an option that matches the requested name. If no name-match is found the method will throw a std::out_of_range exception.
Definition at line 6 of file basic_options.cc.
const chi_physics::BasicOption & chi_physics::BasicOptions::operator() | ( | size_t | index | ) | const |
Returns a constant reference to an option at the given index. If the index is out of range then a std::out_of_range exception is thrown. This method can potentially be faster than the string comparison equivalent.
Definition at line 23 of file basic_options.cc.
chi_physics::BasicOption & chi_physics::BasicOptions::operator[] | ( | const std::string & | option_name | ) |
Returns a non-constant reference to an option that matches the requested name. If no name-match is found the method will throw a std::out_of_range exception.
Definition at line 36 of file basic_options.cc.
chi_physics::BasicOption & chi_physics::BasicOptions::operator[] | ( | size_t | index | ) |
Returns a non-constant reference to an option at the given index. If the index is out of range then a std::out_of_range exception is thrown. This method can potentially be faster than the string comparison equivalent.
Definition at line 53 of file basic_options.cc.
|
private |
Definition at line 49 of file basic_options.h.