SST
14.1.0
StructuralSimulationToolkit
|
Class created by the serializer mapping mode used to map the variables for objects. More...
#include <objectMap.h>
Public Member Functions | |
ObjectMap () | |
Default constructor primarily used for the "top" object in the hierarchy. | |
bool | isReadOnly () |
void | setReadOnly () |
std::string | getName () |
Get the name of the variable represented by this ObjectMap. More... | |
std::string | getFullName () |
Get the full hierarchical name of the variable represented by this ObjectMap, based on the path taken to get to this object. More... | |
virtual std::string | getType ()=0 |
Get the type of the variable represented by the ObjectMap. More... | |
virtual void * | getAddr ()=0 |
Get the address of the variable represented by the ObjectMap. More... | |
virtual const std::vector< std::pair< std::string, ObjectMap * > > & | getVariables () |
Get the list of child variables contained in this ObjectMap. More... | |
void | incRefCount () |
Increament the reference counter for this object map. | |
void | decRefCount () |
Decreament the reference counter for this object map. More... | |
int32_t | getRefCount () |
Get the current reference count. More... | |
ObjectMap * | selectParent () |
Get the parent for this ObjectMap. More... | |
ObjectMap * | selectVariable (std::string name, bool &loop_detected) |
Get the ObjectMap for the specified variable. More... | |
virtual void | addVariable (const std::string &UNUSED(name), ObjectMap *UNUSED(obj)) |
Adds a varaible to this ObjectMap. More... | |
virtual std::string | get () |
Get the value of the variable as a string. More... | |
void | set (const std::string &value) |
Sets the value of the variable represented by the ObjectMap to the specified value, which is represented as a string. More... | |
virtual std::string | get (const std::string &var) |
Gets the value of the specified variable as a string. More... | |
virtual void | set (const std::string &var, const std::string &value, bool &found, bool &read_only) |
Sets the value of the specified variable to the specified value, which is represented as a string. More... | |
virtual bool | isFundamental () |
Check to see if this ObjectMap represents a fundamental or a class treated as a fundamental. More... | |
virtual bool | isContainer () |
Check to see if this ObjectMap represents a container. More... | |
virtual | ~ObjectMap () |
Destructor. | |
virtual std::string | listVariable (std::string name, bool &found, int recurse=0) |
Create a string that lists information for the specified variable. More... | |
virtual std::string | list (int recurse=0) |
Create a string that lists information for the current object. More... | |
Static Public Member Functions | |
static std::string | demangle_name (const char *name) |
Static function to demangle type names returned from typeid<T>.name() More... | |
Protected Member Functions | |
virtual void | set_impl (const std::string &UNUSED(value)) |
Function implemented by derived classes to implement set(). More... | |
virtual void | activate_callback () |
Function that will get called when this object is selected. | |
virtual void | deactivate_callback () |
Protected Attributes | |
ObjectMapMetaData * | mdata_ = nullptr |
Metedata object for walking the object hierarchy. More... | |
bool | read_only_ = false |
Indicates wheter or not the variable is read-only. | |
Static Protected Attributes | |
static std::vector< std::pair< std::string, ObjectMap * > > | emptyVars |
Static empty variable vector for use by versions that don't have variables (i.e. More... | |
Class created by the serializer mapping mode used to map the variables for objects.
This allows access to read and write the mapped variables. The base class is used for non-fundamental and non-container types, but there is a templated child class used for fundameentals and containers. The templating is needed so that the type information can be embedded in the code for reading and writing.
|
inlinevirtual |
Adds a varaible to this ObjectMap.
NOTE: calls to this function will be ignore if isFundamental() returns true.
name | Name of the object in the context of the parent class |
obj | ObjectMap to add as a variable |
|
inline |
Decreament the reference counter for this object map.
If this reference count reaches zero, the object will delete itself. NOTE: delete should not be called directly on this object and should only be done automatically using decRefCount().
|
static |
Static function to demangle type names returned from typeid<T>.name()
name | typename returned from typid<T>.name() |
Referenced by SST::Core::Serialization::ObjectMapVector< T >::getType(), SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >::getType(), and SST::Core::Serialization::ObjectMapFundamental< T >::getType().
|
inlinevirtual |
Get the value of the variable as a string.
NOTE: this function is only valid for ObjectMaps that represent fundamental types or classes treated as fundamental types.
Reimplemented in SST::Core::Serialization::ObjectMapFundamental< T >, SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >, SST::Core::Serialization::ObjectMapFundamental< TimeConverter * >, and SST::Core::Serialization::ObjectMapString.
Referenced by get().
|
virtual |
Gets the value of the specified variable as a string.
NOTE: this function is only valid for ObjectMaps that represent non-fundamental types or classes not treated as fundamental types.
var | Name of variable |
References get(), isFundamental(), selectParent(), and selectVariable().
|
pure virtual |
Get the address of the variable represented by the ObjectMap.
Implemented in SST::Core::Serialization::ObjectMapFundamental< T >, SST::Core::Serialization::ObjectMapClass, SST::Core::Serialization::ObjectMapHierarchyOnly, SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >, SST::Core::Serialization::ObjectMapFundamental< TimeConverter * >, SST::Core::Serialization::ObjectMapDeferred< T >, SST::Core::Serialization::ObjectMapVector< T >, and SST::Core::Serialization::ObjectMapString.
std::string SST::Core::Serialization::ObjectMap::getFullName | ( | ) |
Get the full hierarchical name of the variable represented by this ObjectMap, based on the path taken to get to this object.
References mdata_, SST::Core::Serialization::ObjectMapMetaData::name, and SST::Core::Serialization::ObjectMapMetaData::parent.
std::string SST::Core::Serialization::ObjectMap::getName | ( | ) |
Get the name of the variable represented by this ObjectMap.
References mdata_, and SST::Core::Serialization::ObjectMapMetaData::name.
|
inline |
Get the current reference count.
|
pure virtual |
Get the type of the variable represented by the ObjectMap.
Implemented in SST::Core::Serialization::ObjectMapFundamental< T >, SST::Core::Serialization::ObjectMapClass, SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >, SST::Core::Serialization::ObjectMapHierarchyOnly, SST::Core::Serialization::ObjectMapFundamental< TimeConverter * >, SST::Core::Serialization::ObjectMapString, SST::Core::Serialization::ObjectMapVector< T >, and SST::Core::Serialization::ObjectMapDeferred< T >.
Referenced by listVariable().
|
inlinevirtual |
Get the list of child variables contained in this ObjectMap.
Reimplemented in SST::Core::Serialization::ObjectMapFundamental< T >, SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >, SST::Core::Serialization::ObjectMapWithChildren, SST::Core::Serialization::ObjectMapFundamental< TimeConverter * >, SST::Core::Serialization::ObjectMapDeferred< T >, and SST::Core::Serialization::ObjectMapString.
References emptyVars.
Referenced by SST::Core::Serialization::ObjectMapDeferred< T >::getVariables().
|
inlinevirtual |
Check to see if this ObjectMap represents a container.
Reimplemented in SST::Core::Serialization::ObjectMapVector< T >.
|
inlinevirtual |
Check to see if this ObjectMap represents a fundamental or a class treated as a fundamental.
Reimplemented in SST::Core::Serialization::ObjectMapFundamental< T >, SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >, SST::Core::Serialization::ObjectMapFundamental< TimeConverter * >, and SST::Core::Serialization::ObjectMapString.
Referenced by get().
|
virtual |
Create a string that lists information for the current object.
This will list all child variables, including the values for any children that are fundamentals.
recurse | number of levels to recurse (default is 0) |
References mdata_, and SST::Core::Serialization::ObjectMapMetaData::name.
|
virtual |
Create a string that lists information for the specified variable.
This will list all child variables, including the values for any children that are fundamentals.
name | name of variable to list | |
[out] | found | Set to true if variable is found, set to false otherwise |
recurse | number of levels to recurse (default is 0) |
ObjectMap * SST::Core::Serialization::ObjectMap::selectParent | ( | ) |
ObjectMap * SST::Core::Serialization::ObjectMap::selectVariable | ( | std::string | name, |
bool & | loop_detected | ||
) |
|
inline |
Sets the value of the variable represented by the ObjectMap to the specified value, which is represented as a string.
The templated child classes for fundamentals will know how to convert the string to a value of the approproprite type. NOTE: this fucntion is only value for ObjectMaps that represent fundamental types or classes treated as fundamentatl types.
value | Value to set the object to represented as a string |
References read_only_, and set_impl().
Referenced by set().
|
virtual |
Sets the value of the specified variable to the specified value, which is represented as a string.
The templated child classes for fundamentals will know how to convert the string to a value of the approproprite type. NOTE: this fucntion is only valuid for ObjectMaps that represent non-fundamental types or classes not treated as fundamentatl types (i.e. they must have childrent).
var | Name of variable | |
value | Value to set var to represented as a string | |
[out] | found | Set to true if var is found, set to false otherwise |
[out] | read_only | Set to true if var is read-only, set to false otherwise |
References selectParent(), selectVariable(), and set().
|
inlineprotectedvirtual |
Function implemented by derived classes to implement set().
No need to check for read_only, that is done in set().
Reimplemented in SST::Core::Serialization::ObjectMapFundamental< TimeConverter * >.
Referenced by set().
|
staticprotected |
Static empty variable vector for use by versions that don't have variables (i.e.
are fundamentals or classes treated as fundamentals. This is needed because getVariables() returns a reference to the vector.
Referenced by SST::Core::Serialization::ObjectMapString::getVariables(), getVariables(), SST::Core::Serialization::ObjectMapFundamental< UnitAlgebra >::getVariables(), and SST::Core::Serialization::ObjectMapFundamental< T >::getVariables().
|
protected |
Metedata object for walking the object hierarchy.
When this object is selected by a parent object, a metadata object will be added. The metadata contains a pointer to the parent and the name of this object in the context of the parent. If this object is selected and the metadata is non a nullptr, then we have hit a loop in the data structure.
Under normal circumstances, the metadata allows you to get the full path of the object according to how you walked the hierarchy, and allows you to return to the parent object. If a loop is detected on select, then the full path of the object will return to the highest level path and the metadata from that path to the current path will be erased.
Referenced by getFullName(), getName(), list(), listVariable(), selectParent(), and selectVariable().