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

Structure to hold the entire OPAT file. More...

#include <opatIO.h>

Public Member Functions

const DataCardget (const FloatIndexVector &index) const
 Retrieves a DataCard from the OPAT structure by index.
 
const DataCardget (const std::vector< double > &index) const
 Retrieves a DataCard from the OPAT structure by a standard vector of doubles. This is a convenience overload that constructs a FloatIndexVector internally.
 
const DataCardoperator[] (const FloatIndexVector &index) const
 Accesses a DataCard from the OPAT structure by index.
 
const DataCardoperator[] (const std::vector< double > &index) const
 Accesses a DataCard from the OPAT structure by a standard vector of doubles. This is a convenience overload that constructs a FloatIndexVector internally.
 
std::vector< BoundsgetBounds () const
 Calculates and returns the bounds (min and max values) for each dimension of the index vectors in the OPAT file.
 

Public Attributes

Header header
 Header of the OPAT file.
 
CardCatalog cardCatalog
 Catalog of DataCards in the file.
 
std::unordered_map< FloatIndexVector, DataCardcards
 Map of index vectors to DataCards.
 

Friends

std::ostream & operator<< (std::ostream &os, const OPAT &opat)
 Stream insertion operator for printing the OPAT structure.
 

Detailed Description

Structure to hold the entire OPAT file.

The OPAT structure contains the file header, card catalog, and all DataCards.

Examples
/Users/tboudreaux/Programming/opat-core/opatIO-cpp/src/private/fextern.cpp.

Member Function Documentation

◆ get() [1/2]

const DataCard & opat::OPAT::get ( const FloatIndexVector & index) const
nodiscard

Retrieves a DataCard from the OPAT structure by index.

Parameters
indexThe index vector of the DataCard to retrieve.
Returns
A constant reference to the DataCard.
Exceptions
std::out_of_rangeif the index is not found.

◆ get() [2/2]

const DataCard & opat::OPAT::get ( const std::vector< double > & index) const
inlinenodiscard

Retrieves a DataCard from the OPAT structure by a standard vector of doubles. This is a convenience overload that constructs a FloatIndexVector internally.

Parameters
indexThe std::vector<double> representing the index of the DataCard to retrieve.
Returns
A constant reference to the DataCard.
Exceptions
std::out_of_rangeif the index is not found.

Example:

// Assuming 'opat_file' is an initialized opat::OPAT object
std::vector<double> my_index = {1.0, 2.5};
const opat::DataCard& card = opat_file.get(my_index);
// Use the card
Structure to hold a DataCard, which contains multiple tables.
Definition opatIO.h:409
const OPATTable & get(const std::string &tag) const
Retrieves a table from the DataCard by tag.
Definition opatIO.cpp:284

◆ getBounds()

std::vector< Bounds > opat::OPAT::getBounds ( ) const
nodiscard

Calculates and returns the bounds (min and max values) for each dimension of the index vectors in the OPAT file.

Returns
A vector of Bounds structs, where each struct corresponds to a dimension of the index vectors. The size of the returned vector will be equal to header.numIndex.

Example:

// Assuming 'opat_file' is an initialized opat::OPAT object
std::vector<opat::Bounds> all_bounds = opat_file.getBounds();
for (size_t i = 0; i < all_bounds.size(); ++i) {
std::cout << "Dimension " << i << ": Min = " << all_bounds[i].min
<< ", Max = " << all_bounds[i].max << std::endl;
}

◆ operator[]() [1/2]

const DataCard & opat::OPAT::operator[] ( const FloatIndexVector & index) const

Accesses a DataCard from the OPAT structure by index.

Parameters
indexThe index vector of the DataCard to access.
Returns
A constant reference to the DataCard.
Exceptions
std::out_of_rangeif the index is not found.

◆ operator[]() [2/2]

const DataCard & opat::OPAT::operator[] ( const std::vector< double > & index) const
inline

Accesses a DataCard from the OPAT structure by a standard vector of doubles. This is a convenience overload that constructs a FloatIndexVector internally.

Parameters
indexThe std::vector<double> representing the index of the DataCard to access.
Returns
A constant reference to the DataCard.
Exceptions
std::out_of_rangeif the index is not found.

Example:

// Assuming 'opat_file' is an initialized opat::OPAT object
std::vector<double> my_index = {1.0, 2.5};
const opat::DataCard& card = opat_file[my_index];
// Use the card

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const OPAT & opat )
friend

Stream insertion operator for printing the OPAT structure.

Parameters
osOutput stream.
opatOPAT structure to print.
Returns
Reference to the output stream.

Member Data Documentation

◆ cardCatalog

CardCatalog opat::OPAT::cardCatalog

Catalog of DataCards in the file.

◆ cards

std::unordered_map<FloatIndexVector, DataCard> opat::OPAT::cards

Map of index vectors to DataCards.

◆ header

Header opat::OPAT::header

Header of the OPAT file.


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