Template Class UniformSequence

Class Documentation

template<typename T>
class UniformSequence

Generates a uniform sequence of char values.

Public Functions

explicit UniformSequence(const T value)

Construct a new Uniform Sequence object.

~UniformSequence() = default

Destroy the Uniform Sequence object.

void configure(const ska::pst::common::AsciiHeader &header)

Configure the Uniform Sequence using the meta data present in the AsciiHeader.

Parameters

header – header containing a UTC_START and OBS_OFFSET key/val pair

void reset()

Reset the internal state of the Uniform Sequence. The next call to generate or validate will behave as per the first call to these functions.

void set_uniform_value(const T value)

Set the uniform value to be used.

Parameters

value – uniform value to be used

void generate(char *buffer, uint64_t bufsz)

Generate a uniform data sequence.

Parameters
  • buffer – pointer to memory to which the uniform sequence should be written

  • bufsz – number of bytes to write to the buffer.

void generate_block(char *buffer, uint64_t bufsz, uint64_t block_offset, uint64_t block_size, uint64_t block_stride)

Generate a uniform data sequence written to the provided buffer in blocks.

Parameters
  • buffer – buffer to write the uniform sequence to

  • bufsz – size of the buffer in bytes

  • block_offset – offset from the start of the buffer for the first block

  • block_size – size of each block of uniform data to write in bytes

  • block_stride – separate between each block of uniform data in bytes

auto validate(char *buffer, uint64_t bufsz) -> bool

Compare contents of buffer to expected random sequence.

Parameters
  • buffer – pointer to buffer containing samples to be validated

  • bufsz – size of the buffer to be validated

Returns

true if all samples are valid

Returns

false if any samples are invalid

auto validate_block(char *buffer, uint64_t bufsz, uint64_t block_offset, uint64_t block_size, uint64_t block_stride) -> bool

Validate the uniform data sequence written to the provided buffer in blocks.

Parameters
  • buffer – pointer to buffer containing samples to be validated

  • bufsz – size of the buffer to be validated

  • block_offset – offset from the start of the buffer for the first block

  • block_size – size of each block of uniform data to write in bytes

  • block_stride – separate between each block of uniform data in bytes

Returns

true if all samples are valid

Returns

false if any samples are invalid