Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::Map2d< TMap, TRow, TCol, TCell > Class Template Reference

Defines the two-dimensional map (lookup table) data type. More...

#include <map2d.h>

Public Types

using IteratorType = typename TMap< TRow, TMap< TCol, TCell > >::iterator
 Map row iterator.
 
using ConstIteratorType = typename TMap< TRow, TMap< TCol, TCell > >::const_iterator
 Read-only map row iterator.
 

Public Member Functions

 Map2d ()=default
 Initialises a new instance of the Map2d class.
 
 Map2d (TMap< TRow, TMap< TCol, TCell > > &&data) noexcept
 Initialises a new instance of the Map2d class from a standard C++ 2D mapping.
 
IteratorType begin () noexcept
 Gets an iterator to the beginning of the map.
 
IteratorType end () noexcept
 Gets an iterator to the element following the element of the map.
 
ConstIteratorType begin () const noexcept
 Gets an read-only iterator to the beginning of the map.
 
ConstIteratorType end () const noexcept
 Gets an read-only iterator to the element following the element of the map.
 
ConstIteratorType cbegin () const noexcept
 Gets an read-only iterator to the beginning of the map.
 
ConstIteratorType cend () const noexcept
 Gets an read-only iterator to the element following the element of the map.
 
bool empty () const noexcept
 Determine whether the container is empty.
 
bool empty (const TRow &row_key) const
 Determine whether a given row container is empty.
 
std::size_t rows () const noexcept
 Gets the number of rows.
 
std::size_t columns (const TRow &row_key) const
 Gets the number of columns at a given row.
 
bool contains (const TRow &row_key) const noexcept
 Determines whether the map contains a row.
 
bool contains (const TRow &row_key, const TCol &col_key) const
 Determines whether the map contains a value.
 
TMap< TCol, TCell > & at (const TRow &row_key)
 Gets a row dataset with bounds checking.
 
const TMap< TCol, TCell > & at (const TRow &row_key) const
 Gets a read-only row dataset with bounds checking.
 
TCell & at (const TRow &row_key, const TCol &col_key)
 Gets a value at a cell by row and column with bounds checking.
 
const TCell & at (const TRow &row_key, const TCol &col_key) const
 Gets a read-only value at a cell by row and column with bounds checking.
 
template<class... FArgs>
auto insert_row (FArgs &&...args) noexcept
 Insert a row into the table.
 
template<class FRow , class... FArgs>
auto insert (FRow &&row_key, FArgs &&...args) noexcept
 Insert a column into a given row of the table.
 
template<class... FArgs>
auto emplace_row (FArgs &&...args) noexcept
 Emplace a row into the table.
 
template<class FRow , class... FArgs>
auto emplace (FRow &&row_key, FArgs &&...args) noexcept
 Emplace a column into a given row of the table.
 

Detailed Description

template<template< class... > class TMap, class TRow, class TCol, class TCell>
class hgps::Map2d< TMap, TRow, TCol, TCell >

Defines the two-dimensional map (lookup table) data type.

Template Parameters
TMapunderlying standard map type
TRowRows date type
TColColumns data type
TCellCell value data type

Member Typedef Documentation

◆ ConstIteratorType

template<template< class... > class TMap, class TRow , class TCol , class TCell >
using hgps::Map2d< TMap, TRow, TCol, TCell >::ConstIteratorType = typename TMap<TRow, TMap<TCol, TCell> >::const_iterator

Read-only map row iterator.

◆ IteratorType

template<template< class... > class TMap, class TRow , class TCol , class TCell >
using hgps::Map2d< TMap, TRow, TCol, TCell >::IteratorType = typename TMap<TRow, TMap<TCol, TCell> >::iterator

Map row iterator.

Constructor & Destructor Documentation

