The SKIRT project
advanced radiative transfer for astrophysics
StoredTableDictionary_Impl Namespace Reference

Typedefs

using Index

Functions

void close (const string &filePath)
bool has (const Index &index, string name)
size_t locate (const Index &index, const string &filePath, string name)
void open (const SimulationItem *item, string filename, string &filePath, Index &index)

Detailed Description

This namespace contains private utilities for StoredTableDictionary. These non-template functions are seperated out into a seperate compilation unit (1) to avoid duplicating the code for each type of StoredTableDictionary and (2) to avoid propagating the dependencies (includes) of the implementation to all StoredTableDictionary users.

Typedef Documentation

◆ Index

Maps the name of a bundled stored table (including its mandatory ".stab" filename extension) to the byte offset, from the start of the bundle file, at which that stored table's data begins, and to that data's size in bytes.

Function Documentation

◆ close()

void StoredTableDictionary_Impl::close ( const string & filePath)

This function performs the close() operation as described for the destructor of the StoredTableDictionary class template. It receives the canonical path to the associated bundle file, or the empty string if no association exists.

◆ has()

bool StoredTableDictionary_Impl::has ( const Index & index,
string name )

This function returns true if index has an entry for name (with the mandatory ".stab" filename extension added if needed), or false if not.

◆ locate()

size_t StoredTableDictionary_Impl::locate ( const Index & index,
const string & filePath,
string name )

This function returns the byte offset recorded in index for name (with the mandatory ".stab" filename extension added if needed). The filePath argument is used only to construct the error message thrown when name is not found in index.

◆ open()

void StoredTableDictionary_Impl::open ( const SimulationItem * item,
string filename,
string & filePath,
Index & index )

This function performs the open() operation as described for the function with the same name in the StoredTableDictionary class template. It locates and memory-maps the specified bundle file (a tar archive in the POSIX ustar format, with the mandatory ".stabdict" filename extension added if needed), and populates index by walking the archive's headers, recording the byte offset and size of every regular-file member. Members whose base name starts with "._" (macOS AppleDouble sidecar files, which some tools add automatically when creating an archive) are silently skipped, as are non-regular-file entries such as directory or extended-header entries. The function throws a fatal error if the resource cannot be found, if a memory map cannot be acquired for it, or if it does not contain any usable members.