Skip to content
Snippets Groups Projects
Commit 0b0dfd3a authored by Jakob Blomer's avatar Jakob Blomer Committed by Axel Naumann
Browse files

[forest] add possibility to print different types of information in RInputForest::GetInfo()

parent d16f5b47
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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 "";
}
//------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment