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

Structure to hold a DataCard, which contains multiple tables. More...

#include <opatIO.h>

Public Member Functions

const OPATTableget (const std::string &tag) const
 Retrieves a table from the DataCard by tag.
 
const OPATTableoperator[] (const std::string &tag) const
 Accesses a table from the DataCard by tag.
 
const OPATTableoperator[] (const char *tag) const
 Accesses a table from the DataCard by tag (C-string version).
 
const OPATTableoperator[] (std::string_view tag) const
 Accesses a table from the DataCard by tag (string_view version).
 
std::vector< std::string > getKeys () const
 Retrieves a list of all table tags (keys) present in this DataCard.
 

Public Attributes

CardHeader header
 Header of the DataCard.
 
TableIndex tableIndex
 Index of tables within the DataCard.
 
std::unordered_map< std::string, OPATTabletableData
 Map of table tags to their data.
 

Friends

std::ostream & operator<< (std::ostream &os, const DataCard &card)
 Stream insertion operator for printing the DataCard.
 

Detailed Description

Structure to hold a DataCard, which contains multiple tables.

A DataCard includes metadata, a table index, and the actual table data.

Member Function Documentation

◆ get()

const OPATTable & opat::DataCard::get ( const std::string & tag) const
nodiscard

Retrieves a table from the DataCard by tag.

Parameters
tagThe tag of the table to retrieve.
Returns
A constant reference to the OPATTable.
Exceptions
std::out_of_rangeif the tag is not found.

◆ getKeys()

std::vector< std::string > opat::DataCard::getKeys ( ) const
nodiscard

Retrieves a list of all table tags (keys) present in this DataCard.

Returns
A vector of strings, where each string is a table tag.

Example:

// Assuming 'data_card' is an initialized opat::DataCard object
std::vector<std::string> table_keys = data_card.getKeys();
for (const std::string& key : table_keys) {
std::cout << "Table found: " << key << std::endl;
const opat::OPATTable& table = data_card[key];
// Process the table
}
Structure to hold the data of an OPAT table.
Definition opatIO.h:259

◆ operator[]() [1/3]

const OPATTable & opat::DataCard::operator[] ( const char * tag) const

Accesses a table from the DataCard by tag (C-string version).

Parameters
tagThe tag of the table to access.
Returns
A constant reference to the OPATTable.
Exceptions
std::out_of_rangeif the tag is not found.

◆ operator[]() [2/3]

const OPATTable & opat::DataCard::operator[] ( const std::string & tag) const

Accesses a table from the DataCard by tag.

Parameters
tagThe tag of the table to access.
Returns
A constant reference to the OPATTable.
Exceptions
std::out_of_rangeif the tag is not found.

◆ operator[]() [3/3]

const OPATTable & opat::DataCard::operator[] ( std::string_view tag) const

Accesses a table from the DataCard by tag (string_view version).

Parameters
tagThe tag of the table to access.
Returns
A constant reference to the OPATTable.
Exceptions
std::out_of_rangeif the tag is not found.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const DataCard & card )
friend

Stream insertion operator for printing the DataCard.

Parameters
osOutput stream.
cardDataCard to print.
Returns
Reference to the output stream.

Member Data Documentation

◆ header

CardHeader opat::DataCard::header

Header of the DataCard.

◆ tableData

std::unordered_map<std::string, OPATTable> opat::DataCard::tableData

Map of table tags to their data.

◆ tableIndex

TableIndex opat::DataCard::tableIndex

Index of tables within the DataCard.


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