opatIO-cpp 0.3.0a
Open Parametrized Array Table
Loading...
Searching...
No Matches
opat::OPATTable Struct Reference

Structure to hold the data of an OPAT table. More...

#include <opatIO.h>

Public Member Functions

std::pair< double, double > size () const
 Returns the size of the table as a pair of rows and columns.
 
int vsize () const
 Retrieves the vector size of each cell in the table.
 
const double & operator() () const
 Accesses the first value in the table's data array.
 
OPATTable operator() (uint32_t row, uint32_t column) const
 Accesses a table value by row and column.
 
double operator() (uint32_t row, uint32_t column, uint64_t zdepth) const
 Accesses a table value by row and column.
 
OPATTable operator() (const Slice &rowSlice, const Slice &colSlice) const
 Slices the table into a smaller OPATTable.
 
OPATTable getData (uint32_t row, uint32_t column) const
 Retrieves a table value by row and column.
 
double getData (uint32_t row, uint32_t column, uint64_t zdepth) const
 Retrieves a table value by row and column.
 
OPATTable getRow (uint32_t row) const
 Extracts a single row from the table.
 
OPATTable getColumn (uint32_t column) const
 Extracts a single column from the table.
 
OPATTable getRowValues () const
 Retrieves all row values of the table.
 
OPATTable getColumnValues () const
 Retrieves all column values of the table.
 
const double * getRawData () const
 Retrieves the raw data of the table.
 
OPATTable slice (const Slice &rowSlice, const Slice &colSlice) const
 Extracts a slice of the table.
 
std::string ascii () const
 Converts the table to an ASCII representation.
 
void print () const
 Prints the table to the standard output.
 

Public Attributes

std::unique_ptr< double[]> rowValues
 Array of row values.
 
std::unique_ptr< double[]> columnValues
 Array of column values.
 
std::unique_ptr< double[]> data
 Array of table data.
 
uint32_t N_R
 Number of rows in the table.
 
uint32_t N_C
 Number of columns in the table.
 
uint64_t m_vsize
 Vector size of each cell.
 

Friends

std::ostream & operator<< (std::ostream &os, const OPATTable &table)
 

Detailed Description

Structure to hold the data of an OPAT table.

An OPATTable contains the raw data of a table, along with its row and column values. It provides methods for accessing and slicing the data.

Member Function Documentation

◆ ascii()

std::string opat::OPATTable::ascii ( ) const
nodiscard

Converts the table to an ASCII representation.

Returns
A string containing the ASCII representation of the table.

◆ getColumn()

OPATTable opat::OPATTable::getColumn ( uint32_t column) const
nodiscard

Extracts a single column from the table.

Parameters
columnThe column index to extract.
Returns
An OPATTable containing the specified column.
Exceptions
std::out_of_rangeif the column index is out of bounds.

◆ getColumnValues()

OPATTable opat::OPATTable::getColumnValues ( ) const
nodiscard

Retrieves all column values of the table.

Returns
An OPATTable containing the column values.

◆ getData() [1/2]

OPATTable opat::OPATTable::getData ( uint32_t row,
uint32_t column ) const
nodiscard

Retrieves a table value by row and column.

Parameters
rowThe row index.
columnThe column index.
Returns
A OPATTable representing that vector.
Exceptions
std::out_of_rangeif the row or column index is out of bounds.
Note
The return type of this method will always be a OPATTable even if there is only one value stored in the cell. Use the () operator to get that value as a double or use .get(row, col, 0) to get the primitive numeric representation.

◆ getData() [2/2]

double opat::OPATTable::getData ( uint32_t row,
uint32_t column,
uint64_t zdepth ) const
nodiscard

Retrieves a table value by row and column.

Parameters
rowThe row index.
columnThe column index.
zdepthThe vector index to retrieve
Returns
A constant reference to the value at the specified row and column.
Exceptions
std::out_of_rangeif the row or column index is out of bounds.

