diff --git a/tree/forest/v7/inc/ROOT/RForest.hxx b/tree/forest/v7/inc/ROOT/RForest.hxx index a3fb56c8cd42100de07cecf4ac9bf3499c52ee7a..58fec71df143ffb1ca30ece6053267e8fbd6ea27 100644 --- a/tree/forest/v7/inc/ROOT/RForest.hxx +++ b/tree/forest/v7/inc/ROOT/RForest.hxx @@ -71,6 +71,14 @@ public: } // namespace Detail +/** + * Listing of the different options that can be returned by RInputForest::GetInfo() + */ +enum class EForestInfo { + kSummary, // Forest name, description, number of entries +}; + + // clang-format off /** \class ROOT::Experimental::RInputForest @@ -120,7 +128,7 @@ public: ForestSize_t GetNEntries() { return fNEntries; } - std::string GetInfo(); + std::string GetInfo(const EForestInfo what = EForestInfo::kSummary); /// Analogous to Fill(), fills the default entry of the model. Returns false at the end of the forest. /// On I/O errors, raises an expection. diff --git a/tree/forest/v7/src/RForest.cxx b/tree/forest/v7/src/RForest.cxx index 405c9c4618b9db0deb582fb06a5bc206d429480f..88c1372ba7a14a4612687e5a6630b5babf291b0d 100644 --- a/tree/forest/v7/src/RForest.cxx +++ b/tree/forest/v7/src/RForest.cxx @@ -82,14 +82,23 @@ std::unique_ptr<ROOT::Experimental::RInputForest> ROOT::Experimental::RInputFore return std::make_unique<RInputForest>(std::make_unique<Detail::RPageSourceRoot>(forestName, storage)); } -std::string ROOT::Experimental::RInputForest::GetInfo() { +std::string ROOT::Experimental::RInputForest::GetInfo(const EForestInfo what) { std::ostringstream os; auto name = fSource->GetDescriptor().GetName(); - os << "****************************** FOREST ******************************" << std::endl - << "* Name: " << name << std::setw(57 - name.length()) << "*" << std::endl - << "* Entries: " << std::setw(10) << fNEntries << std::setw(47) << "*" << std::endl - << "********************************************************************" << std::endl; - return os.str(); + + switch (what) { + case EForestInfo::kSummary: + os << "****************************** FOREST ******************************" << std::endl + << "* Name: " << name << std::setw(57 - name.length()) << "*" << std::endl + << "* Entries: " << std::setw(10) << fNEntries << std::setw(47) << "*" << std::endl + << "********************************************************************" << std::endl; + return os.str(); + default: + // Unhandled case, internal error + assert(false); + } + // Never here + return ""; } //------------------------------------------------------------------------------