Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::core::DataTable Class Reference

Defines a Datatable for in memory data class. More...

#include <datatable.h>

Public Types

using IteratorType = std::vector< std::unique_ptr< DataTableColumn > >::const_iterator
 DataTable columns iterator type. More...
 

Public Member Functions

std::size_t num_columns () const noexcept
 Gets the number of columns. More...
 
std::size_t num_rows () const noexcept
 Gets the number of rows. More...
 
std::vector< std::string > names () const
 Gets the collection of columns name. More...
 
void add (std::unique_ptr< DataTableColumn > column)
 Adds a new column to the table. More...
 
const DataTableColumncolumn (std::size_t index) const
 Gets the column at a given index. More...
 
const DataTableColumncolumn (const std::string &name) const
 Gets the column by name. More...
 
IteratorType cbegin () const noexcept
 Gets the iterator to the first column of the table. More...
 
IteratorType cend () const noexcept
 Gets the iterator element following the last column of the table. More...
 
std::string to_string () const noexcept
 Creates a string representation of the DataTable structure. More...
 

Detailed Description

Defines a Datatable for in memory data class.

Member Typedef Documentation

◆ IteratorType

using hgps::core::DataTable::IteratorType = std::vector<std::unique_ptr<DataTableColumn> >::const_iterator

DataTable columns iterator type.

Member Function Documentation

◆ add()

void hgps::core::DataTable::add ( std::unique_ptr< DataTableColumn column)

Adds a new column to the table.

Parameters
columnThe column to add
Exceptions
std::invalid_argumentfor duplicated column name or size mismatch.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbegin()

IteratorType hgps::core::DataTable::cbegin ( ) const
inlinenoexcept

Gets the iterator to the first column of the table.

Returns
An iterator to the beginning

◆ cend()

IteratorType hgps::core::DataTable::cend ( ) const
inlinenoexcept

Gets the iterator element following the last column of the table.

Returns
An iterator to the end

◆ column() [1/2]

const DataTableColumn & hgps::core::DataTable::column ( const std::string &  name) const

Gets the column by name.

Parameters
nameThe column name
Returns
The column instance
Exceptions
std::out_of_rangefor column name not found.
Here is the call graph for this function:

◆ column() [2/2]

const DataTableColumn & hgps::core::DataTable::column ( std::size_t  index) const

Gets the column at a given index.

Parameters
indexColumn index
Returns
The column instance
Exceptions
std::out_of_rangefor column index outside the range.
Here is the caller graph for this function:

◆ names()

std::vector< std::string > hgps::core::DataTable::names ( ) const

Gets the collection of columns name.

Returns
Columns name collection

◆ num_columns()

std::size_t hgps::core::DataTable::num_columns ( ) const
noexcept

Gets the number of columns.

Returns
Number of columns
Here is the caller graph for this function:

◆ num_rows()

std::size_t hgps::core::DataTable::num_rows ( ) const
noexcept

Gets the number of rows.

Returns
Number of rows
Here is the caller graph for this function:

◆ to_string()

std::string hgps::core::DataTable::to_string ( ) const
noexcept

Creates a string representation of the DataTable structure.

Returns
The structure string representation
Here is the call graph for this function:
Here is the caller graph for this function:

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