Alexandria  2.18
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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:
[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. More...
 
virtual ~Table ()=default
 Default destructor. More...
 
std::shared_ptr< ColumnInfogetColumnInfo () const
 Returns a ColumnInfo object describing the columns of the table. More...
 
std::size_t size () const
 Returns the number of rows in the table. More...
 
const Rowoperator[] (std::size_t index) const
 Returns the row with the given index (zero based) More...
 
const_iterator begin () const
 Returns a const iterator to the first row. More...
 
const_iterator end () const
 Returns a const iterator to the past-the-end row. More...
 

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

Definition at line 52 of file Table.h.

Constructor & Destructor Documentation

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 std::move().

Here is the call graph for this function:

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

Default destructor.

Member Function Documentation

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 63 of file Table.cpp.

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 67 of file Table.cpp.

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 48 of file Table.cpp.

References m_column_info.

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 56 of file Table.cpp.

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

Returns the number of rows in the table.

Returns
the number of rows

Definition at line 52 of file Table.cpp.

Member Data Documentation

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

Definition at line 116 of file Table.h.

Referenced by getColumnInfo().

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

Definition at line 115 of file Table.h.


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