Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::core::PrimitiveDataTableColumn< TYPE > Class Template Reference

Primitive data type DataTable columns class. More...

#include <column_primitive.h>

Inheritance diagram for hgps::core::PrimitiveDataTableColumn< TYPE >:
[legend]
Collaboration diagram for hgps::core::PrimitiveDataTableColumn< TYPE >:
[legend]

Public Types

using value_type = TYPE
 
using IteratorType = DataTableColumnIterator< PrimitiveDataTableColumn< TYPE > >
 

Public Member Functions

 PrimitiveDataTableColumn (std::string &&name, std::vector< TYPE > &&data)
 Initialises a new instance of the PrimitiveDataTableColumn class. More...
 
 PrimitiveDataTableColumn (std::string &&name, std::vector< TYPE > &&data, std::vector< bool > &&null_bitmap)
 Initialises a new instance of the PrimitiveDataTableColumn class. More...
 
std::string type () const noexcept override
 Gets the column type name. More...
 
std::string name () const noexcept override
 Gets the column name identifier. More...
 
std::size_t null_count () const noexcept override
 Gets the number of null values in the column data. More...
 
std::size_t size () const noexcept override
 The size of the column data, number of rows. More...
 
bool is_null (std::size_t index) const noexcept override
 Determine whether a column value is null. More...
 
bool is_valid (std::size_t index) const noexcept override
 Determine whether a column value is not null. More...
 
const std::any value (std::size_t index) const noexcept override
 Gets the column value at a given index. More...
 
const std::optional< value_typevalue_safe (const std::size_t index) const noexcept
 Gets the column value at a given index. More...
 
const value_type value_unsafe (const std::size_t index) const
 Gets the column value at a given index, unsafe without boundary checks. More...
 
IteratorType begin () const
 Gets the iterator to the first element of the column. More...
 
IteratorType end () const
 Gets the iterator element following the last element of the column. More...
 
- Public Member Functions inherited from hgps::core::DataTableColumn
 DataTableColumn ()=default
 Initialises a new instance of the DataTableColumn class. More...
 
 DataTableColumn (const DataTableColumn &)=delete
 
DataTableColumnoperator= (const DataTableColumn &)=delete
 
 DataTableColumn (DataTableColumn &&)=delete
 
DataTableColumnoperator= (DataTableColumn &&)=delete
 
virtual ~DataTableColumn ()
 Destroys a DataTableColumn instance. More...
 
virtual void accept (DataTableColumnVisitor &visitor) const =0
 Double dispatch the column using a visitor implementation. More...
 

Detailed Description

template<typename TYPE>
class hgps::core::PrimitiveDataTableColumn< TYPE >

Primitive data type DataTable columns class.

Template Parameters
TYPEColumn data type

Member Typedef Documentation

◆ IteratorType

◆ value_type

template<typename TYPE >
using hgps::core::PrimitiveDataTableColumn< TYPE >::value_type = TYPE

Constructor & Destructor Documentation

◆ PrimitiveDataTableColumn() [1/2]

template<typename TYPE >
hgps::core::PrimitiveDataTableColumn< TYPE >::PrimitiveDataTableColumn ( std::string &&  name,
std::vector< TYPE > &&  data 
)
inlineexplicit

Initialises a new instance of the PrimitiveDataTableColumn class.

Parameters
nameColumn name
dataColumn data
Exceptions
std::invalid_argumentfor column name starting with non-alpha character or less than two length.

◆ PrimitiveDataTableColumn() [2/2]

template<typename TYPE >
hgps::core::PrimitiveDataTableColumn< TYPE >::PrimitiveDataTableColumn ( std::string &&  name,
std::vector< TYPE > &&  data,
std::vector< bool > &&  null_bitmap 
)
inlineexplicit

Initialises a new instance of the PrimitiveDataTableColumn class.

Parameters
nameColumn name
dataColumn data, which may contain null values
null_bitmapColumn null values index
Exceptions
std::invalid_argumentfor column name starting with non-alpha character or less than two length.
std::out_of_rangefor data and null bitmap vectors size mismatch.

Member Function Documentation

◆ begin()

template<typename TYPE >
IteratorType hgps::core::PrimitiveDataTableColumn< TYPE >::begin ( ) const
inline

Gets the iterator to the first element of the column.

Returns
An iterator to the beginning

◆ end()

template<typename TYPE >
IteratorType hgps::core::PrimitiveDataTableColumn< TYPE >::end ( ) const
inline

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

Returns
An iterator to the end
Here is the call graph for this function:

◆ is_null()

template<typename TYPE >
bool hgps::core::PrimitiveDataTableColumn< TYPE >::is_null ( std::size_t  index) const
inlineoverridevirtualnoexcept

Determine whether a column value is null.

Parameters
indexColumn index to check
Returns
true is the value is null; otherwise, false.

Implements hgps::core::DataTableColumn.

Here is the call graph for this function:

◆ is_valid()

template<typename TYPE >
bool hgps::core::PrimitiveDataTableColumn< TYPE >::is_valid ( std::size_t  index) const
inlineoverridevirtualnoexcept

Determine whether a column value is not null.

Parameters
indexColumn index to check
Returns
true is the value is not null; otherwise, false.

Implements hgps::core::DataTableColumn.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

template<typename TYPE >
std::string hgps::core::PrimitiveDataTableColumn< TYPE >::name ( ) const
inlineoverridevirtualnoexcept

Gets the column name identifier.

Returns
Column name

Implements hgps::core::DataTableColumn.

Here is the caller graph for this function:

◆ null_count()

template<typename TYPE >
std::size_t hgps::core::PrimitiveDataTableColumn< TYPE >::null_count ( ) const
inlineoverridevirtualnoexcept

Gets the number of null values in the column data.

Returns
Column null values count

Implements hgps::core::DataTableColumn.

Here is the caller graph for this function:

◆ size()

template<typename TYPE >
std::size_t hgps::core::PrimitiveDataTableColumn< TYPE >::size ( ) const
inlineoverridevirtualnoexcept

The size of the column data, number of rows.

Returns
Column size

Implements hgps::core::DataTableColumn.

Here is the caller graph for this function:

◆ type()

template<typename TYPE >
std::string hgps::core::PrimitiveDataTableColumn< TYPE >::type ( ) const
inlineoverridevirtualnoexcept

Gets the column type name.

Returns
Column type name

Implements hgps::core::DataTableColumn.

Here is the call graph for this function:

◆ value()

template<typename TYPE >
const std::any hgps::core::PrimitiveDataTableColumn< TYPE >::value ( std::size_t  index) const
inlineoverridevirtualnoexcept

Gets the column value at a given index.

Parameters
indexColumn index
Returns
The value at index, if inside bounds; otherwise empty

Implements hgps::core::DataTableColumn.

Here is the call graph for this function:

◆ value_safe()

template<typename TYPE >
const std::optional<value_type> hgps::core::PrimitiveDataTableColumn< TYPE >::value_safe ( const std::size_t  index) const
inlinenoexcept

Gets the column value at a given index.

Parameters
indexColumn index
Returns
The value at index, if inside bounds; otherwise empty
Here is the call graph for this function:

◆ value_unsafe()

template<typename TYPE >
const value_type hgps::core::PrimitiveDataTableColumn< TYPE >::value_unsafe ( const std::size_t  index) const
inline

Gets the column value at a given index, unsafe without boundary checks.

Warning
Accessing a column element outside the boundaries is undefined behaviour.
Parameters
indexColumn index
Returns
The value at index

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