Class PacketGenerator
Defined in File PacketGenerator.h
Inheritance Relationships
Derived Types
public ska::pst::common::PacketCaptureFile
(Class PacketCaptureFile)public ska::pst::common::ScaleWeightGenerator
(Class ScaleWeightGenerator)
Class Documentation
-
class PacketGenerator
Abstract base class for data+weights+scales generation and validation.
Subclassed by ska::pst::common::PacketCaptureFile, ska::pst::common::ScaleWeightGenerator
Public Functions
Construct a new PacketGenerator object.
-
virtual ~PacketGenerator() = default
Destroy the PacketGenerator object.
-
virtual void configure(const ska::pst::common::AsciiHeader &config)
Configure the streams written to data+weights+scales.
- Parameters
config – the keyword/value pairs used to configure the data+weights+scales streams
-
virtual void fill_packet(char *buf)
Fill the data+weights+scales of the next UDP packet.
- Parameters
buf – base memory address of the packet to be filled
-
virtual void fill_data(char *buf, uint64_t size) = 0
Fill the data stream in the provided buffer.
- Parameters
buf – pointer to buffer to be filled with sequence of data elements
size – number of bytes to be written to buffer
-
virtual void fill_weights(char *buf, uint64_t size) = 0
Fill the weights stream in the provided buffer.
- Parameters
buf – pointer to buffer to be filled with sequence of weight elements
size – number of bytes to be written to buffer
-
virtual void fill_scales(char *buf, uint64_t size) = 0
Fill the scales stream in the provided buffer.
- Parameters
buf – pointer to buffer to be filled with sequence of scale elements
size – number of bytes to be written to buffer
-
virtual auto test_packet(char *buf) -> bool
Verify the data+weights+scales of the received UDP packet.
- Parameters
buf – pointer to buffer containing received UDP packet
- Returns
true if both data and weights match expectations
-
virtual auto test_data(char *buf, uint64_t size) -> bool = 0
Verify the data stream in the provided buffer.
- Parameters
buf – pointer to buffer containing sequence of data elements
size – number of bytes in buffer to be tested
- Returns
true if data match expectations
-
virtual auto test_weights(char *buf, uint64_t size) -> bool = 0
Verify the weights stream in the provided buffer.
- Parameters
buf – pointer to buffer containing sequence of weight elements
size – number of bytes in buffer to be tested
- Returns
true if weights match expectations
-
virtual auto test_scales(char *buf, uint64_t size) -> bool = 0
Verify the scales stream in the provided buffer.
- Parameters
buf – pointer to buffer containing sequence of scale elements
size – number of bytes in buffer to be tested
- Returns
true if scales match expectations
-
virtual void reset() = 0
Reset all sequences (data, weights, and scales) The next call to fill_block or test_block will behave as per the first call to these functions.
Protected Attributes
-
std::shared_ptr<PacketLayout> layout
Layout of each block of data.
-
uint32_t nbit = {0}
number of bits per sample in the data stream
-
uint32_t ndim = {0}
number of dimensions in the data stream
-
uint32_t npol = {0}
number of polarisations in the data stream
-
uint32_t nchan = {0}
number of channels in the data stream
-
uint64_t scl_block_offset = {0}
offset of the first scale heap in a weights+scales block in bytes
-
uint64_t scl_block_size = {0}
size of the scale heap in a weights+scales block in bytes
-
uint64_t wts_block_offset = {0}
offset of the first weight heap in a weights+scales block in bytes
-
uint64_t wts_block_size = {0}
size of a weight heap in a weights+scales block in bytes
-
uint64_t block_stride = {0}
size of a scale and weights heap in bytes