SST
6.0.0
StructuralSimulationToolkit
|
Parameter store. More...
#include <params.h>
Public Types | |
typedef std::string | key_type |
typedef std::set< key_type, KeyCompare > | KeySet_t |
Public Member Functions | |
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) |
Map assignment operator. More... | |
void | clear () |
Erases all elements in a map. More... | |
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, 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) 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... | |
int64_t | find_integer (const key_type &k, long default_value, bool &found) const |
Find a Parameter value in the set, and return its value as an integer. More... | |
int64_t | find_integer (const key_type &k, long default_value=-1) const |
Find a Parameter value in the set, and return its value as an integer. More... | |
void | find_integer_array (const key_type &k, std::vector< int64_t > &vec) const |
Find a Parameter value in the set, and return its value as a vector of integers. More... | |
double | find_floating (const key_type &k, double default_value, bool &found) const |
Find a Parameter value in the set, and return its value as a double. More... | |
double | find_floating (const key_type &k, double default_value=-1.0) const |
Find a Parameter value in the set, and return its value as a double. More... | |
void | find_floating_array (const key_type &k, std::vector< double > &vec) const |
Find a Parameter value in the set, and return its value as a vector of floats. More... | |
std::string | find_string (const key_type &k, std::string default_value, bool &found) const |
Find a Parameter value in the set, and return its value. More... | |
std::string | find_string (const key_type &k, std::string default_value="") const |
Find a Parameter value in the set, and return its value. More... | |
void | find_string_array (const key_type &k, std::vector< std::string > &vec) const |
Find a Parameter value in the set, and return its value as a vector of strings. More... | |
void | print_all_params (std::ostream &os, std::string prefix="") const |
Print all key/value parameter pairs to specified ostream. | |
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) |
uint32_t | getKey (const std::string &str) const |
uint32_t | getKey (const std::string &str) |
friend | int::main (int argc, char *argv[]) |
Public Member Functions inherited from SST::Core::Serialization::serializable | |
virtual const char * | cls_name () const =0 |
virtual uint32_t | cls_id () const =0 |
Static Public Member Functions | |
static void | enableVerify () |
Enable, on a global scale, parameter verification. More... | |
static const std::string & | getParamName (uint32_t id) |
Given a Parameter Key ID, return the Name of the matching parameter. More... | |
Data Fields | |
ImplementSerializable(SST::Params) private std::vector< KeySet_t > | allowedKeys |
bool | verify_enabled |
Static Public Attributes | |
static bool | g_verify_enabled = false |
static std::map< std::string, uint32_t > | keyMap |
static std::vector< std::string > | keyMapReverse |
static SST::Core::ThreadSafe::Spinlock | keyLock |
static uint32_t | nextKeyID |
Additional Inherited Members | |
Protected Types inherited from SST::Core::Serialization::serializable | |
enum | cxn_flag_t { ConstructorFlag } |
Static Protected Member Functions inherited from SST::Core::Serialization::serializable | |
static void | serializable_abort (uint32_t line, const char *file, const char *func, const char *obj) |
Parameter store.
Meets the requirements of a container, a reversible container, and an associative container (using unique keys). For a map<Key,T>
the key_type is Key, the mapped_type is T, and the value_type is std::pair<const Key,T>.
typedef std::string SST::Params::key_type |
Type of key (string)
typedef std::set<key_type, KeyCompare> SST::Params::KeySet_t |
Type of a set of keys
|
inline |
Erases all elements in a map.
Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibilty.
|
inline |
k | Key to search for |
|
inline |
Finds the number of elements with given key.
k | Key of (key, value) pairs to be located. |
This function only makes sense for multimaps; for map the result will either be 0 (not present) or 1 (present).
|
inline |
Returns true if the Params is empty.
(Thus begin() would equal end().)
|
inline |
Enable or disable parameter verification on an instance of Params.
Useful when generating a new set of Params to pass off to a module.
Referenced by find_prefix_params().
|
inlinestatic |
Enable, on a global scale, parameter verification.
Used after construction of the config graph so that warnings are not generated during construction.
Referenced by SST::Simulation::performWireUp().
|
inline |
Find a Parameter value in the set, and return its value as a type T.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
found | - set to true if the the parameter was found |
References verifyParam().
Referenced by SST::Statistics::StatisticOutputCSV::checkOutputParameters(), SST::Statistics::StatisticOutputTxt::checkOutputParameters(), SST::Statistics::StatisticOutputConsole::checkOutputParameters(), and find().
|
inline |
Find a Parameter value in the set, and return its value as a type T.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
References find().
|
inline |
Find a Parameter value in the set, and return its value as a type T.
k | - Parameter name |
References find().
|
inline |
Find a Parameter value in the set, and return its value as a type T.
k | - Parameter name |
found | - set to true if the the parameter was found |
References find().
|
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.
k | - Parameter name |
vec | - vector to append array items to |
References verifyParam().
|
inline |
Find a Parameter value in the set, and return its value as a double.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
found | - set to true if the the parameter was found |
|
inline |
Find a Parameter value in the set, and return its value as a double.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
|
inline |
Find a Parameter value in the set, and return its value as a vector of floats.
The array of floats will be appended to the end of the vector.
k | - Parameter name |
vec | - vector to append array items to |
|
inline |
Find a Parameter value in the set, and return its value as an integer.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
found | - set to true if the the parameter was found |
|
inline |
Find a Parameter value in the set, and return its value as an integer.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
|
inline |
Find a Parameter value in the set, and return its value as a vector of integers.
The array of integers will be appended to the end of the vector.
k | - Parameter name |
vec | - vector to append array items to |
|
inline |
Find a Parameter value in the set, and return its value.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
found | - set to true if the the parameter was found |
|
inline |
Find a Parameter value in the set, and return its value.
k | - Parameter name |
default_value | - Default value to return if parameter isn't found |
|
inline |
Find a Parameter value in the set, and return its value as a vector of strings.
The array of strings will be appended to the end of the vector.
k | - Parameter name |
vec | - vector to append array items to |
|
inlinestatic |
Given a Parameter Key ID, return the Name of the matching parameter.
id | Key ID to look up |
Map assignment operator.
old | A map of identical element and allocator types. |
All the elements of x are copied, but unlike the copy constructor, the allocator object is not copied.
|
inline |
keys | Set of keys to consider valid to add to the stack of legal keys |
Referenced by SST::Factory::CreateComponent(), SST::Factory::CreateIntrospector(), SST::Factory::CreateModule(), SST::Factory::CreateModuleWithComponent(), and SST::Factory::CreateSubComponent().
|
inline |
Returns the size of the Params.
|
inline |
k | Key to check for validity |
References SST::Output::output(), and SST::Output::STDERR.
Referenced by find(), and find_array().