From 5def79e93cb9f853d728fcdf35804496f5f72759 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Sat, 17 Oct 2020 14:58:04 -0700 Subject: [PATCH] Track counts of SHAMap-related objects --- src/ripple/shamap/SHAMapItem.h | 3 ++- src/ripple/shamap/SHAMapNodeID.h | 3 ++- src/ripple/shamap/SHAMapTreeNode.h | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ripple/shamap/SHAMapItem.h b/src/ripple/shamap/SHAMapItem.h index 01561683e3..6e0664b0a4 100644 --- a/src/ripple/shamap/SHAMapItem.h +++ b/src/ripple/shamap/SHAMapItem.h @@ -21,6 +21,7 @@ #define RIPPLE_SHAMAP_SHAMAPITEM_H_INCLUDED #include +#include #include #include #include @@ -31,7 +32,7 @@ namespace ripple { // an item stored in a SHAMap -class SHAMapItem +class SHAMapItem : public CountedObject { private: uint256 tag_; diff --git a/src/ripple/shamap/SHAMapNodeID.h b/src/ripple/shamap/SHAMapNodeID.h index 0fcc685ca7..38dcda9f80 100644 --- a/src/ripple/shamap/SHAMapNodeID.h +++ b/src/ripple/shamap/SHAMapNodeID.h @@ -20,6 +20,7 @@ #ifndef RIPPLE_SHAMAP_SHAMAPNODEID_H_INCLUDED #define RIPPLE_SHAMAP_SHAMAPNODEID_H_INCLUDED +#include #include #include #include @@ -29,7 +30,7 @@ namespace ripple { /** Identifies a node inside a SHAMap */ -class SHAMapNodeID +class SHAMapNodeID : public CountedObject { private: uint256 id_; diff --git a/src/ripple/shamap/SHAMapTreeNode.h b/src/ripple/shamap/SHAMapTreeNode.h index 3d3668facc..030b00740a 100644 --- a/src/ripple/shamap/SHAMapTreeNode.h +++ b/src/ripple/shamap/SHAMapTreeNode.h @@ -20,6 +20,7 @@ #ifndef RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED #define RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED +#include #include #include #include @@ -202,7 +203,8 @@ private: bool hashValid); }; -class SHAMapInnerNode : public SHAMapAbstractNode +class SHAMapInnerNode : public SHAMapAbstractNode, + public CountedObject { std::array mHashes; std::shared_ptr mChildren[16]; @@ -273,7 +275,8 @@ public: // SHAMapTreeNode represents a leaf, and may eventually be renamed to reflect // that. -class SHAMapTreeNode : public SHAMapAbstractNode +class SHAMapTreeNode : public SHAMapAbstractNode, + public CountedObject { private: std::shared_ptr mItem;