User Guide
table_data.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Blue Brain Project, EPFL.
3
* See the top-level LICENSE file for details.
4
*
5
* SPDX-License-Identifier: Apache-2.0
6
*/
7
8
#pragma once
9
10
/**
11
* \file
12
* \brief Implement generic table data structure
13
*/
14
15
#include <sstream>
16
#include <vector>
17
18
#include "
utils/string_utils.hpp
"
19
20
21
namespace
nmodl
{
22
namespace
utils {
23
24
/**
25
* @addtogroup utils
26
* @{
27
*/
28
29
/**
30
* \class TableData
31
* \brief Class to construct and pretty-print tabular data
32
*
33
* This class is used to construct and print tables (like
34
* nmodl::symtab::SymbolTable and performance tables).
35
*/
36
struct
TableData
{
37
using
TableRowType
= std::vector<std::string>;
38
39
/// title of the table
40
std::string
title
;
41
42
/// top header/keys
43
TableRowType
headers
;
44
45
/// data
46
std::vector<TableRowType>
rows
;
47
48
/// alignment for every column of data rows
49
std::vector<stringutils::text_alignment>
alignments
;
50
51
void
print
(
int
indent = 0)
const
;
52
53
void
print
(std::ostream& stream,
int
indent = 0)
const
;
54
};
55
56
/** @} */
// end of utils
57
58
}
// namespace utils
59
}
// namespace nmodl
nmodl::utils::TableData::title
std::string title
title of the table
Definition:
table_data.hpp:40
nmodl::utils::TableData::rows
std::vector< TableRowType > rows
data
Definition:
table_data.hpp:46
nmodl
encapsulates code generation backend implementations
Definition:
ast_common.hpp:26
nmodl::utils::TableData::alignments
std::vector< stringutils::text_alignment > alignments
alignment for every column of data rows
Definition:
table_data.hpp:49
string_utils.hpp
Implement string manipulation functions.
nmodl::utils::TableData
Class to construct and pretty-print tabular data.
Definition:
table_data.hpp:36
nmodl::utils::TableData::TableRowType
std::vector< std::string > TableRowType
Definition:
table_data.hpp:37
nmodl::utils::TableData::headers
TableRowType headers
top header/keys
Definition:
table_data.hpp:43
nmodl::utils::TableData::print
void print(int indent=0) const
Definition:
table_data.cpp:127
src
utils
table_data.hpp