#include <parser.h>
Public Member Functions | |
parser (const std::string &fname) | |
~parser () | |
template<typename T > | |
T | getParam (const std::string key, const T def_val) |
std::string | getString (const std::string key, const std::string def_val) |
template<typename T > | |
arma::Col< T > | getCol (const std::string key, const arma::Col< T > def_val) |
arma::cx_vec | getCxCol (const std::string key, const arma::cx_vec def_val) |
template<typename T > | |
arma::Row< T > | getRow (const std::string key, const arma::Row< T > def_val) |
arma::cx_rowvec | getCxRow (const std::string key, const arma::cx_rowvec def_val) |
template<typename T > | |
arma::Mat< T > | getMat (const std::string key, const arma::Mat< T > def_val) |
arma::cx_mat | getCxMat (const std::string key, const arma::cx_mat def_val) |
Private Member Functions | |
bool | valid_key (const std::string &key) |
std::complex< double > | parse_cx (std::string str) |
Private Attributes | |
std::map< std::string, std::string > | par_map |
Implements parsing from text file for different types
|
inline |
Constructor.
Opens parameter file and puts the key and value in the map structure
fname | Parameter file name |
Definition at line 82 of file parser.h.
References par_map, and wrn_handler.
|
inline |
Col type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 205 of file parser.h.
References par_map, and valid_key().
Referenced by main().
|
inline |
cx_vec type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 233 of file parser.h.
References par_map, parse_cx(), and valid_key().
Referenced by main().
|
inline |
cx_mat type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 357 of file parser.h.
References par_map, parse_cx(), and valid_key().
Referenced by main().
|
inline |
cx_rowvec type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 288 of file parser.h.
References par_map, parse_cx(), and valid_key().
|
inline |
Mat type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 315 of file parser.h.
References par_map, and valid_key().
Referenced by main().
|
inline |
Generic type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 168 of file parser.h.
References par_map, and valid_key().
Referenced by main().
|
inline |
Row type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 260 of file parser.h.
References par_map, and valid_key().
Referenced by main().
|
inline |
String type get function.
key | Parameter name |
def_val | Default value if key was not found in file |
Definition at line 188 of file parser.h.
References par_map, and valid_key().
Referenced by main().
|
inlineprivate |
Parse complex value.
String may be in format e.g. "1+1i","1+1j" or entirely real or imaginary "1", "1i" or "1j"
str | Complex notation string |
Definition at line 49 of file parser.h.
References err_handler.
Referenced by getCxCol(), getCxMat(), and getCxRow().
|
inlineprivate |
Check if key is valid.
key | Key string |
Definition at line 31 of file parser.h.
References par_map.
Referenced by getCol(), getCxCol(), getCxMat(), getCxRow(), getMat(), getParam(), getRow(), and getString().
|
private |
Map structure to store parameter and value.
Definition at line 24 of file parser.h.
Referenced by getCol(), getCxCol(), getCxMat(), getCxRow(), getMat(), getParam(), getRow(), getString(), parser(), and valid_key().