◆ getRawData()

const double * opat::OPATTable::getRawData ( ) const
nodiscard

Retrieves the raw data of the table.

Returns
A pointer to the raw data array.
Note
Using this method opens you up to memory leaks, and it should generally not be used.

◆ getRow()

OPATTable opat::OPATTable::getRow ( uint32_t row) const
nodiscard

Extracts a single row from the table.

Parameters
rowThe row index to extract.
Returns
An OPATTable containing the specified row.
Exceptions
std::out_of_rangeif the row index is out of bounds.

◆ getRowValues()

OPATTable opat::OPATTable::getRowValues ( ) const
nodiscard

Retrieves all row values of the table.

Returns
An OPATTable containing the row values.

◆ operator()() [1/4]

const double & opat::OPATTable::operator() ( ) const

Accesses the first value in the table's data array.

This operator provides a convenient way to retrieve the first value in the table's data array. It is useful for quick access to the initial element of the table.

Returns
A constant reference to the first value in the data array.
Exceptions
std::runtime_errorif the data array is not initialized.

◆ operator()() [2/4]

OPATTable opat::OPATTable::operator() ( const Slice & rowSlice,
const Slice & colSlice ) const

Slices the table into a smaller OPATTable.

Parameters
rowSliceThe range of rows to extract.
colSliceThe range of columns to extract.
Returns
An OPATTable containing the specified slice.
Exceptions
std::out_of_rangeif the slice indices are out of bounds.

◆ operator()() [3/4]

OPATTable opat::OPATTable::operator() ( uint32_t row,
uint32_t column ) const

Accesses a table value by row and column.

Parameters
rowThe row index.
columnThe column index.
Returns
A opat table representing that vector.
Exceptions
std::out_of_rangeif the row or column index is out of bounds.
Note
The return type of this method will always be a OPATTable even if there is only one value stored in the cell. Use the () operator to get that value as a double or use .get(row, col, 0) to get the primitive numeric representation.

◆ operator()() [4/4]

double opat::OPATTable::operator() ( uint32_t row,
uint32_t column,
uint64_t zdepth ) const

Accesses a table value by row and column.

Parameters
rowThe row index.
columnThe column index.
zdepthThe vector index to retrieve
Returns
A constant reference to the value at the specified row and column.
Exceptions
std::out_of_rangeif the row or column index is out of bounds.

◆ print()

void opat::OPATTable::print ( ) const

Prints the table to the standard output.

◆ size()

std::pair< double, double > opat::OPATTable::size ( ) const
inlinenodiscard

Returns the size of the table as a pair of rows and columns.

Returns
A pair containing the number of rows and columns.

◆ slice()

OPATTable opat::OPATTable::slice ( const Slice & rowSlice,
const Slice & colSlice ) const
nodiscard

Extracts a slice of the table.

Parameters
rowSliceThe range of rows to extract.
colSliceThe range of columns to extract.
Returns
An OPATTable containing the specified slice.
Exceptions
std::out_of_rangeif the slice indices are out of bounds.

◆ vsize()

int opat::OPATTable::vsize ( ) const
inlinenodiscard

Retrieves the vector size of each cell in the table.

The vector size represents the number of elements stored in each cell of the table.

Returns
The vector size of each cell.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const OPATTable & table )
friend

Member Data Documentation

◆ columnValues

std::unique_ptr<double[]> opat::OPATTable::columnValues

Array of column values.

◆ data

std::unique_ptr<double[]> opat::OPATTable::data

Array of table data.

◆ m_vsize

uint64_t opat::OPATTable::m_vsize

Vector size of each cell.

◆ N_C

uint32_t opat::OPATTable::N_C

Number of columns in the table.

◆ N_R

uint32_t opat::OPATTable::N_R

Number of rows in the table.

◆ rowValues

std::unique_ptr<double[]> opat::OPATTable::rowValues

Array of row values.


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