opatIO-cpp 0.3.0a
Open Parametrized Array Table
Loading...
Searching...
No Matches
opatIO.h File Reference

Header file for the OPAT I/O library, providing structures and functions for reading and manipulating OPAT files. More...

#include <fstream>
#include <memory>
#include <string>
#include <sys/types.h>
#include <vector>
#include <utility>
#include <cstdint>
#include <unordered_map>
#include <limits>
#include "indexVector.h"

Go to the source code of this file.

Classes

struct  opat::Header
 Structure to hold the header information of an OPAT file. More...
 
struct  opat::CardHeader
 Structure to hold the header information of a DataCard in an OPAT file. More...
 
struct  opat::CardCatalogEntry
 Structure to hold the index information of a table in an OPAT file. More...
 
struct  opat::CardCatalog
 Structure to hold the catalog of tables in a DataCard. More...
 
struct  opat::TableIndexEntry
 Structure to hold the index information of a table within a DataCard. More...
 
struct  opat::TableIndex
 Structure to hold the index of tables within a DataCard. More...
 
struct  opat::Slice
 Structure to represent a slice of data. More...
 
struct  opat::OPATTable
 Structure to hold the data of an OPAT table. More...
 
struct  opat::DataCard
 Structure to hold a DataCard, which contains multiple tables. More...
 
struct  opat::Bounds
 Structure to hold the minimum and maximum values for a dimension. More...
 
struct  opat::OPAT
 Structure to hold the entire OPAT file. More...
 

Namespaces

namespace  opat
 

Functions

OPAT opat::readOPAT (const std::string &filename)
 Reads an OPAT file and returns its contents as an OPAT structure.
 
Header opat::readHeader (std::ifstream &file)
 Reads the header of an OPAT file.
 
CardCatalogEntry opat::readCardCatalogEntry (std::ifstream &file, uint64_t offset, uint16_t numIndex, uint8_t hashPrecision)
 Reads a CardCatalogEntry from the file.
 
CardCatalog opat::readCardCatalog (std::ifstream &file, const Header &header)
 Reads the CardCatalog from the file.
 
std::unordered_map< FloatIndexVector, DataCardopat::readDataCards (std::ifstream &file, const Header &header, const CardCatalog &cardCatalog)
 Reads all DataCards from the file.
 
DataCard opat::readDataCard (std::ifstream &file, const CardCatalogEntry &entry)
 Reads a single DataCard from the file.
 
CardHeader opat::readDataCardHeader (std::ifstream &file, const CardCatalogEntry &entry)
 Reads the header of a DataCard from the file.
 
TableIndex opat::readTableIndex (std::ifstream &file, const CardCatalogEntry &entry, const CardHeader &header)
 Reads the TableIndex from a DataCard.
 
OPATTable opat::readOPATTable (std::ifstream &file, const CardCatalogEntry &cardEntry, const TableIndexEntry &tableEntry)
 Reads an OPATTable from the file.
 
bool opat::hasMagic (const std::string &filename)
 Checks if a file has the correct magic number for an OPAT file.
 
bool opat::is_big_endian ()
 Determines if the system is big-endian.
 
template<typename T>
opat::swap_bytes (T value)
 Swaps the byte order of a value.
 

Detailed Description

Header file for the OPAT I/O library, providing structures and functions for reading and manipulating OPAT files.

This file defines the core data structures and functions used for handling OPAT files in C++. The OPAT format is designed for efficient storage and retrieval of multidimensional data tables, with metadata and indexing for fast access.

The design prioritizes:

  • Compactness: Structures are packed to minimize memory usage.
  • Flexibility: Support for multiple tables and metadata.
  • Performance: Use of unordered maps for fast lookups.

Example:

#include "opatIO.h"
int main() {
std::string filename = "example.opat";
opat::OPAT file = opat::readOPAT(filename);
const auto& table = file.get({1.0, 2.0, 3.0}).get("table_tag");
table.print();
return 0;
}
OPAT readOPAT(const std::string &filename)
Reads an OPAT file and returns its contents as an OPAT structure.
Definition opatIO.cpp:76
Header file for the OPAT I/O library, providing structures and functions for reading and manipulating...
Structure to hold the entire OPAT file.
Definition opatIO.h:502
const DataCard & get(const FloatIndexVector &index) const
Retrieves a DataCard from the OPAT structure by index.
Definition opatIO.cpp:271