#include "b2rtable.H"
Public Member Functions | |
bool | has_key (const std::string &key) const |
void | remove_key (const std::string &key) |
Remove entry "key". | |
const RData & | operator() (const std::string &key) const |
RData & | operator() (const std::string &key) |
void | update (const RTable &o) |
Update with all (key,value) pairs from another RTable. | |
template<typename T > | |
void | set (const std::string &key, const T &v, const bool new_key=false) |
Assign a single value. If new_key is true, the key must not exist. | |
template<typename T > | |
void | set (const std::string &key, const std::vector< T > &v, const bool new_key=false) |
Copy a vector. If new_key is true, the key must not exist. | |
template<typename InputIterator > | |
void | set (const std::string &key, InputIterator first, InputIterator last, const bool new_key=false) |
Copy a range. If new_key is true, the key must not exist. | |
void | set (const std::string &key, const std::string &s, const bool new_key=false) |
Copy a string. If new_key is true, the key must not exist. | |
bool | get_bool (const std::string &key) const |
bool | get_bool (const std::string &key, const bool default_) const |
int | get_int (const std::string &key) const |
int | get_int (const std::string &key, const int default_) const |
double | get_double (const std::string &key) const |
double | get_double (const std::string &key, const double default_) const |
std::complex< double > | get_complex_double (const std::string &key) const |
b2000::csda< double > | get_csda_double (const std::string &key) const |
std::complex< double > | get_complex_double (const std::string &key, const std::complex< double > &default_) const |
b2000::csda< double > | get_csda_double (const std::string &key, const b2000::csda< double > &default_) const |
std::string | get_string (const std::string &key) const |
std::string | get_string (const std::string &key, const std::string &default_) const |
template<typename T > | |
T | get (const std::string &key) const |
template<typename T > | |
T | get (const std::string &key, const T &default_) const |
void | get (const std::string &key, std::vector< int > &v) const |
void | get (const std::string &key, std::vector< double > &v) const |
void | get (const std::string &key, std::vector< std::complex< double > > &v) const |
void | get (const std::string &key, std::vector< b2000::csda< double > > &v) const |
void | get (const std::string &key, const size_t size_, int *v) const |
void | get (const std::string &key, const size_t size_, double *v) const |
void | get (const std::string &key, const size_t size_, std::complex< double > *v) const |
void | append_to_array (std::vector< char > &a) const |
const char * | update_from_array (const char *abegin, const char *aend) |
Public Attributes | |
std::string | errmsg_context |
Will be pre-pended to error messages. | |
A map of strings to RData objects.
It may be used like any STL map. In addition, it contains setter and getter functions that perform error checking; in case of an error, an Exception is thrown. The getter functions are alike to those in the abstract Dictionary class.
void b2000::RTable::append_to_array | ( | std::vector< char > & | a | ) | const |
Stream an RTable instance into a vector of characters (appending to it), according to the MemCom convention for relational tables.
a | An STL vector of characters, to which the data will be appended. |
|
inline |
Extract the first element. The key must exist, the RData must be of type T, and its size must be non-zero.
|
inline |
Extract a number of elements into an array. The key must exist, the RData must be of type DOUBLE, and its size must be greater than or equal to the size_ parameter.
|
inline |
Extract a number of elements into an array. The key must exist, the RData must be of type INT, and its size must be greater than or equal to the size_ parameter.
|
inline |
Extract a number of elements into an array of complex numbers or csda numbers. The key must exist, the RData must be of type DOUBLE or COMPLEX_DOUBLE, and its size must be greater than or equal to the size_ parameter.
|
inline |
Extract the first element. If the key does not exist, the default value is returned. If the key exists, the RData must be of type T, and its size must be non-zero.
|
inline |
Extract all elements into an STL vector of csda numbers. The key must exist and the RData must be of type DOUBLE or COMPLEX_DOUBLE.
|
inline |
Extract all elements into an STL vector. The key must exist and the RData must be of type DOUBLE or COMPLEX_DOUBLE.
|
inline |
Extract all elements into an STL vector. The key must exist and the RData must be of type INT.
|
inline |
Extract all elements into an STL vector of complex numbers. The key must exist and the RData must be of type DOUBLE or COMPLEX_DOUBLE.
|
inline |
Return the bool value. The key must exist and the RData must be of type BOOL.
|
inline |
Return the bool value. Extract the first element. If the key does not exist, the default value is returned. If the key exists and the RData must be of type BOOL.
|
inline |
Extract the first element. The key must exist, the RData must be of type COMPLEX_DOUBLE or DOUBLE, and its size must be non-zero.
|
inline |
Extract the first element. If the key does not exist, the default value is returned. If the key exists, the RData must be of type COMPLEX_DOUBLE or DOUBLE, and its size must be non-zero.
|
inline |
Extract the first element and return a csda number. The key must exist, the RData must be of type COMPLEX_DOUBLE or DOUBLE, and its size must be non-zero.
|
inline |
Extract the first element and return a csda number. If the key does not exist, the default value is returned. If the key exists, the RData must be of type COMPLEX_DOUBLE or DOUBLE, and its size must be non-zero.
|
inline |
Extract the first element. The key must exist, the RData must be of type DOUBLE, and its size must be non-zero.
|
inline |
Extract the first element. If the key does not exist, the default value is returned. If the key exists, the RData must be of type DOUBLE or COMPLEX_DOUBLE, and its size must be non-zero.
|
inline |
Extract the first element. The key must exist, the RData must be of type INT, and its size must be non-zero.
|
inline |
Extract the first element. If the key does not exist, the default value is returned. If the key exists, the RData must be of type INT, and its size must be non-zero.
|
inline |
Extract a string. The key must exist and the RData must be of type STRING.
|
inline |
Extract a string. If the key does not exist, the default string is returned. If the key exists, the RData must be of type STRING.
|
inline |
|
inline |
|
inline |
const char * b2000::RTable::update_from_array | ( | const char * | abegin, |
const char * | aend | ||
) |
Initialize or update an RTable instance from an array of characters, according to the MemCom convention for relational tables.
abegin | A pointer to the beginning of the character array. |
aend | A pointer past the end of the character array. |