12#ifndef SST_CORE_SERIALIZATION_OBJECTTREE_DEBUGGER_H
13#define SST_CORE_SERIALIZATION_OBJECTTREE_DEBUGGER_H
15#include "sst/core/baseComponent.h"
16#include "sst/core/componentInfo.h"
17#include "sst/core/from_string.h"
18#include "sst/core/serialization/ObjTreeLeaves.h"
19#include "sst/core/serialization/objectMapDeferred.h"
20#include "sst/core/warnmacros.h"
42#include <unordered_set>
46namespace SST::Core::Serialization {
49class ComponentObj :
public ObjTree<ComponentObj>
57 ComponentObj() =
default;
59 ObjTree<ComponentObj>(NodeKind::Component),
66 ComponentObj(
const ComponentObj& rhs) :
67 ObjTree<ComponentObj>(rhs),
69 compInfo_(rhs.compInfo_)
72 ComponentObj& operator=(
const ComponentObj& rhs)
74 if (
this == &rhs )
return *
this;
75 ObjTree<ComponentObj>::operator=(rhs);
77 compInfo_ = rhs.compInfo_;
81 ObjTreeCont* clone()
const override {
return new ComponentObj(*
this); }
88 void apply()
override { std::cout <<
"Processing component: " << val_->
getName() << std::endl; }
89 void Dump([[maybe_unused]]
const int verbosity, [[maybe_unused]] std::ios_base::fmtflags base = std::ios_base::dec,
90 std::ostream& os = std::cout)
override
92 if ( verbosity < 3 ) {
93 os << val_->getName() <<
"/" << std::endl;
96 os << val_->getName() <<
"/ (" << compInfo_->getType() <<
")" << std::endl;
103 applyRecursiveByType<ComponentObj>([&result, &name](
ComponentObj* obj) {
104 if ( obj->getVal()->
getName() == name ) {
112template <
typename Obj_T>
116 if ( !children_.empty() ) {
117 std::cout <<
"WARNING: Calling BuildTree on non-empty ObjTree" << std::endl;
119 for (
auto comp = compMap.begin(); comp != compMap.end(); comp++ ) {
126 std::sort(children_.begin(), children_.end(),
127 [](
const std::unique_ptr<ObjTreeCont>& a,
const std::unique_ptr<ObjTreeCont>& b) {
128 return a->getObjName() < b->getObjName();
Main component object for the simulation.
Definition baseComponent.h:98
const std::string & getName() const
Get the name of the BaseComponent.
Definition baseComponent.h:151
Definition componentInfo.h:285
Definition componentInfo.h:45
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.
Definition ObjTree.h:89
The Object Tree (ObjTree) is intended to be a developer friendly interface to SST’s existing serializ...
Definition ObjTreeLeaves.h:41
void addChildObj(ObjTreeCont *obj)
Adds a child node to the current node.
Definition ObjTreeLeaves.h:103
void BuildTree(const ComponentInfoMap &compMap)
Each time we break into the debugger we rebuild the ObjectTree based on the current ComponentInfoMap.
Definition ObjTree.h:114