The class Table.
More...
#include <Table.h>
|
| Table ()=default |
| default constructor
|
|
| Table (const std::vector< std::string > names, const std::vector< std::vector< double >> values) |
| Constructor of object Table. More...
|
|
| Table (const std::vector< std::string > names, const size_t nrows) |
| Constructor of object Table. More...
|
|
| Table (const std::string input_dir, const std::string input_file, const std::vector< std::string > names, const std::vector< size_t > use_cols={}, const size_t header_lines_to_skip=1) |
| Constructor of object Table. More...
|
|
virtual | ~Table ()=default |
| default destructor
|
|
std::vector< double > & | operator[] (const std::string name) |
| function to get a column More...
|
|
std::vector< std::vector< double > > | operator[] (const std::vector< std::string > names) |
| function to get some columns More...
|
|
void | insert (const std::string name, const std::vector< double > values, const bool replace=false) |
| function to insert a column More...
|
|
void | insert (const std::vector< std::string > names, const std::vector< std::vector< double >> values, const bool replace=false) |
| function to insert some columns More...
|
|
void | read (const std::string input_dir, const std::string input_file, const std::vector< std::string > names, const std::vector< size_t > use_cols={}, const size_t header_lines_to_skip=1) |
| function to read from an ascii file More...
|
|
void | write (const std::string output_dir, const std::string output_file, const std::vector< std::string > names={}) |
| function to write columns More...
|
|
|
void | m_set (const std::vector< std::string > names, const size_t nrows) |
| function to set internal members More...
|
|
void | m_set (const std::vector< std::string > names, const std::vector< std::vector< double >> values) |
| function to set internal members More...
|
|
std::vector< std::string > | m_keys () |
| get the map keys More...
|
|
The class Table.
"Headers/Table.h"
This is the base class used generalize datasets
Definition at line 60 of file Table.h.
◆ Table() [1/3]
cbl::data::Table::Table |
( |
const std::vector< std::string > |
names, |
|
|
const std::vector< std::vector< double >> |
values |
|
) |
| |
Constructor of object Table.
This constructor initializes the table, taking in input the name of the columns and the values. The size of the two arrays must be tha same.
- Parameters
-
names | the column names |
values | the table values |
Definition at line 78 of file Table.cpp.
◆ Table() [2/3]
cbl::data::Table::Table |
( |
const std::vector< std::string > |
names, |
|
|
const size_t |
nrows |
|
) |
| |
Constructor of object Table.
This constructor initializes the table, creating empty columns of size nrows
- Parameters
-
names | the column names |
nrows | the columns lenght |
Definition at line 87 of file Table.cpp.
◆ Table() [3/3]
cbl::data::Table::Table |
( |
const std::string |
input_dir, |
|
|
const std::string |
input_file, |
|
|
const std::vector< std::string > |
names, |
|
|
const std::vector< size_t > |
use_cols = {} , |
|
|
const size_t |
header_lines_to_skip = 1 |
|
) |
| |
Constructor of object Table.
This constructor reads the table from an ASCII file
- Parameters
-
input_dir | directory of input file |
input_file | input file name |
names | the column names |
use_cols | the index of the columns to be read |
header_lines_to_skip | number of header lines |
Definition at line 96 of file Table.cpp.
◆ insert() [1/2]
void cbl::data::Table::insert |
( |
const std::string |
name, |
|
|
const std::vector< double > |
values, |
|
|
const bool |
replace = false |
|
) |
| |
function to insert a column
- Parameters
-
name | the column name |
values | the column values |
replace | |
Definition at line 133 of file Table.cpp.
◆ insert() [2/2]
void cbl::data::Table::insert |
( |
const std::vector< std::string > |
names, |
|
|
const std::vector< std::vector< double >> |
values, |
|
|
const bool |
replace = false |
|
) |
| |
function to insert some columns
- Parameters
-
names | the column names |
values | the columns |
replace | |
Definition at line 153 of file Table.cpp.
◆ m_keys()
vector< string > cbl::data::Table::m_keys |
( |
| ) |
|
|
protected |
get the map keys
- Returns
- vector of string
Definition at line 64 of file Table.cpp.
◆ m_set() [1/2]
void cbl::data::Table::m_set |
( |
const std::vector< std::string > |
names, |
|
|
const size_t |
nrows |
|
) |
| |
|
protected |
function to set internal members
- Parameters
-
names | the column names |
nrows | the columns lenght |
Definition at line 45 of file Table.cpp.
◆ m_set() [2/2]
void cbl::data::Table::m_set |
( |
const std::vector< std::string > |
names, |
|
|
const std::vector< std::vector< double >> |
values |
|
) |
| |
|
protected |
function to set internal members
- Parameters
-
names | the column names |
values | the table values |
Definition at line 55 of file Table.cpp.
◆ operator[]() [1/2]
vector< double > & cbl::data::Table::operator[] |
( |
const std::string |
name | ) |
|
function to get a column
- Parameters
-
- Returns
- vector containing the column values
Definition at line 105 of file Table.cpp.
◆ operator[]() [2/2]
vector< vector< double > > cbl::data::Table::operator[] |
( |
const std::vector< std::string > |
names | ) |
|
function to get some columns
- Parameters
-
- Returns
- vector containing the columns
Definition at line 119 of file Table.cpp.
◆ read()
void cbl::data::Table::read |
( |
const std::string |
input_dir, |
|
|
const std::string |
input_file, |
|
|
const std::vector< std::string > |
names, |
|
|
const std::vector< size_t > |
use_cols = {} , |
|
|
const size_t |
header_lines_to_skip = 1 |
|
) |
| |
function to read from an ascii file
- Parameters
-
input_dir | directory of input file |
input_file | input file name |
names | the column names |
use_cols | the index of the columns to be read |
header_lines_to_skip | number of header lines |
Definition at line 163 of file Table.cpp.
◆ write()
void cbl::data::Table::write |
( |
const std::string |
output_dir, |
|
|
const std::string |
output_file, |
|
|
const std::vector< std::string > |
names = {} |
|
) |
| |
function to write columns
- Parameters
-
output_dir | directory of output file |
output_file | output file name |
names | names of the colums to be wrote |
Definition at line 219 of file Table.cpp.
The documentation for this class was generated from the following files: