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

Public Types

using FloatVariant = std::variant<float, double, long double>
Public Types inherited from SST::Core::Serialization::ObjTreeCont
enum class  NodeKind {
  Generic , Integer , Float , String ,
  Bool , Component , Container , FRef ,
  GenericVal
}

Public Member Functions

template<typename T>
 FloatObj (T v, void *addr)
 FloatObj (std::function< long double()> getter, std::function< void(long double)> setter)
 FloatObj (const FloatObj &rhs)
FloatObj & operator= (const FloatObj &rhs)
ObjTreeCont * clone () const override
template<typename T>
T getVal () const
template<typename T>
void setVal (T v)
template<typename T>
void setSimVal (T v)
virtual void syncFromSim () override
 This function will update the local stored node value with the live value in the sst simulation.
virtual bool hasChanged () override
 This function will compare the stored the node value with the live simulation value.
template<typename Visitor>
auto visit (Visitor &&visitor)
template<typename Visitor>
auto visit (Visitor &&visitor) const
void apply () override
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.
bool setFromString (const std::string &value) override
 Set the value stored in the node from a string.
Public Member Functions inherited from SST::Core::Serialization::ObjTree< FloatObj >
ObjTree< FloatObj > & operator= (const ObjTree< FloatObj > &other)
void BuildTree (const ComponentInfoMap &compMap)
 Each time we break into the debugger we rebuild the ObjectTree based on the current ComponentInfoMap.
FloatObj & getObj ()
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)
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.
NodeKind getKind () const
bool isComponent () const
bool isLeaf () const

Additional Inherited Members

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)
Protected Attributes inherited from SST::Core::Serialization::ObjTree< FloatObj >
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

Member Function Documentation

◆ apply()

void SST::Core::Serialization::FloatObj::apply ( )
inlineoverridevirtual

◆ clone()

ObjTreeCont * SST::Core::Serialization::FloatObj::clone ( ) const
inlineoverridevirtual

◆ Dump()

void SST::Core::Serialization::FloatObj::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.

◆ hasChanged()

virtual bool SST::Core::Serialization::FloatObj::hasChanged ( )
inlineoverridevirtual

This function will compare the stored the node value with the live simulation value.

This function will NOT modify the stored value - an independent call to syncFromSim() is required.

Returns
true if the value in the live simulation differs from the stored node value. false otherwise

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

◆ setFromString()

bool SST::Core::Serialization::FloatObj::setFromString ( const std::string & value)
inlineoverridevirtual

Set the value stored in the node from a string.

This function will be called when the user wants to update the live value in the SST simulation. The function will convert value into the correct type based on the tree node type.

Parameters
value- string representing the value you want to wrtie to the live sim
Returns
- true if successful, false otherwise

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

◆ syncFromSim()

virtual void SST::Core::Serialization::FloatObj::syncFromSim ( )
inlineoverridevirtual

This function will update the local stored node value with the live value in the sst simulation.

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


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