From 842a4c32d3be69b5c6fd12c35add21465831704f Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 17 Mar 2015 17:47:50 +0000 Subject: [PATCH] include/frag: add a dump() method to fragtree_t Signed-off-by: John Spray --- src/include/frag.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/include/frag.h b/src/include/frag.h index 1b4716422de..7e0d4a8eefb 100644 --- a/src/include/frag.h +++ b/src/include/frag.h @@ -498,6 +498,21 @@ public: } out << ")"; } + + void dump(Formatter *f) const { + f->open_array_section("splits"); + for (compact_map::const_iterator p = _splits.begin(); + p != _splits.end(); + ++p) { + f->open_object_section("split"); + std::ostringstream frag_str; + frag_str << p->first; + f->dump_string("frag", frag_str.str()); + f->dump_int("children", p->second); + f->close_section(); // split + } + f->close_section(); // splits + } }; WRITE_CLASS_ENCODER(fragtree_t)