SST 16.1.0
Structural Simulation Toolkit
SST::Core::Serialization::ObjTree< Obj_T > Class Template Reference
Inheritance diagram for SST::Core::Serialization::ObjTree< Obj_T >:
SST::Core::Serialization::ObjTreeCont

Public Member Functions

 ObjTree (NodeKind kind)
 ObjTree (const ObjTree< Obj_T > &rhs)
ObjTree< Obj_T > & operator= (const ObjTree< Obj_T > &other)
void BuildTree (const ComponentInfoMap &compMap)
 Each time we break into the debugger we rebuild the ObjectTree based on the current ComponentInfoMap.
Obj_T & getObj ()
const Obj_T & getObj () const
template<typename ObjectType, typename Func>
void applyRecursiveByType (Func &&func)
std::string getTypeName () const override
bool isEmpty ()
void Dump (const int verbosity, std::ios_base::fmtflags base=std::ios_base::dec, std::ostream &os=std::cout) override
 Print the contents of the node to the stream specified by os.
void clear () override
 Clears the entire Object Tree and frees all nodes.
Public Member Functions inherited from SST::Core::Serialization::ObjTreeCont
 ObjTreeCont (const std::string &name, const std::string &type, NodeKind kind=NodeKind::Generic)
 ObjTreeCont (const ObjTreeCont &rhs)
ObjTreeCont & operator= (const ObjTreeCont &rhs)
virtual ObjTreeCont * clone () const
void addChildObj (ObjTreeCont *obj)
 Adds a child node to the current node.
void setParent (ObjTreeCont *p)
ObjTreeCont * getParent () const
const std::vector< std::unique_ptr< ObjTreeCont > > & getChildren () const
const std::string & getObjName () const
const std::string & getType () const
void setName (const std::string &name)
void setType (const std::string &type)
 Set the type of the node - this comes from ObjectMap/Serialization.
bool isRoot ()
 Returns true if this is the top of the tree - determined by the parent pointer being nullptr.
void makeReadOnly ()
 Function that will be called if during conversion from ObjectMap the node has been marked as ReadOnly.
bool isReadOnly ()
template<typename Func>
void applyRecursive (Func &&func)
 Apply a function to all children of this node regardless of type, etc.
template<typename ObjectType, typename Func>
void applyRecursiveByType (Func &&func)
 Apply a function to all children of this node of a specific type.
template<typename ObjectType, typename Func>
ObjectType * findByType (Func &&predicate)
 Find the first instance of a particular type in this node's children_ that matches criteria set by predicate.
ObjTreeCont * findByName (const std::string name)
 Find the first instance of a child with name_ matching name.
virtual void apply ()
virtual bool setFromString (const std::string &value)
 Set the value stored in the node from a string.
virtual void syncFromSim ()
 This function will update the local stored node value with the live value in the sst simulation.
virtual bool hasChanged ()
 This function will compare the stored the node value with the live simulation value.
NodeKind getKind () const
bool isComponent () const
bool isLeaf () const

Protected Attributes

std::vector< std::unique_ptr< ObjTreeCont > > objects_
Protected Attributes inherited from SST::Core::Serialization::ObjTreeCont
ObjTreeCont * parent_ = nullptr
std::vector< std::unique_ptr< ObjTreeCont > > children_
std::string name_ = "uninit"
std::string type_ = "uninit"
NodeKind kind_ = NodeKind::Generic
bool readOnly_ = false

Additional Inherited Members

Public Types inherited from SST::Core::Serialization::ObjTreeCont
enum class  NodeKind {
  Generic , Integer , Float , String ,
  Bool , Component , Container , FRef ,
  GenericVal
}
Static Protected Member Functions inherited from SST::Core::Serialization::ObjTreeCont
static void replaceAll (std::string &s, std::string_view from, std::string_view to)
static std::string prettifyType (std::string t)

Member Function Documentation

◆ BuildTree()

template<typename Obj_T>
void SST::Core::Serialization::ObjTree< Obj_T >::BuildTree ( const ComponentInfoMap & compMap)

Each time we break into the debugger we rebuild the ObjectTree based on the current ComponentInfoMap.

A helper class is employed, ObjectMapToTree, which performs the conversion. The initial conversion of the component map will strictly be the top level components - the remainder of the tree is built dynamically through cd or through a call to print with a -r (recursive) option. When a user cd’s into a component for the first time all elements in that component except Sub Components are serialized and converted into ObjTree node types by the ObjectMapToTree class.

Parameters
compMap- The current Component Info Map supplied by the SST simulation
Returns
none

References SST::Core::Serialization::ObjTreeCont::addChildObj().

◆ clear()

template<typename Obj_T>
void SST::Core::Serialization::ObjTree< Obj_T >::clear ( )
inlineoverridevirtual

Clears the entire Object Tree and frees all nodes.

Reimplemented from SST::Core::Serialization::ObjTreeCont.

References SST::Core::Serialization::ObjTreeCont::clear().

◆ Dump()

template<typename Obj_T>
void SST::Core::Serialization::ObjTree< Obj_T >::Dump ( const int verbosity,
std::ios_base::fmtflags base = std::ios_base::dec,
std::ostream & os = std::cout )
inlineoverridevirtual

Print the contents of the node to the stream specified by os.

Verbosity Level 0 will only print "/" - applicable to the root node only. Any higher Verbosity will trigger a call to Dump() to all children.

Parameters
verbosity- Level 0: Print this node only, which for the base class is "/" Level > 0: Call Dump on all children_
base- Control the base (dec, hex, oct) to print numerical values in. Default dec.
os- Stream to send the output. Default std::cout
Returns
pointer to node, if found, nullptr otherwise

Reimplemented from SST::Core::Serialization::ObjTreeCont.

Reimplemented in SST::Core::Serialization::StringObj.

◆ getTypeName()

template<typename Obj_T>
std::string SST::Core::Serialization::ObjTree< Obj_T >::getTypeName ( ) const
inlineoverridevirtual

The documentation for this class was generated from the following files: