12 #ifndef SST_CORE_SERIALIZATION_OBJECTMAP_H    13 #define SST_CORE_SERIALIZATION_OBJECTMAP_H    15 #include "sst/core/from_string.h"    16 #include "sst/core/warnmacros.h"    23 namespace Serialization {
    70     static std::vector<std::pair<std::string, ObjectMap*>> 
emptyVars;
   100     virtual void set_impl(
const std::string& UNUSED(value)) {}
   106     virtual void deactivate_callback() {}
   109     int32_t refCount_ = 1;
   118     inline bool isReadOnly() { 
return read_only_; }
   119     inline void setReadOnly() { 
read_only_ = 
true; }
   144     virtual std::string 
getType() = 0;
   178         if ( refCount_ == 0 ) { 
delete this; }
   232     virtual std::string 
get() { 
return ""; }
   245     void set(
const std::string& value)
   263     virtual std::string 
get(
const std::string& var);
   283     virtual void set(
const std::string& var, 
const std::string& value, 
bool& found, 
bool& read_only);
   331     virtual std::string 
listVariable(std::string name, 
bool& found, 
int recurse = 0);
   343     virtual std::string 
list(
int recurse = 0);
   347     inline void activate(
ObjectMap* parent, 
const std::string& name)
   353     inline void deactivate()
   357         deactivate_callback();
   360     inline ObjectMap* findVariable(
const std::string& name)
   362         const std::vector<std::pair<std::string, ObjectMap*>>& variables = 
getVariables();
   363         for ( 
auto& x : variables ) {
   364             if ( x.first == name ) { 
return x.second; }
   369     std::string listRecursive(
const std::string& name, 
int level, 
int recurse);
   391             if ( obj.second != 
nullptr ) obj.second->
decRefCount();
   403         variables_.push_back(std::make_pair(name, obj));
   500 template <
typename T>
   510     virtual std::string 
get() 
override { 
return std::to_string(*
addr_); }
   511     virtual void        set_impl(
const std::string& value)
 override { *
addr_ = SST::Core::from_string<T>(value); }
   545 #endif // SST_CORE_SERIALIZATION_OBJECTMAP_H bool isFundamental() override
Check to see if this ObjectMap represents a fundamental or a class treated as a fundamental. 
Definition: objectMap.h:513
virtual ~ObjectMap()
Destructor. 
Definition: objectMap.h:306
void * addr_
Address of the variable for reading and writing. 
Definition: objectMap.h:465
virtual bool isFundamental()
Check to see if this ObjectMap represents a fundamental or a class treated as a fundamental. 
Definition: objectMap.h:292
ObjectMap object to create a level of hierarchy that doesn't represent a specific object...
Definition: objectMap.h:424
const std::vector< std::pair< std::string, ObjectMap * > > & getVariables() override
Get the list of child variables contained in this ObjectMap. 
Definition: objectMap.h:414
bool read_only_
Indicates wheter or not the variable is read-only. 
Definition: objectMap.h:93
virtual std::string listVariable(std::string name, bool &found, int recurse=0)
Create a string that lists information for the specified variable. 
Definition: objectMap.cc:155
static std::vector< std::pair< std::string, ObjectMap * > > emptyVars
Static empty variable vector for use by versions that don't have variables (i.e. 
Definition: objectMap.h:70
ObjectMap object fundamental types, and classes treated as fundamental types. 
Definition: objectMap.h:501
T * addr_
Address of the variable for reading and writing. 
Definition: objectMap.h:507
virtual void set_impl(const std::string &UNUSED(value))
Function implemented by derived classes to implement set(). 
Definition: objectMap.h:100
virtual const std::vector< std::pair< std::string, ObjectMap * > > & getVariables()
Get the list of child variables contained in this ObjectMap. 
Definition: objectMap.h:161
ObjectMap()
Default constructor primarily used for the "top" object in the hierarchy. 
Definition: objectMap.h:115
void * getAddr() override
Get the address of the represented object. 
Definition: objectMap.h:490
void addVariable(const std::string &name, ObjectMap *obj) override
Adds a variable to this ObjectMap. 
Definition: objectMap.h:401
Class created by the serializer mapping mode used to map the variables for objects. 
Definition: objectMap.h:61
virtual bool isContainer()
Check to see if this ObjectMap represents a container. 
Definition: objectMap.h:300
ObjectMapMetaData * mdata_
Metedata object for walking the object hierarchy. 
Definition: objectMap.h:87
virtual void activate_callback()
Function that will get called when this object is selected. 
Definition: objectMap.h:105
ObjectMap object for non-fundamental, non-container types. 
Definition: objectMap.h:453
ObjectMap * selectParent()
Get the parent for this ObjectMap. 
Definition: objectMap.cc:51
int32_t getRefCount()
Get the current reference count. 
Definition: objectMap.h:186
virtual void * getAddr()=0
Get the address of the variable represented by the ObjectMap. 
void * getAddr() override
Get the address of the variable represented by the ObjectMap. 
Definition: objectMap.h:520
std::string type_
Type of the variable as given by the demangled version of typeif<T>.name() for the type...
Definition: objectMap.h:460
ObjectMap object for non-fundamental, non-container types. 
Definition: objectMap.h:377
std::string getType() override
Returns empty string since there is no underlying object being represented. 
Definition: objectMap.h:437
std::string getName()
Get the name of the variable represented by this ObjectMap. 
Definition: objectMap.cc:29
std::string getType() override
Get the type of the represented object. 
Definition: objectMap.h:483
virtual std::string list(int recurse=0)
Create a string that lists information for the current object. 
Definition: objectMap.cc:179
static std::string demangle_name(const char *name)
Static function to demangle type names returned from typeid<T>.name() 
Definition: objectMap.cc:139
void * getAddr() override
Returns nullptr since there is no underlying object being represented. 
Definition: objectMap.h:445
const std::vector< std::pair< std::string, ObjectMap * > > & getVariables() override
Get the list of child variables contained in this ObjectMap, which in this case will be empty...
Definition: objectMap.h:531
std::string getFullName()
Get the full hierarchical name of the variable represented by this ObjectMap, based on the path taken...
Definition: objectMap.cc:36
virtual void addVariable(const std::string &UNUSED(name), ObjectMap *UNUSED(obj))
Adds a varaible to this ObjectMap. 
Definition: objectMap.h:220
void decRefCount()
Decreament the reference counter for this object map. 
Definition: objectMap.h:175
void incRefCount()
Increament the reference counter for this object map. 
Definition: objectMap.h:167
std::string getType() override
Get the type of the variable represented by the ObjectMap. 
Definition: objectMap.h:537
ObjectMap * selectVariable(std::string name, bool &loop_detected)
Get the ObjectMap for the specified variable. 
Definition: objectMap.cc:61
std::vector< std::pair< std::string, ObjectMap * > > variables_
Vector that child ObjectMaps are stored in. 
Definition: objectMap.h:383
virtual std::string getType()=0
Get the type of the variable represented by the ObjectMap.