Added toString() methods for DeltaTree::DecodeCache.

This commit is contained in:
Steve Atherton 2022-03-10 00:07:22 -08:00
parent 6cb5f86994
commit bade9a3ec3
1 changed files with 14 additions and 1 deletions

View File

@ -1077,7 +1077,7 @@ public:
Node* node(DeltaTree2* tree) const { return tree->nodeAt(nodeOffset); }
std::string toString() {
std::string toString() const {
return format("DecodedNode{nodeOffset=%d leftChildIndex=%d rightChildIndex=%d leftParentIndex=%d "
"rightParentIndex=%d}",
(int)nodeOffset,
@ -1154,6 +1154,19 @@ public:
arena = a;
updateUsedMemory();
}
std::string toString() const {
std::string s = format("DecodeCache{%p\n", this);
s += format("upperBound %s\n", upperBound.toString().c_str());
s += format("lowerBound %s\n", lowerBound.toString().c_str());
s += format("arenaSize %d\n", arena.getSize());
s += format("decodedNodes %d {\n", decodedNodes.size());
for (auto const& n : decodedNodes) {
s += format(" %s\n", n.toString().c_str());
}
s += format("}}\n");
return s;
}
};
// Cursor provides a way to seek into a DeltaTree and iterate over its contents