Skip to content

Block

#include <sbio/formats/random/randfmt.hh>
struct Block

Defined in src/lib/sbio/formats/random/randfmt.hh:222

The main descriptor of a Block of data in the sbio randfmt format.

A Block consists of a Header, followed by a payload. The payload’s can be described by the relevant structs (E.g. SuperBlock, MetadataBlock, etc.). Those other structs do NOT include the Header, and are not children of the Block struct. They describe only the payload. The DataBlock does not have a specific struct to describe its payload as it is an arbitrary byte stream (which can be described by a single pointer).

The sbio randfmt has a two-layer hieararchy. There are SuperBlocks which enclose a set of sub-Blocks that contain data, metadata, config, etc. Every Block has an identifier value in its Header, and both the SuperBlock and each sub-block have their own Headers.

With byte number increasing to the right, a single SuperBlock will look like:

| SuperBlock0 | | SuperBlockHeader | | Sub0 Header | Sub0 Payload | … |

Immediately, following SuperBlock0, comes the next SuperBlock. The entry is optional, controlled by a feature flag, and may or may not be present. If present, it has the offsets to quickly jump to each sub-Block within the SuperBlock. There is additionally, a separate feature flag which controls the presence of a series of IndexEntry objects which, if enabled, will appear at the end of the file, and contain the offsets to quickly jump to each SuperBlock.

Name Kind Owner
hdr variable Declared here
valid_magic function Declared here
test_flag function Declared here
block_type function Declared here
block_id function Declared here
payload_size function Declared here
data function Declared here
data function Declared here
closest_block function Declared here
next_block function Declared here
Return Name Description
Header hdr

Header hdr

Defined in src/lib/sbio/formats/random/randfmt.hh:223

Return Name Description
SBIO_HD bool valid_magic const inline
SBIO_HD bool test_flag const inline
SBIO_HDBlockType block_type const inline
SBIO_HD hd_std::uint8_t block_id const inline
SBIO_HD hd_std::uint32_t payload_size const inline
SBIO_HD const char * data const inline Access the first byte of the Block’s payload.
SBIO_HD char * data inline
SBIO_HD const Block * closest_block const inline Return the next Block (if valid).
SBIO_HD const Block * next_block const inline Return the next Block (if valid) at this hierarchy level.

const inline

inline SBIO_HD bool valid_magic() const

Defined in src/lib/sbio/formats/random/randfmt.hh:225


const inline

inline SBIO_HD bool test_flag(FormatFlags feat) const

Defined in src/lib/sbio/formats/random/randfmt.hh:229


const inline

inline SBIO_HDBlockType block_type() const

Defined in src/lib/sbio/formats/random/randfmt.hh:233


const inline

inline SBIO_HD hd_std::uint8_t block_id() const

Defined in src/lib/sbio/formats/random/randfmt.hh:237


const inline

inline SBIO_HD hd_std::uint32_t payload_size() const

Defined in src/lib/sbio/formats/random/randfmt.hh:239


const inline

inline SBIO_HD const char * data() const

Defined in src/lib/sbio/formats/random/randfmt.hh:246

Access the first byte of the Block’s payload.

A pointer to the first byte of the payload.


inline

inline SBIO_HD char * data()

Defined in src/lib/sbio/formats/random/randfmt.hh:249


const inline

inline SBIO_HD const Block * closest_block() const

Defined in src/lib/sbio/formats/random/randfmt.hh:261

Return the next Block (if valid).

Alternatively, this function can be thought of as returning the next Header that will be encountered. For SuperBlocks, it will return the first sub-block inside the SuperBlock. For everything else, it is equivalent to calling next_block.

The next Block in the stream, or alternatively, the closest Header.


const inline

inline SBIO_HD const Block * next_block() const

Defined in src/lib/sbio/formats/random/randfmt.hh:291

Return the next Block (if valid) at this hierarchy level.

The sbio randfmt has two levels of the hierarchy, SuperBlocks and the contained sub-blocks. If this is a SuperBlock, this function returns the next SuperBlock. Otherwise, it returns the next sub-block. For the second case, it is equivalent to the closest_block function.

The next Block at the same level of the two-level format hierarchy.