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
Branches
Tags
No related merge requests found
...@@ -71,6 +71,14 @@ public: ...@@ -71,6 +71,14 @@ public:
} // namespace Detail } // 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 // clang-format off
/** /**
\class ROOT::Experimental::RInputForest \class ROOT::Experimental::RInputForest
...@@ -120,7 +128,7 @@ public: ...@@ -120,7 +128,7 @@ public:
ForestSize_t GetNEntries() { return fNEntries; } 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. /// 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. /// On I/O errors, raises an expection.
......
...@@ -82,14 +82,23 @@ std::unique_ptr<ROOT::Experimental::RInputForest> ROOT::Experimental::RInputFore ...@@ -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)); 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; std::ostringstream os;
auto name = fSource->GetDescriptor().GetName(); auto name = fSource->GetDescriptor().GetName();
os << "****************************** FOREST ******************************" << std::endl
<< "* Name: " << name << std::setw(57 - name.length()) << "*" << std::endl switch (what) {
<< "* Entries: " << std::setw(10) << fNEntries << std::setw(47) << "*" << std::endl case EForestInfo::kSummary:
<< "********************************************************************" << std::endl; os << "****************************** FOREST ******************************" << std::endl
return os.str(); << "* 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.
Please register or to comment