12#ifndef SST_CORE_SERIALIZATION_OBJECTTREELEAVES_DEBUGGER_H
13#define SST_CORE_SERIALIZATION_OBJECTTREELEAVES_DEBUGGER_H
32namespace SST::Core::Serialization {
43 enum class NodeKind { Generic, Integer, Float, String, Bool,
Component, Container, FRef, GenericVal };
46 ObjTreeCont* parent_ =
nullptr;
47 std::vector<std::unique_ptr<ObjTreeCont>> children_;
48 std::string name_ =
"uninit";
49 std::string type_ =
"uninit";
50 NodeKind kind_ = NodeKind::Generic;
51 bool readOnly_ =
false;
55 ObjTreeCont() =
default;
56 ObjTreeCont(
const std::string& name,
const std::string& type, NodeKind kind = NodeKind::Generic) :
61 virtual ~ObjTreeCont() =
default;
63 ObjTreeCont(
const ObjTreeCont& rhs) :
67 readOnly_(rhs.readOnly_)
69 children_.reserve(rhs.children_.size());
70 for (
const auto& child : rhs.children_ ) {
71 auto* cloned = child->clone();
72 cloned->parent_ =
this;
73 children_.emplace_back(cloned);
77 ObjTreeCont& operator=(
const ObjTreeCont& rhs)
79 if (
this == &rhs )
return *
this;
85 children_.reserve(rhs.children_.size());
86 for (
const auto& child : rhs.children_ ) {
87 auto* cloned = child->clone();
88 cloned->parent_ =
this;
89 children_.emplace_back(cloned);
94 virtual ObjTreeCont* clone()
const {
return new ObjTreeCont(*
this); }
105 children_.push_back(std::unique_ptr<ObjTreeCont>(obj));
111 const std::vector<std::unique_ptr<ObjTreeCont>>& getChildren()
const {
return children_; }
113 const std::string& getObjName()
const {
return name_; }
114 const std::string& getType()
const {
return type_; }
115 void setName(
const std::string& name) { name_ = name; }
124 void setType(
const std::string& type) { type_ = prettifyType(type); }
134 bool isRoot() {
return parent_ ==
nullptr; }
142 bool isReadOnly() {
return readOnly_; }
152 template <
typename Func>
155 for (
auto& child : children_ ) {
168 template <
typename ObjectType,
typename Func>
171 for (
auto& child : children_ ) {
172 if (
auto* child_t =
dynamic_cast<ObjectType*
>(child.get()) ) {
204 template <
typename ObjectType,
typename Func>
207 for (
auto& child : children_ ) {
208 if (
auto* child_t =
dynamic_cast<ObjectType*
>(child.get()) ) {
209 if ( predicate(child_t) )
return child_t;
225 for (
size_t i = 0; i < children_.size(); i++ ) {
226 if ( children_[i]->getObjName() == name ) {
227 return children_[i].get();
233 virtual void apply() {};
234 virtual std::string getTypeName()
const {
return type_; };
249 const int verbosity, std::ios_base::fmtflags base = std::ios_base::dec, std::ostream& os = std::cout)
251 os << name_ <<
"/ " << std::endl;
252 if ( verbosity > 0 ) {
265 virtual bool setFromString([[maybe_unused]]
const std::string& value) {
return false; }
282 NodeKind getKind()
const {
return kind_; }
283 bool isComponent()
const {
return kind_ == NodeKind::Component; }
286 return kind_ == NodeKind::Integer || kind_ == NodeKind::Float || kind_ == NodeKind::String ||
287 kind_ == NodeKind::Bool || kind_ == NodeKind::GenericVal;
293 virtual void clear() { children_.clear(); }
297 static void replaceAll(std::string& s, std::string_view from, std::string_view to)
299 if ( from.empty() )
return;
301 while ( (pos = s.find(from, pos)) != std::string::npos ) {
302 s.replace(pos, from.size(), to);
307 static std::string prettifyType(std::string t)
309 replaceAll(t,
"std::__1::",
"std::");
310 replaceAll(t,
"std::__cxx11::",
"std::");
311 replaceAll(t,
" ",
" ");
316template <
typename Obj_T>
317class ObjTree :
public ObjTreeCont
321 ObjTree(NodeKind kind) :
322 ObjTreeCont(
"",
"", kind)
325 ObjTree(
const ObjTree<Obj_T>& rhs) :
329 objects_.reserve(rhs.objects_.size());
330 for (
const auto& obj : rhs.objects_ ) {
331 auto* cloned = obj->clone();
332 cloned->setParent(
this);
333 objects_.emplace_back(cloned);
337 ObjTree<Obj_T>& operator=(
const ObjTree<Obj_T>& other)
339 if (
this == &other )
return *
this;
340 ObjTreeCont::operator=(other);
342 objects_.reserve(other.objects_.size());
343 for (
const auto& obj : other.objects_ ) {
344 auto* cloned = obj->clone();
345 cloned->setParent(
this);
346 objects_.emplace_back(cloned);
367 Obj_T& getObj() {
return static_cast<Obj_T&
>(*this); }
368 const Obj_T& getObj()
const {
return static_cast<const Obj_T&
>(*this); }
371 template <
typename ObjectType,
typename Func>
372 void applyRecursiveByType(Func&& func)
374 for (
auto& child : children_ ) {
375 if (
auto* child_t =
dynamic_cast<ObjectType*
>(child.get()) ) {
381 std::string getTypeName()
const override {
return typeid(Obj_T).name(); }
383 bool isEmpty() {
return objects_.empty() && children_.empty(); }
385 void Dump([[maybe_unused]]
const int verbosity, [[maybe_unused]] std::ios_base::fmtflags base = std::ios_base::dec,
386 std::ostream& os = std::cout)
override
388 os <<
"Root/" << std::endl;
401 std::vector<std::unique_ptr<ObjTreeCont>> objects_;
404class IntegerObj :
public ObjTree<IntegerObj>
407 using IntVariant = std::variant<int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t>;
411 void* addr_ =
nullptr;
412 std::function<int64_t()> getter_;
413 std::function<void(int64_t)> setter_;
414 bool useAccessor_ =
false;
417 template <
typename T>
418 IntegerObj(T v,
void* addr) :
419 ObjTree<IntegerObj>(NodeKind::Integer),
423 IntegerObj(std::function<int64_t()> getter, std::function<
void(int64_t)> setter) :
424 ObjTree<IntegerObj>(NodeKind::Integer),
426 getter_(std::move(getter)),
427 setter_(std::move(setter)),
430 if ( getter_ ) val_ =
static_cast<int64_t
>(getter_());
431 if ( !setter_ ) readOnly_ =
true;
434 IntegerObj(
const IntegerObj& rhs) :
435 ObjTree<IntegerObj>(rhs),
438 getter_(rhs.getter_),
439 setter_(rhs.setter_),
440 useAccessor_(rhs.useAccessor_)
442 IntegerObj& operator=(
const IntegerObj& rhs)
444 if (
this == &rhs )
return *
this;
445 ObjTree<IntegerObj>::operator=(rhs);
448 getter_ = rhs.getter_;
449 setter_ = rhs.setter_;
450 useAccessor_ = rhs.useAccessor_;
453 ObjTreeCont* clone()
const override {
return new IntegerObj(*
this); }
455 template <
typename T>
458 return std::get<T>(val_);
461 template <
typename T>
467 template <
typename T>
476 if ( useAccessor_ && getter_ ) {
477 const int64_t live = getter_();
478 std::visit([live](
auto& v) { v =
static_cast<std::decay_t<decltype(v)
>>(live); }, val_);
481 std::visit([
this](
auto& v) { v = *
static_cast<std::decay_t<decltype(v)
>*>(addr_); }, val_);
487 if ( useAccessor_ && getter_ ) {
488 const int64_t live = getter_();
489 return std::visit([live](
const auto& v) ->
bool {
return static_cast<int64_t
>(v) != live; }, val_);
493 [
this](
const auto& v) ->
bool {
return v != *
static_cast<std::decay_t<decltype(v)
>*>(addr_); }, val_);
498 template <
typename Visitor>
499 auto visit(Visitor&& visitor)
501 return std::visit(std::forward<Visitor>(visitor), val_);
504 template <
typename Visitor>
505 auto visit(Visitor&& visitor)
const
507 return std::visit(std::forward<Visitor>(visitor), val_);
510 void apply()
override
512 visit([](
auto val) { std::cout <<
"Processing integer: " <<
static_cast<int64_t
>(val) << std::endl; });
516 const int verbosity, std::ios_base::fmtflags base = std::ios_base::dec, std::ostream& os = std::cout)
override
518 std::string ro = (readOnly_) ?
" (ro)" :
"";
519 if ( verbosity == 0 ) {
520 os << getObjName() << ro << std::endl;
522 else if ( verbosity == 1 ) {
523 visit([&](
auto val) {
524 auto old_flags = os.flags();
525 os.setf(base, std::ios_base::basefield);
526 if ( base != std::ios_base::dec ) {
527 os.setf(std::ios_base::showbase);
529 os << getObjName() << ro <<
" = " <<
static_cast<int64_t
>(val) << std::endl;
534 visit([&](
auto val) {
535 auto old_flags = os.flags();
536 os.setf(base, std::ios_base::basefield);
537 if ( base != std::ios_base::dec ) {
538 os.setf(std::ios_base::showbase);
540 os << getObjName() << ro <<
" = " <<
static_cast<int64_t
>(val) <<
" (" << getType() <<
")" << std::endl;
548 std::cout <<
"WARNING Cannot set ReadOnly Obj " << name_ << std::endl;
552 visit([&](
auto& current) {
553 using T = std::decay_t<
decltype(current)>;
554 setSimVal(
static_cast<T
>(std::stoll(value)));
566 if ( !addr_ )
return;
567 std::visit([
this](
auto& v) { *
static_cast<std::decay_t<decltype(v)
>*>(addr_) = v; }, val_);
571class FloatObj :
public ObjTree<FloatObj>
574 using FloatVariant = std::variant<float, double, long double>;
578 void* addr_ =
nullptr;
579 std::function<
long double()> getter_;
580 std::function<void(
long double)> setter_;
581 bool useAccessor_ =
false;
584 template <
typename T>
585 FloatObj(T v,
void* addr) :
586 ObjTree<FloatObj>(NodeKind::Float),
590 FloatObj(std::function<
long double()> getter, std::function<
void(
long double)> setter) :
591 ObjTree<FloatObj>(NodeKind::Integer),
593 getter_(std::move(getter)),
594 setter_(std::move(setter)),
597 if ( getter_ ) val_ =
static_cast<long double>(getter_());
598 if ( !setter_ ) readOnly_ =
true;
601 FloatObj(
const FloatObj& rhs) :
602 ObjTree<FloatObj>(rhs),
605 getter_(rhs.getter_),
606 setter_(rhs.setter_),
607 useAccessor_(rhs.useAccessor_)
610 FloatObj& operator=(
const FloatObj& rhs)
612 if (
this == &rhs )
return *
this;
613 ObjTree<FloatObj>::operator=(rhs);
616 getter_ = rhs.getter_;
617 setter_ = rhs.setter_;
618 useAccessor_ = rhs.useAccessor_;
622 ObjTreeCont* clone()
const override {
return new FloatObj(*
this); }
624 template <
typename T>
627 return std::get<T>(val_);
630 template <
typename T>
636 template <
typename T>
645 if ( useAccessor_ && getter_ ) {
646 const long double live = getter_();
647 std::visit([live](
auto& v) { v =
static_cast<std::decay_t<decltype(v)
>>(live); }, val_);
650 std::visit([
this](
auto& v) { v = *
static_cast<std::decay_t<decltype(v)
>*>(addr_); }, val_);
656 if ( useAccessor_ && getter_ ) {
657 const long double live = getter_();
659 [live](
const auto& v) ->
bool {
return static_cast<long double>(v) !=
static_cast<long double>(live); },
664 [
this](
const auto& v) ->
bool {
return v != *
static_cast<std::decay_t<decltype(v)
>*>(addr_); }, val_);
669 template <
typename Visitor>
670 auto visit(Visitor&& visitor)
672 return std::visit(std::forward<Visitor>(visitor), val_);
675 template <
typename Visitor>
676 auto visit(Visitor&& visitor)
const
678 return std::visit(std::forward<Visitor>(visitor), val_);
681 void apply()
override
683 visit([](
auto val) { std::cout <<
"Processing float: " << val << std::endl; });
686 const int verbosity, std::ios_base::fmtflags base = std::ios_base::dec, std::ostream& os = std::cout)
override
688 std::string ro = (readOnly_) ?
" (ro)" :
"";
689 if ( verbosity == 0 ) {
690 os << getObjName() << ro << std::endl;
692 else if ( verbosity == 1 ) {
693 visit([&](
auto val) {
694 auto old_flags = os.flags();
695 auto old_prec = os.precision();
696 os.setf(base, std::ios_base::basefield);
697 if ( base != std::ios_base::dec ) {
698 os.setf(std::ios_base::showbase);
700 os << getObjName() << ro << std::fixed << std::setprecision(12) <<
" = " << val << std::endl;
702 os.precision(old_prec);
706 visit([&](
auto val) {
707 auto old_flags = os.flags();
708 auto old_prec = os.precision();
709 os.setf(base, std::ios_base::basefield);
710 if ( base != std::ios_base::dec ) {
711 os.setf(std::ios_base::showbase);
713 os << getObjName() << ro << std::fixed << std::setprecision(12) <<
" = " << val <<
" (" << getType()
716 os.precision(old_prec);
724 std::cout <<
"WARNING Cannot set ReadOnly Obj " << name_ << std::endl;
728 visit([&](
auto& current) {
729 using T = std::decay_t<
decltype(current)>;
730 setSimVal(
static_cast<T
>(std::stold(value)));
742 if ( !addr_ )
return;
743 std::visit([
this](
auto& v) { *
static_cast<std::decay_t<decltype(v)
>*>(addr_) = v; }, val_);
747class ContainerObj :
public ObjTree<ContainerObj>
753 ContainerObj(
const std::string& name,
const std::string& type,
size_t size,
ObjectMap* source) :
754 ObjTree<ContainerObj>(NodeKind::Container),
762 ContainerObj(
const ContainerObj& rhs) :
763 ObjTree<ContainerObj>(rhs),
765 sourceMap_(rhs.sourceMap_)
771 ContainerObj& operator=(
const ContainerObj& rhs)
773 if (
this == &rhs )
return *
this;
774 ObjTree<ContainerObj>::operator=(rhs);
778 sourceMap_ = rhs.sourceMap_;
782 ObjTreeCont* clone()
const override {
return new ContainerObj(*
this); }
785 const std::string& getContainerType()
const {
return type_; }
786 size_t getSize()
const {
return size_; }
790 if ( !sourceMap_ )
return;
791 size_ = sourceMap_->getVariables().size();
796 if ( !sourceMap_ )
return false;
797 return size_ != sourceMap_->getVariables().size();
800 void apply()
override { std::cout <<
"Container: " << name_ <<
" (" << type_ <<
") size=" << size_ << std::endl; }
803 const int verbosity, std::ios_base::fmtflags base = std::ios_base::dec, std::ostream& os = std::cout)
override
805 if ( verbosity == 0 ) {
806 os << name_ <<
" [" << size_ <<
" elements] (" << type_ <<
")" << std::endl;
809 os << name_ <<
" [" << size_ <<
" elements] (" << type_ <<
")" << std::endl;
814 ObjTreeCont* getElementAt(std::vector<size_t> indices)
const
818 for (
size_t idx : indices ) {
819 if ( !current )
return nullptr;
821 auto& elems = current->getChildren();
822 if ( idx >= elems.size() )
return nullptr;
824 current = elems[idx].get();
829 void printElementAt(std::vector<size_t> indices,
int verbosity = 1,
830 std::ios_base::fmtflags base = std::ios_base::dec, std::ostream& os = std::cout)
const
834 elem->
Dump(verbosity, base, os);
837 os <<
"Element not found at path {";
839 for (
auto i : indices ) {
840 if ( !first ) os <<
", ";
844 os <<
"}" << std::endl;
848 bool setElementFromString(std::vector<size_t> indices, std::string val)
850 ObjTreeCont* elem = getElementAt(indices);
851 bool success = elem !=
nullptr;
853 success = elem->setFromString(val);
856 std::cout <<
"Element not found at path {";
858 for (
auto i : indices ) {
859 if ( !first ) std::cout <<
", ";
863 std::cout <<
"}" << std::endl;
870class StringObj :
public ObjTree<StringObj>
873 void* addr_ =
nullptr;
876 StringObj(
const std::string& v,
void* addr) :
877 ObjTree<StringObj>(NodeKind::String),
881 StringObj(
const StringObj& rhs) :
882 ObjTree<StringObj>(rhs),
887 StringObj& operator=(
const StringObj& rhs)
889 if (
this == &rhs )
return *
this;
890 ObjTree<StringObj>::operator=(rhs);
896 ObjTreeCont* clone()
const override {
return new StringObj(*
this); }
898 const std::string& getVal()
const {
return val_; }
899 void setVal(
const std::string& v) { val_ = v; }
900 void setSimVal(
const std::string& v)
903 *
static_cast<std::string*
>(addr_) = val_;
908 std::cout <<
"WARNING Cannot set ReadOnly Obj " << name_ << std::endl;
914 virtual void syncFromSim()
override { val_ = *
static_cast<std::string*
>(addr_); }
917 if ( !addr_ )
return false;
918 return val_ != *
static_cast<std::string*
>(addr_);
921 void apply()
override { std::cout <<
"Processing string: " << val_ << std::endl; }
923 void Dump(
const int verbosity, [[maybe_unused]] std::ios_base::fmtflags base = std::ios_base::dec,
924 std::ostream& os = std::cout)
override
926 std::string ro = (readOnly_) ?
" (ro)" :
"";
927 if ( verbosity == 0 ) {
928 os << getObjName() << ro << std::endl;
930 else if ( verbosity == 1 ) {
931 os << getObjName() << ro <<
" = \"" << val_ <<
"\"" << std::endl;
934 os << getObjName() << ro <<
" = \"" << val_ <<
"\"" <<
" (" << getType() <<
")" << std::endl;
940class BoolObj :
public ObjTree<BoolObj>
944 void* addr_ =
nullptr;
945 std::function<bool()> getter_;
946 std::function<void(
bool)> setter_;
947 bool useAccessor_ =
false;
950 BoolObj(
bool v,
void* addr) :
951 ObjTree<BoolObj>(NodeKind::Bool),
955 BoolObj(std::function<
bool()> getter, std::function<
void(
bool)> setter) :
956 ObjTree<BoolObj>(NodeKind::Bool),
957 getter_(std::move(getter)),
958 setter_(std::move(setter)),
961 if ( getter_ ) val_ = getter_();
962 if ( !setter_ ) readOnly_ =
true;
965 BoolObj(
const BoolObj& rhs) :
966 ObjTree<BoolObj>(rhs),
969 getter_(rhs.getter_),
970 setter_(rhs.setter_),
971 useAccessor_(rhs.useAccessor_)
974 BoolObj& operator=(
const BoolObj& rhs)
976 if (
this == &rhs )
return *
this;
977 ObjTree<BoolObj>::operator=(rhs);
980 getter_ = rhs.getter_;
981 setter_ = rhs.setter_;
982 useAccessor_ = rhs.useAccessor_;
986 ObjTreeCont* clone()
const override {
return new BoolObj(*
this); }
988 bool getVal()
const {
return val_; }
989 void setVal(
bool v) { val_ = v; }
990 void setSimVal(
bool v)
995 if ( useAccessor_ ) {
1001 *(
static_cast<bool*
>(addr_)) = v;
1008 std::cout <<
"WARNING Cannot set ReadOnly Obj " << name_ << std::endl;
1011 setSimVal(value ==
"true" || value ==
"1");
1016 if ( useAccessor_ && getter_ ) {
1020 val_ = *(
static_cast<bool*
>(addr_));
1025 if ( useAccessor_ && getter_ ) {
1026 return val_ != getter_();
1029 return val_ != *
static_cast<bool*
>(addr_);
1034 void apply()
override { std::cout <<
"Processing bool: " << (val_ ?
"true" :
"false") << std::endl; }
1036 void Dump(
const int verbosity, [[maybe_unused]] std::ios_base::fmtflags base = std::ios_base::dec,
1037 std::ostream& os = std::cout)
override
1039 std::string ro = (readOnly_) ?
" (ro)" :
"";
1040 if ( verbosity == 0 ) {
1041 os << getObjName() << ro << std::endl;
1043 else if ( verbosity == 1 ) {
1044 os << getObjName() << ro <<
" = " << (val_ ?
"true" :
"false") << std::endl;
1047 os << getObjName() << ro <<
" = " << (val_ ?
"true" :
"false") <<
" (" << getType() <<
")" << std::endl;
1052class GenericValObj :
public ObjTree<GenericValObj>
1055 void* addr_ =
nullptr;
1059 GenericValObj(
const std::string& val,
void* addr,
ObjectMap* source) :
1060 ObjTree<GenericValObj>(NodeKind::GenericVal),
1066 GenericValObj(
const GenericValObj& rhs) :
1067 ObjTree<GenericValObj>(rhs),
1070 sourceMap_(rhs.sourceMap_)
1073 GenericValObj& operator=(
const GenericValObj& rhs)
1075 if (
this == &rhs )
return *
this;
1076 ObjTree<GenericValObj>::operator=(rhs);
1079 sourceMap_ = rhs.sourceMap_;
1083 ObjTreeCont* clone()
const override {
return new GenericValObj(*
this); }
1085 const std::string& getVal()
const {
return val_; }
1092 std::cout <<
"WARNING Cannot set ReadOnly Obj " << name_ << std::endl;
1095 if ( !sourceMap_ )
return false;
1096 if ( sourceMap_->isReadOnly() )
return false;
1097 sourceMap_->set(value);
1099 val_ = sourceMap_->get();
1107 if ( !sourceMap_ )
return false;
1108 return val_ != sourceMap_->get();
1111 void apply()
override { std::cout <<
"Processing generic: " << val_ << std::endl; }
1113 void Dump(
const int verbosity, [[maybe_unused]] std::ios_base::fmtflags base = std::ios_base::dec,
1114 std::ostream& os = std::cout)
override
1116 std::string ro = (readOnly_) ?
" (ro)" :
"";
1117 if ( verbosity == 0 ) {
1118 os << getObjName() << ro << std::endl;
1120 else if ( verbosity == 1 ) {
1121 os << getObjName() << ro <<
" = " << val_ << std::endl;
1124 os << getObjName() << ro <<
" = " << val_ <<
" (" << getType() <<
")" << std::endl;
Definition componentInfo.h:285
Main component object for the simulation.
Definition component.h:32
virtual bool hasChanged() override
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:1023
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 ObjTreeLeaves.h:1036
virtual void syncFromSim() override
This function will update the local stored node value with the live value in the sst simulation.
Definition ObjTreeLeaves.h:1014
bool setFromString(const std::string &value) override
Set the value stored in the node from a string.
Definition ObjTreeLeaves.h:1005
Definition ObjTreeLeaves.h:748
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 ObjTreeLeaves.h:802
bool hasChanged() override
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:794
void syncFromSim() override
This function will update the local stored node value with the live value in the sst simulation.
Definition ObjTreeLeaves.h:788
virtual void syncFromSim() override
This function will update the local stored node value with the live value in the sst simulation.
Definition ObjTreeLeaves.h:643
virtual bool hasChanged() override
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:654
bool setFromString(const std::string &value) override
Set the value stored in the node from a string.
Definition ObjTreeLeaves.h:721
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 ObjTreeLeaves.h:685
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 ObjTreeLeaves.h:1113
bool hasChanged() override
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:1105
bool setFromString(const std::string &value) override
Set the value stored in the node from a string.
Definition ObjTreeLeaves.h:1089
virtual void syncFromSim() override
This function will update the local stored node value with the live value in the sst simulation.
Definition ObjTreeLeaves.h:474
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 ObjTreeLeaves.h:515
bool setFromString(const std::string &value) override
Set the value stored in the node from a string.
Definition ObjTreeLeaves.h:545
virtual bool hasChanged() override
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:485
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
ObjectType * findByType(Func &&predicate)
Find the first instance of a particular type in this node's children_ that matches criteria set by pr...
Definition ObjTreeLeaves.h:205
virtual void Dump(const int verbosity, std::ios_base::fmtflags base=std::ios_base::dec, std::ostream &os=std::cout)
Print the contents of the node to the stream specified by os.
Definition ObjTreeLeaves.h:248
virtual bool setFromString(const std::string &value)
Set the value stored in the node from a string.
Definition ObjTreeLeaves.h:265
ObjTreeCont * findByName(const std::string name)
Find the first instance of a child with name_ matching name.
Definition ObjTreeLeaves.h:223
void makeReadOnly()
Function that will be called if during conversion from ObjectMap the node has been marked as ReadOnly...
Definition ObjTreeLeaves.h:141
void setType(const std::string &type)
Set the type of the node - this comes from ObjectMap/Serialization.
Definition ObjTreeLeaves.h:124
bool isRoot()
Returns true if this is the top of the tree - determined by the parent pointer being nullptr.
Definition ObjTreeLeaves.h:134
void applyRecursive(Func &&func)
Apply a function to all children of this node regardless of type, etc.
Definition ObjTreeLeaves.h:153
virtual bool hasChanged()
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:280
virtual void syncFromSim()
This function will update the local stored node value with the live value in the sst simulation.
Definition ObjTreeLeaves.h:271
void applyRecursiveByType(Func &&func)
Apply a function to all children of this node of a specific type.
Definition ObjTreeLeaves.h:169
virtual void clear()
Clears the entire Object Tree and frees all nodes.
Definition ObjTreeLeaves.h:293
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 ObjTreeLeaves.h:385
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
void clear() override
Clears the entire Object Tree and frees all nodes.
Definition ObjTreeLeaves.h:394
Base class for objects created by the serializer mapping mode used to map the variables for objects.
Definition objectMap.h:189
virtual void syncFromSim() override
This function will update the local stored node value with the live value in the sst simulation.
Definition ObjTreeLeaves.h:914
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 ObjTreeLeaves.h:923
bool setFromString(const std::string &value) override
Set the value stored in the node from a string.
Definition ObjTreeLeaves.h:905
virtual bool hasChanged() override
This function will compare the stored the node value with the live simulation value.
Definition ObjTreeLeaves.h:915