106 if (w > std::numeric_limits<unsigned short>::max()) {
107 w = std::numeric_limits<unsigned short>::max();
130 size_t collectionSize = collection.size();
131 for (
size_t index = 0; index < collectionSize; ++index) {
132 auto stringEle = collection[index];
153 if (index != collectionSize - 1 &&
fTable.size() <= row) {
176 : fTypes(types), fWidths(columnNames.
size(), 0), fRepresentations(columnNames.
size()),
177 fCollectionsRepresentations(columnNames.
size()), fNColumns(columnNames.
size()),
178 fNMaxCollectionElements(nMaxCollectionElements)
181 fTable.push_back(std::vector<DElement_t>(columnNames.size()));
183 for (
auto name = columnNames.begin() + 1;
name != columnNames.end(); ++
name) {
190 size_t totalWidth = 0;
193 for (
size_t i = 0; i <
size; ++i) {
206 std::string DashesStr =
"+";
207 for (
size_t i = 0; i < lastColToPrint; ++i){
208 DashesStr += std::string(
fWidths[i] + 2,
'-');
212 DashesStr +=
"-----+";
222 bool allColumnsFit =
true;
223 if (
fNColumns > 2u && columnsToShorten > 0u){
227 columnsToPrint =
fNColumns - columnsToShorten;
232 Info(
"Print",
"Only showing %lu columns out of %lu\n", columnsToPrint,
fNColumns);
233 allColumnsFit =
false;
239 auto nrRows =
fTable.size();
241 for (
size_t rowIndex = 0; rowIndex < nrRows; ++rowIndex) {
242 auto &row =
fTable[rowIndex];
244 std::stringstream stringRow;
245 bool isRowEmpty =
true;
247 if (std::any_of(row[0].GetRepresentation().begin(), row[0].GetRepresentation().end(), ::isdigit)){
252 for (
size_t columnIndex = 0; columnIndex < columnsToPrint; ++columnIndex) {
253 const auto &element = row[columnIndex];
254 std::string printedElement =
"";
256 if (element.IsDot()) {
257 printedElement =
"...";
258 }
else if (element.IsPrint()) {
259 printedElement = element.GetRepresentation();
263 if (!printedElement.empty()) {
268 stringRow << std::left << std::setw(
fWidths[columnIndex]) << std::setfill(
fgSeparator) << printedElement
274 stringRow <<
"... | ";
276 std::cout << stringRow.str() << std::endl;
286 std::stringstream stringRepresentation;
290 if (std::any_of(row[0].GetRepresentation().begin(), row[0].GetRepresentation().end(), ::isdigit)){
293 stringRepresentation <<
"| ";
294 for (
size_t i = 0; i < row.size(); ++i) {
295 stringRepresentation << std::left << std::setw(
fWidths[i]) << std::setfill(
fgSeparator)
296 << row[i].GetRepresentation() <<
" | ";
298 stringRepresentation <<
"\n";
301 return stringRepresentation.str();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
bool IsIgnore() const
Return if the cell has to be skipped.
bool IsDot() const
Return if the cell has to be replaced by "...".
const std::string & GetRepresentation() const
bool IsPrint() const
Return if the cell has to be printed.
void SetDots()
Flag this cell to be replaced by "...".
PrintingAction fPrintingAction
void SetPrint()
Flag this cell as to be printed.
void SetIgnore()
Flag this cell as to be skipped.
std::string fRepresentation
RDisplayElement()
Constructor assuming an empty representation to be printed.
void AddCollectionToRow(const VecStr_t &collection)
Adds a collection to the table.
size_t fCurrentColumn
Column that is being filled.
ROOT::Internal::RDF::RDisplayElement DElement_t
RDisplay(const VecStr_t &columnNames, const VecStr_t &types, size_t nMaxCollectionElements)
Creates an RDisplay to print the event values.
size_t fNMaxCollectionElements
std::vector< std::vector< DElement_t > > fTable
String representation of the data to be printed.
std::string AsString() const
Returns the representation as a string.
void AddToRow(const std::string &stringEle)
Adds a single element to the next slot in the table.
size_t fCurrentRow
Row that is being filled.
void MovePosition()
Moves to the next cell.
std::vector< unsigned short > fWidths
Tracks the maximum width of each column, based on the largest element.
static constexpr unsigned fgMaxWidth
Maximum width of the table that Print() displays.
void EnsureCurrentColumnWidth(size_t w)
size_t fNextRow
Next row to be filled.
std::string DashesBetweenLines(size_t lastColToPrint, bool allColumnsFit) const
Generate dashes between entries in Print() and AsString() Methods.
std::vector< std::string > VecStr_t
void Print() const
Prints the representation to the standard output.
size_t GetNColumnsToShorten() const
Get the number of columns that do NOT fit in the characters limit.
static constexpr char fgSeparator
Spacing used to align the table entries.
size_t fNColumns
Number of columns to be printed.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...