Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
Euclid::Table::Table Class Reference

Represents a table. More...

#include <Table.h>

Collaboration diagram for Euclid::Table::Table:
Collaboration graph
[legend]

Public Types

typedef std::vector< Row >::const_iterator const_iterator
 

Public Member Functions

 Table (std::vector< Row > row_list)
 Constructs a Table with the given rows.
 
 Table (std::shared_ptr< ColumnInfo > column_info)
 Construct an empty Table with associated metadata.
 
virtual ~Table ()=default
 Default destructor.
 
std::shared_ptr< ColumnInfogetColumnInfo () const
 Returns a ColumnInfo object describing the columns of the table.
 
std::size_t size () const
 Returns the number of rows in the table.
 
const Rowoperator[] (std::size_t index) const
 Returns the row with the given index (zero based)
 
const_iterator begin () const
 Returns a const iterator to the first row.
 
const_iterator end () const
 Returns a const iterator to the past-the-end row.
 

Private Attributes

std::vector< Rowm_row_list
 
std::shared_ptr< ColumnInfom_column_info
 

Detailed Description

Represents a table.

The Table is an immutable class which represents a table. It contains a list of Rows, which all have the same columns. Note that because the Table is immutable instances without rows are not allowed.

Definition at line 49 of file Table.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 52 of file Table.h.

Constructor & Destructor Documentation

◆ Table() [1/2]

Euclid::Table::Table::Table ( std::vector< Row row_list)
explicit

Constructs a Table with the given rows.

The given row_list, which cannot be empty, must contain Rows which have the same ColumnInfo. Rows with different columns are not allowed.

Parameters
row_listThe rows of the table
Exceptions
Elements::Exceptionif the given list is empty
Elements::Exceptionif not all the rows have the same columns

Definition at line 31 of file Table.cpp.

References m_column_info, and m_row_list.

◆ Table() [2/2]

Euclid::Table::Table::Table ( std::shared_ptr< ColumnInfo column_info)
explicit

Construct an empty Table with associated metadata.

Parameters
column_info

Definition at line 48 of file Table.cpp.

◆ ~Table()

virtual Euclid::Table::Table::~Table ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ begin()

Table::const_iterator Euclid::Table::Table::begin ( ) const

Returns a const iterator to the first row.

Returns
An iterator to the first row

Definition at line 65 of file Table.cpp.

References m_row_list.

◆ end()

Table::const_iterator Euclid::Table::Table::end ( ) const

Returns a const iterator to the past-the-end row.

Returns
An iterator to the past-the-end row

Definition at line 69 of file Table.cpp.

References m_row_list.

◆ getColumnInfo()

std::shared_ptr< ColumnInfo > Euclid::Table::Table::getColumnInfo ( ) const

Returns a ColumnInfo object describing the columns of the table.

Returns
the information about the columns

Definition at line 50 of file Table.cpp.

References m_column_info.

Referenced by Pyston::table2numpy().

◆ operator[]()

const Row & Euclid::Table::Table::operator[] ( std::size_t  index) const

Returns the row with the given index (zero based)

Parameters
indexThe index of the row (zero based)
Returns
The row
Exceptions
Elements::Exceptionif the index is out of range

Definition at line 58 of file Table.cpp.

References m_row_list.

◆ size()

std::size_t Euclid::Table::Table::size ( ) const

Returns the number of rows in the table.

Returns
the number of rows

Definition at line 54 of file Table.cpp.

References m_row_list.

Referenced by Pyston::table2numpy().

Member Data Documentation

◆ m_column_info

std::shared_ptr<ColumnInfo> Euclid::Table::Table::m_column_info
private

Definition at line 123 of file Table.h.

Referenced by getColumnInfo(), and Table().

◆ m_row_list

std::vector<Row> Euclid::Table::Table::m_row_list
private

Definition at line 122 of file Table.h.

Referenced by begin(), end(), operator[](), size(), and Table().


The documentation for this class was generated from the following files: