Skip to content

randfmt

Name Description
Block The main descriptor of a Block of data in the sbio randfmt format.
ConfigBlock The payload of a ConfigBlock.
DetectorSpec A simplified description of a detector to allow specifying how to write payloads.
FileTrailer
Header
IndexBlock The payload of an IndexBlock.
IndexEntry An entry to describe the location of a prior SuperBlock.
MetadataBlock The payload of a MetadataBlock.
SuperBlock The payload of a SuperBlock.
Name Description
BlockType
FormatFlags File format flags.

enum BlockType
Value Description
Super Block defining a group of upcoming blocks.
Config Block to define global configuration (like PRNG seed)
Metadata Block containing metadata for interpreting later Data blocks.
Data Block containing raw data payloads.
Index Block to write SuperBlock indices (if enabled)

enum FormatFlags

File format flags.

Some flags control features at the granularity of super-blocks, some at the block level, and some at the full stream level. They are always written to Config block payloads, though, as well as into the Header of every block.

Value Description
SubBlockOffsetTable Each SuperBlock will write an offset table to jump within the SuperBlock.
SuperBlockOffsetTable Write an offset-table to each SuperBlock at the end.
Return Name Description
int FileHandle

using FileHandle = int
Return Name Description
void write_bytes
void write_super_block
void construct_data_block
void construct_cfg_block
void construct_meta_block
void write_sbiornd_file
SBIO_HD bool test_feature_flag inline

void write_bytes(FileHandle fd, const void * buf, hd_std::size_t sz, hd_std::uint64_t off)

void write_super_block(FileHandle f_handle, hd_std::uint64_t seq_no, hd_std::uint8_t flags, hd_std::uint8_t num_sub_blocks, BlockType * block_types, hd_std::uint8_t * block_ids, void ** payloads, hd_std::uint32_t * sizes, hd_std::uint64_t & curr_offset)

void construct_data_block(hd_std::uint32_t size, hd_std::uint8_t pattern_type, hd_std::uint8_t *& payload, hd_std::uint32_t seed, hd_std::uint64_t seq_no)

void construct_cfg_block(hd_std::uint32_t seed, hd_std::uint8_t pattern_type, hd_std::uint64_t total_events, hd_std::uint8_t flags, hd_std::uint8_t *& payload)

void construct_meta_block(hd_std::uint8_t num_detectors, const DetectorSpec * detector_specs, hd_std::uint8_t *& payload)

void write_sbiornd_file(FileHandle f_handle, hd_std::uint64_t & curr_offset, hd_std::uint8_t num_detectors, const DetectorSpec * detector_specs, hd_std::uint8_t * det_block_ids, hd_std::uint32_t seed, hd_std::uint8_t pattern_type, hd_std::uint64_t total_events, hd_std::uint8_t flags)

inline

inline SBIO_HD bool test_feature_flag(hd_std::uint8_t flags, FormatFlags feat)
Return Name Description
constexpr hd_std::uint16_t MaxRank static constexpr The maximum number of dimensions a data payload may have.
constexpr hd_std::uint16_t MaxNameSize static constexpr The maximum number of bytes for string/character payloads.
constexpr char MagicBytes static constexpr Magic byte start sequence: SBIORND0.
constexpr char MagicTail static constexpr Magic byte tail sequence: SBIOTAIL.

static constexpr

constexpr hd_std::uint16_t MaxRank { 5 }

The maximum number of dimensions a data payload may have.


static constexpr

constexpr hd_std::uint16_t MaxNameSize { 64 }

The maximum number of bytes for string/character payloads.


static constexpr

constexpr char MagicBytes { 'S', 'B', 'I', 'O', 'R', 'N', 'D', '0' }

Magic byte start sequence: SBIORND0.

Last byte (currently 0) provides a version identifier.

Regardless of any additional data, all blocks for the random format must begin with the magic bytes.


static constexpr

constexpr char MagicTail { 'S', 'B', 'I', 'O', 'T', 'A', 'I', 'L' }

Magic byte tail sequence: SBIOTAIL.

The final bytes are always the tail sequence. Preceeding this, a trailer includes a byte offset of the IndexBlock (if that feature was enabled during writing).