Class HeapLayout

Nested Relationships

Nested Types

Class Documentation

class HeapLayout

Stores the offsets and sizes of data, weights, and scales in heaps of packets.

Data and weights are stored in separate heaps in blocks of shared memory or data from file

Public Functions

HeapLayout() = default

Construct a new HeapLayout object.

~HeapLayout() = default

Destroy the HeapLayout object.

void configure(const ska::pst::common::AsciiHeader &data_config, const ska::pst::common::AsciiHeader &weights_config)

Configure a HeapLayout from the AsciiHeader from the data and weights streams.

Both data_config and weights_config must satisfy all of the preconditions defined by the HeapLayout::PacketLayout constructor.

Optionally, either data_config or weights_config may specify the RESOLUTION. If RESOLUTION is specified, then it is verified (if it is inconsistent, an exception is thrown).

Parameters
  • data_configAsciiHeader containing the configuration of the data stream

  • weights_configAsciiHeader containing the configuration of the weights stream

void initialise(ska::pst::common::AsciiHeader &data_config, ska::pst::common::AsciiHeader &weights_config)

Initialise a HeapLayout from the AsciiHeader from the data and weights streams.

After calling HeapLayout::configure:

  • the RESOLUTION parameters of both data_config and weights_config are initialised

  • the PACKET_WEIGHTS_SIZE and PACKET_SCALES_SIZE parameters of weights_config are initialised

Parameters
  • data_configAsciiHeader containing the configuration of the data stream

  • weights_configAsciiHeader containing the configuration of the weights stream

inline auto get_packet_layout() const -> const PacketLayout&

Get the layout of each packet in the heap.

Returns

PacketLayout layout of each packet in the heap

inline auto get_packet_layout_ptr() const -> const std::shared_ptr<PacketLayout>&

Get the pointer to the layout of each packet in the heap.

Returns

PacketLayout pointer to the layout of each packet in the heap

inline auto get_packets_per_heap() const -> unsigned

Get the number of packets in each heap.

Returns

unsigned number of packets in each heap

inline auto get_data_packet_stride() const -> unsigned

Get the number of bytes in each packet of data stream.

Returns

unsigned number of bytes in each packet of data stream

inline auto get_data_heap_stride() const -> unsigned

Get the number of bytes in each heap of data stream.

Returns

unsigned number of bytes in heap packet of data stream

inline auto get_weights_packet_stride() const -> unsigned

Get the number of bytes in each packet of weights stream.

Returns

unsigned number of bytes in each packet of weights stream

inline auto get_weights_heap_stride() const -> unsigned

Get the number of bytes in each heap of weights stream.

Returns

unsigned number of bytes in heap packet of weights stream

inline auto get_data_resolution() const -> unsigned

Get the resolution of the data stream in bytes.

Returns

unsigned resolution of the data stream in bytes

inline auto get_weights_resolution() const -> unsigned

Get the resolution of the weights stream in bytes.

Returns

unsigned resolution of the weights stream in bytes

Protected Attributes

std::shared_ptr<PacketLayout> packet_layout

The layout of each packet in the heap.

uint32_t packets_per_heap = {0}

Number of packets per heap in the data stream.

uint32_t data_packet_stride = {0}

Number of bytes per packet in the data stream.

uint32_t weights_packet_stride = {0}

Number of bytes per packet in the weights stream.

uint32_t data_heap_stride = {0}

Number of bytes per heap in the data stream.

uint32_t weights_heap_stride = {0}

Number of bytes per heap in the weights stream.

uint32_t data_resolution = {0}

Resolution of the data stream in bytes.

uint32_t weights_resolution = {0}

Resolution of the weights stream in bytes.

class PacketLayout : public ska::pst::common::PacketLayout

Stores the offsets and sizes of data, weights, and scales of each packet in a heap.

Data and weights are stored in separate heaps in blocks of shared memory or data from file

Public Functions

PacketLayout(const ska::pst::common::AsciiHeader &data_config, const ska::pst::common::AsciiHeader &weights_config)

Configure a HeapLayout::PacketLayout from the AsciiHeader of the data and weights streams.

Both data_config and weights_config must specify the following attributes: NCHAN NPOL NDIM NBIT UDP_NSAMP UDP_NCHAN WT_NSAMP

Optionally, the weights_config may also specify PACKET_SCALES_SIZE PACKET_WEIGHTS_SIZE

If PACKET_SCALES_SIZE is specified, then it overrides the assumed default. If PACKET_WEIGHTS_SIZE is specified, then it is verified (if it is inconsistent, an exception is thrown).

Parameters
  • data_configAsciiHeader containing the configuration of the data stream

  • weights_configAsciiHeader containing the configuration of the weights stream

inline auto get_data_to_weights_packets() const -> unsigned

get the number of data packets per weight packet.

For FPT ordered data this should would be 1 as PST receives just one UDP packet that includes both data and weights and that is then split across 2 shared memory ring buffers.

For TFP ordered data produced by DSP.FT there are effectively WT_NSAMP packets of data per weights (for Low this is 32).

Returns

the number of data packets per weight packet.

inline auto get_order() const -> TimeSeriesOrder

Get the ordering of the data that the layout is for.

Returns

TimeSeriesOrder the ordering of the data for the layout. This is an enum representing FPT data for voltage recorder data or TFP data produced by DSPSR.