Block
#include <sbio/formats/random/randfmt.hh>struct BlockDefined 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 |
Immediately, following SuperBlock0, comes the next SuperBlock. The
List of all members
Section titled “List of all members”| 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 |
Public Attributes
Section titled “Public Attributes”| Return | Name | Description |
|---|---|---|
Header |
hdr |
Header hdrDefined in src/lib/sbio/formats/random/randfmt.hh:223
Public Methods
Section titled “Public Methods”| 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. |
valid_magic
Section titled “valid_magic”const inline
inline SBIO_HD bool valid_magic() constDefined in src/lib/sbio/formats/random/randfmt.hh:225
test_flag
Section titled “test_flag”const inline
inline SBIO_HD bool test_flag(FormatFlags feat) constDefined in src/lib/sbio/formats/random/randfmt.hh:229
block_type
Section titled “block_type”const inline
inline SBIO_HDBlockType block_type() constDefined in src/lib/sbio/formats/random/randfmt.hh:233
block_id
Section titled “block_id”const inline
inline SBIO_HD hd_std::uint8_t block_id() constDefined in src/lib/sbio/formats/random/randfmt.hh:237
payload_size
Section titled “payload_size”const inline
inline SBIO_HD hd_std::uint32_t payload_size() constDefined in src/lib/sbio/formats/random/randfmt.hh:239
const inline
inline SBIO_HD const char * data() constDefined in src/lib/sbio/formats/random/randfmt.hh:246
Access the first byte of the Block’s payload.
Returns
Section titled “Returns”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
closest_block
Section titled “closest_block”const inline
inline SBIO_HD const Block * closest_block() constDefined 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.
Returns
Section titled “Returns”The next Block in the stream, or alternatively, the closest Header.
next_block
Section titled “next_block”const inline
inline SBIO_HD const Block * next_block() constDefined 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.
Returns
Section titled “Returns”The next Block at the same level of the two-level format hierarchy.