Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::GenderTable< ROW, TYPE > Class Template Reference

Defines the gender column lookup table data type. More...

#include <gender_table.h>

Public Member Functions

 GenderTable ()=default
 Initialises a new instance of the GenderTable class. More...
 
 GenderTable (const MonotonicVector< ROW > &rows, const std::vector< core::Gender > &cols, core::Array2D< TYPE > &&values)
 Initialises a new instance of the GenderTable class. More...
 
std::size_t size () const noexcept
 Gets the lookup table size. More...
 
std::size_t rows () const noexcept
 Get the number of rows lookup breakpoints. More...
 
std::size_t columns () const noexcept
 Get the number of columns lookup breakpoints. More...
 
bool empty () const noexcept
 Determine whether the lookup table is empty. More...
 
TYPE & at (const ROW row, const core::Gender gender)
 Gets a value at a given row and column intersection. More...
 
const TYPE & at (const ROW row, const core::Gender gender) const
 Gets a read-only value at a given row and column intersection. More...
 
TYPE & operator() (const ROW row, const core::Gender gender)
 Gets a value at a given row and column intersection. More...
 
const TYPE & operator() (const ROW row, const core::Gender gender) const
 Gets a read-only value at a given row and column intersection. More...
 
bool contains (const ROW row) const noexcept
 Determines whether the lookup contains a row. More...
 
bool contains (const ROW row, const core::Gender gender) const noexcept
 Determines whether the lookup contains a value. More...
 

Detailed Description

template<core::Numerical ROW, core::Numerical TYPE>
class hgps::GenderTable< ROW, TYPE >

Defines the gender column lookup table data type.

Template Parameters
ROWThe rows value type
TYPEThe cell value type

Constructor & Destructor Documentation

◆ GenderTable() [1/2]

template<core::Numerical ROW, core::Numerical TYPE>
hgps::GenderTable< ROW, TYPE >::GenderTable ( )
default

Initialises a new instance of the GenderTable class.

◆ GenderTable() [2/2]

template<core::Numerical ROW, core::Numerical TYPE>
hgps::GenderTable< ROW, TYPE >::GenderTable ( const MonotonicVector< ROW > &  rows,
const std::vector< core::Gender > &  cols,
core::Array2D< TYPE > &&  values 
)
inline

Initialises a new instance of the GenderTable class.

Parameters
rowsThe monotonic rows lookup breakpoints
colsThe gender columns lookup breakpoints
valuesThe full lookup-table values
Exceptions
std::invalid_argumentfor lookup breakpoints and values table size mismatch
Here is the call graph for this function:

Member Function Documentation

◆ at() [1/2]

template<core::Numerical ROW, core::Numerical TYPE>
TYPE& hgps::GenderTable< ROW, TYPE >::at ( const ROW  row,
const core::Gender  gender 
)
inline

Gets a value at a given row and column intersection.

Parameters
rowThe reference row
genderThe reference column
Returns
The lookup value
Exceptions
std::out_of_rangefor accessing unknown lookup breakpoints

◆ at() [2/2]

template<core::Numerical ROW, core::Numerical TYPE>
const TYPE& hgps::GenderTable< ROW, TYPE >::at ( const ROW  row,
const core::Gender  gender 
) const
inline

Gets a read-only value at a given row and column intersection.

Parameters
rowThe reference row
genderThe reference column
Returns
The lookup value
Exceptions
std::out_of_rangefor accessing unknown lookup breakpoints

◆ columns()

template<core::Numerical ROW, core::Numerical TYPE>
std::size_t hgps::GenderTable< ROW, TYPE >::columns ( ) const
inlinenoexcept

Get the number of columns lookup breakpoints.

Returns
Number of columns

◆ contains() [1/2]

template<core::Numerical ROW, core::Numerical TYPE>
bool hgps::GenderTable< ROW, TYPE >::contains ( const ROW  row) const
inlinenoexcept

Determines whether the lookup contains a row.

Parameters
rowThe row breakpoint value
Returns
true, if the lookup contains the row; otherwise, false

◆ contains() [2/2]

template<core::Numerical ROW, core::Numerical TYPE>
bool hgps::GenderTable< ROW, TYPE >::contains ( const ROW  row,
const core::Gender  gender 
) const
inlinenoexcept

Determines whether the lookup contains a value.

Parameters
rowThe row breakpoint value
genderThe column breakpoint value
Returns
true, if the lookup contains the value; otherwise, false

◆ empty()

template<core::Numerical ROW, core::Numerical TYPE>
bool hgps::GenderTable< ROW, TYPE >::empty ( ) const
inlinenoexcept

Determine whether the lookup table is empty.

Returns
true, if the lookup data is empty; otherwise, false

◆ operator()() [1/2]

template<core::Numerical ROW, core::Numerical TYPE>
TYPE& hgps::GenderTable< ROW, TYPE >::operator() ( const ROW  row,
const core::Gender  gender 
)
inline

Gets a value at a given row and column intersection.

Parameters
rowThe reference row
genderThe reference column
Returns
The lookup value
Exceptions
std::out_of_rangefor accessing unknown lookup breakpoints

◆ operator()() [2/2]

template<core::Numerical ROW, core::Numerical TYPE>
const TYPE& hgps::GenderTable< ROW, TYPE >::operator() ( const ROW  row,
const core::Gender  gender 
) const
inline

Gets a read-only value at a given row and column intersection.

Parameters
rowThe reference row
genderThe reference column
Returns
The lookup value
Exceptions
std::out_of_rangefor accessing unknown lookup breakpoints

◆ rows()

template<core::Numerical ROW, core::Numerical TYPE>
std::size_t hgps::GenderTable< ROW, TYPE >::rows ( ) const
inlinenoexcept

Get the number of rows lookup breakpoints.

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

◆ size()

template<core::Numerical ROW, core::Numerical TYPE>
std::size_t hgps::GenderTable< ROW, TYPE >::size ( ) const
inlinenoexcept

Gets the lookup table size.

Returns
Lookup table size

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