◆ Map2d() [1/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
hgps::Map2d< TMap, TRow, TCol, TCell >::Map2d ( )
default

Initialises a new instance of the Map2d class.

◆ Map2d() [2/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
hgps::Map2d< TMap, TRow, TCol, TCell >::Map2d ( TMap< TRow, TMap< TCol, TCell > > &&  data)
inlinenoexcept

Initialises a new instance of the Map2d class from a standard C++ 2D mapping.

Parameters
dataThe lookup table data

Member Function Documentation

◆ at() [1/4]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
TMap< TCol, TCell > & hgps::Map2d< TMap, TRow, TCol, TCell >::at ( const TRow &  row_key)
inline

Gets a row dataset with bounds checking.

Parameters
row_keyThe row identifier
Returns
Row dataset
Here is the caller graph for this function:

◆ at() [2/4]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
const TMap< TCol, TCell > & hgps::Map2d< TMap, TRow, TCol, TCell >::at ( const TRow &  row_key) const
inline

Gets a read-only row dataset with bounds checking.

Parameters
row_keyThe row identifier
Returns
Row dataset

◆ at() [3/4]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
TCell & hgps::Map2d< TMap, TRow, TCol, TCell >::at ( const TRow &  row_key,
const TCol &  col_key 
)
inline

Gets a value at a cell by row and column with bounds checking.

Parameters
row_keyThe row identifier
col_keyThe column identifier
Returns
The cell value

◆ at() [4/4]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
const TCell & hgps::Map2d< TMap, TRow, TCol, TCell >::at ( const TRow &  row_key,
const TCol &  col_key 
) const
inline

Gets a read-only value at a cell by row and column with bounds checking.

Parameters
row_keyThe row identifier
col_keyThe column identifier
Returns
The read-only cell value

◆ begin() [1/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
ConstIteratorType hgps::Map2d< TMap, TRow, TCol, TCell >::begin ( ) const
inlinenoexcept

Gets an read-only iterator to the beginning of the map.

Returns
Iterator to the first element

◆ begin() [2/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
IteratorType hgps::Map2d< TMap, TRow, TCol, TCell >::begin ( )
inlinenoexcept

Gets an iterator to the beginning of the map.

Returns
Iterator to the first element

◆ cbegin()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
ConstIteratorType hgps::Map2d< TMap, TRow, TCol, TCell >::cbegin ( ) const
inlinenoexcept

Gets an read-only iterator to the beginning of the map.

Returns
Iterator to the first element

◆ cend()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
ConstIteratorType hgps::Map2d< TMap, TRow, TCol, TCell >::cend ( ) const
inlinenoexcept

Gets an read-only iterator to the element following the element of the map.

Returns
Iterator to the element following the last element.

◆ columns()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
std::size_t hgps::Map2d< TMap, TRow, TCol, TCell >::columns ( const TRow &  row_key) const
inline

Gets the number of columns at a given row.

Parameters
row_keyThe row identifier
Returns
Number of columns at row
Exceptions
std::out_of_rangefor invalid row identifier

◆ contains() [1/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
bool hgps::Map2d< TMap, TRow, TCol, TCell >::contains ( const TRow &  row_key) const
inlinenoexcept

Determines whether the map contains a row.

Parameters
row_keyThe row identifier
Returns
true if the map contains the row; otherwise false
Exceptions
std::out_of_rangefor invalid row identifier
Here is the caller graph for this function:

◆ contains() [2/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
bool hgps::Map2d< TMap, TRow, TCol, TCell >::contains ( const TRow &  row_key,
const TCol &  col_key 
) const
inline

Determines whether the map contains a value.

Parameters
row_keyThe row identifier
col_keyThe column identifier
Returns
true if the map contains the value; otherwise false

◆ emplace()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
template<class FRow , class... FArgs>
auto hgps::Map2d< TMap, TRow, TCol, TCell >::emplace ( FRow &&  row_key,
FArgs &&...  args 
)
inlinenoexcept

Emplace a column into a given row of the table.

Parameters
row_keyThe row identifier
...argsThe arguments to forward to the row emplace method
Returns
Return type for the underlying map's emplace method

◆ emplace_row()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
template<class... FArgs>
auto hgps::Map2d< TMap, TRow, TCol, TCell >::emplace_row ( FArgs &&...  args)
inlinenoexcept

Emplace a row into the table.

Parameters
...argsThe arguments to forward to the row emplace method
Returns
Return type for the underlying map's emplace method

◆ empty() [1/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
bool hgps::Map2d< TMap, TRow, TCol, TCell >::empty ( ) const
inlinenoexcept

Determine whether the container is empty.

Returns
true, if the container is empty; otherwise, false.

◆ empty() [2/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
bool hgps::Map2d< TMap, TRow, TCol, TCell >::empty ( const TRow &  row_key) const
inline

Determine whether a given row container is empty.

Parameters
row_keyThe row identifier
Returns
true, if the row container is empty; otherwise, false.
Exceptions
std::out_of_rangefor invalid row identifier

◆ end() [1/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
ConstIteratorType hgps::Map2d< TMap, TRow, TCol, TCell >::end ( ) const
inlinenoexcept

Gets an read-only iterator to the element following the element of the map.

Returns
Iterator to the element following the last element.

◆ end() [2/2]

template<template< class... > class TMap, class TRow , class TCol , class TCell >
IteratorType hgps::Map2d< TMap, TRow, TCol, TCell >::end ( )
inlinenoexcept

Gets an iterator to the element following the element of the map.

Returns
Iterator to the element following the last element.

◆ insert()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
template<class FRow , class... FArgs>
auto hgps::Map2d< TMap, TRow, TCol, TCell >::insert ( FRow &&  row_key,
FArgs &&...  args 
)
inlinenoexcept

Insert a column into a given row of the table.

Parameters
row_keyThe row identifier
...argsThe arguments to forward to the column insert method
Returns
Return type for the underlying map's insert method

◆ insert_row()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
template<class... FArgs>
auto hgps::Map2d< TMap, TRow, TCol, TCell >::insert_row ( FArgs &&...  args)
inlinenoexcept

Insert a row into the table.

Parameters
...argsThe arguments to forward to the row insert method
Returns
Return type for the underlying map's insert method

◆ rows()

template<template< class... > class TMap, class TRow , class TCol , class TCell >
std::size_t hgps::Map2d< TMap, TRow, TCol, TCell >::rows ( ) const
inlinenoexcept

Gets the number of rows.

Returns
Number of rows

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