|
bool | enableVerify (bool enable) |
| Enable or disable parameter verification on an instance of Params. More...
|
|
size_t | size () const |
| Returns the size of the Params. More...
|
|
bool | empty () const |
| Returns true if the Params is empty. More...
|
|
| Params () |
| Create a new, empty Params.
|
|
| Params (const Params &old) |
| Create a copy of a Params object.
|
|
Params & | operator= (const Params &old) |
| Assignment operator. More...
|
|
void | clear () |
| Erases all elements.
|
|
size_t | count (const key_type &k) |
| Finds the number of elements with given key. More...
|
|
template<class T > |
T | find (const std::string &k, T default_value, bool &found) const |
| Find a Parameter value in the set, and return its value as a type T. More...
|
|
template<class T > |
T | find (const std::string &k, std::string default_value, bool &found) const |
| Find a Parameter value in the set, and return its value as a type T. More...
|
|
template<class T > |
T | find (const std::string &k, T default_value) const |
| Find a Parameter value in the set, and return its value as a type T. More...
|
|
template<class T > |
T | find (const std::string &k, std::string default_value) const |
| Find a Parameter value in the set, and return its value as a type T. More...
|
|
template<class T > |
T | find (const std::string &k) const |
| Find a Parameter value in the set, and return its value as a type T. More...
|
|
template<class T > |
T | find (const std::string &k, bool &found) const |
| Find a Parameter value in the set, and return its value as a type T. More...
|
|
template<class T > |
void | find_array (const key_type &k, std::vector< T > &vec) const |
| Find a Parameter value in the set, and return its value as a vector of T's. More...
|
|
void | print_all_params (std::ostream &os, std::string prefix="") const |
| Print all key/value parameter pairs to specified ostream.
|
|
void | print_all_params (Output &out, std::string prefix="") const |
|
void | insert (std::string key, std::string value, bool overwrite=true) |
| Add a key value pair into the param object.
|
|
void | insert (const Params ¶ms) |
|
std::set< std::string > | getKeys () const |
|
Params | find_prefix_params (std::string prefix) const |
| Returns a new parameter object with parameters that match the specified prefix.
|
|
bool | contains (const key_type &k) |
|
void | pushAllowedKeys (const KeySet_t &keys) |
|
void | popAllowedKeys () |
| Removes the most recent set of keys considered allowed.
|
|
void | verifyParam (const key_type &k) const |
|
void | serialize_order (SST::Core::Serialization::serializer &ser) override |
|
uint32_t | getKey (const std::string &str) const |
|
uint32_t | getKey (const std::string &str) |
|
friend | int ::main (int argc, char *argv[]) |
|
virtual const char * | cls_name () const =0 |
|
virtual uint32_t | cls_id () const =0 |
|
virtual std::string | serialization_name () const =0 |
|
Parameter store.
Stores key-value pairs as std::strings and provides a templated find method for finding values and converting them to arbitrary types (
- See also
- find()).
template<class T >
T SST::Params::find |
( |
const std::string & |
k, |
|
|
T |
default_value, |
|
|
bool & |
found |
|
) |
| const |
|
inline |
Find a Parameter value in the set, and return its value as a type T.
Type T must be either a basic numeric type (including bool) , a std::string, or a class that has a constructor with a std::string as its only parameter. This class uses SST::Core::from_string to do the conversion.
- Parameters
-
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
found | - set to true if the the parameter was found |
- Exceptions
-
std::invalid_argument | If value in (key, value) can't be converted to type T, an invalid_argument exception is thrown. |
References verifyParam().
Referenced by SST::Statistics::StatisticOutputJSON::checkOutputParameters(), SST::Statistics::StatisticOutputConsole::checkOutputParameters(), SST::Statistics::StatisticOutputCSV::checkOutputParameters(), SST::Statistics::StatisticOutputTxt::checkOutputParameters(), SST::Statistics::StatisticOutputHDF5::checkOutputParameters(), find(), and SST::Statistics::StatisticBase::StatisticBase().
template<class T >
T SST::Params::find |
( |
const std::string & |
k, |
|
|
std::string |
default_value, |
|
|
bool & |
found |
|
) |
| const |
|
inline |
Find a Parameter value in the set, and return its value as a type T.
Type T must be either a basic numeric type (including bool) , a std::string, or a class that has a constructor with a std::string as its only parameter. This class uses SST::Core::from_string to do the conversion.
- Parameters
-
k | - Parameter name |
default_value | - Default value to return if parameter isn't found, specified as a string |
found | - set to true if the the parameter was found |
References verifyParam().
template<class T >
void SST::Params::find_array |
( |
const key_type & |
k, |
|
|
std::vector< T > & |
vec |
|
) |
| const |
|
inline |
Find a Parameter value in the set, and return its value as a vector of T's.
The array will be appended to the end of the vector. Type T must be either a basic numeric type (including bool) , a std::string, or a class that has a constructor with a std::string as its only parameter. This class uses SST::Core::from_string to do the conversion.
- Parameters
-
k | - Parameter name |
vec | - vector to append array items to |
References verifyParam().