CIRCT 24.0.0git
Loading...
Searching...
No Matches
esi::SerialListTypeDeserializer< T > Class Template Reference

Reusable serial-list window deserializer. More...

#include <TypedPorts.h>

Inheritance diagram for esi::SerialListTypeDeserializer< T >:
Collaboration diagram for esi::SerialListTypeDeserializer< T >:

Public Types

using Base = QueuedDecodeTypeDeserializer<T>
using OutputCallback = typename Base::OutputCallback
using DecodedOutputs = typename Base::DecodedOutputs
Public Types inherited from esi::QueuedDecodeTypeDeserializer< T >
using OutputCallback = detail::TypedReadOwnedCallback<T>
using DecodedOutputs = std::vector<std::unique_ptr<T>>

Public Member Functions

 SerialListTypeDeserializer (OutputCallback output)
Public Member Functions inherited from esi::QueuedDecodeTypeDeserializer< T >
 QueuedDecodeTypeDeserializer (OutputCallback output)
virtual ~QueuedDecodeTypeDeserializer ()=default
bool push (std::unique_ptr< SegmentedMessageData > &msg)
 Push one raw message into the deserializer.
bool poke ()
 Retry delivery of any typed outputs which were previously blocked by the client callback.

Private Types

using header_frame = typename T::header_frame
using data_frame = typename T::data_frame
using count_type = typename T::count_type

Private Member Functions

DecodedOutputs decode (std::unique_ptr< SegmentedMessageData > &msg) override
 Decode one raw message into zero or more typed outputs.

Private Attributes

std::vector< uint8_t > partial_
std::optional< header_frame > pending_header_
std::vector< data_frame > pending_frames_
count_type remaining_ = 0

Static Private Attributes

static constexpr size_t kFrameSize = sizeof(data_frame)

Detailed Description

template<typename T>
class esi::SerialListTypeDeserializer< T >

Reusable serial-list window deserializer.

Walks the serial-list multi-burst protocol used by codegen'd window helpers – zero or more header(N>0) + N data bursts terminated by a header(0) footer – and emits a fully-formed T instance built from the accumulated header fields and data frames.

T must be a generated window helper that exposes:

T typically declares SerialListTypeDeserializer<T> as a friend so the template can reach the (private) header_frame definition; the helpers themselves can stay private as well.

Definition at line 333 of file TypedPorts.h.

Member Typedef Documentation

◆ Base

template<typename T>
using esi::SerialListTypeDeserializer< T >::Base = QueuedDecodeTypeDeserializer<T>

Definition at line 335 of file TypedPorts.h.

◆ count_type

template<typename T>
using esi::SerialListTypeDeserializer< T >::count_type = typename T::count_type
private

Definition at line 345 of file TypedPorts.h.

◆ data_frame

template<typename T>
using esi::SerialListTypeDeserializer< T >::data_frame = typename T::data_frame
private

Definition at line 344 of file TypedPorts.h.

◆ DecodedOutputs

template<typename T>
using esi::SerialListTypeDeserializer< T >::DecodedOutputs = typename Base::DecodedOutputs

Definition at line 337 of file TypedPorts.h.

◆ header_frame

template<typename T>
using esi::SerialListTypeDeserializer< T >::header_frame = typename T::header_frame
private

Definition at line 343 of file TypedPorts.h.

◆ OutputCallback

template<typename T>
using esi::SerialListTypeDeserializer< T >::OutputCallback = typename Base::OutputCallback

Definition at line 336 of file TypedPorts.h.

Constructor & Destructor Documentation

◆ SerialListTypeDeserializer()

template<typename T>
esi::SerialListTypeDeserializer< T >::SerialListTypeDeserializer ( OutputCallback output)
inlineexplicit

Definition at line 339 of file TypedPorts.h.

References esi::QueuedDecodeTypeDeserializer< T >::output.

Member Function Documentation

◆ decode()

template<typename T>
DecodedOutputs esi::SerialListTypeDeserializer< T >::decode ( std::unique_ptr< SegmentedMessageData > & msg)
inlineoverrideprivatevirtual

Decode one raw message into zero or more typed outputs.

Implementations must consume msg before returning, even when zero outputs are produced.

Implements esi::QueuedDecodeTypeDeserializer< T >.

Definition at line 351 of file TypedPorts.h.

References esi::MessageData::getBytes(), esi::detail::getMessageDataRef(), esi::MessageData::getSize(), kFrameSize, partial_, pending_frames_, pending_header_, and remaining_.

Member Data Documentation

◆ kFrameSize

template<typename T>
size_t esi::SerialListTypeDeserializer< T >::kFrameSize = sizeof(data_frame)
staticconstexprprivate

Definition at line 349 of file TypedPorts.h.

Referenced by decode().

◆ partial_

template<typename T>
std::vector<uint8_t> esi::SerialListTypeDeserializer< T >::partial_
private

Definition at line 407 of file TypedPorts.h.

Referenced by decode().

◆ pending_frames_

template<typename T>
std::vector<data_frame> esi::SerialListTypeDeserializer< T >::pending_frames_
private

Definition at line 409 of file TypedPorts.h.

Referenced by decode().

◆ pending_header_

template<typename T>
std::optional<header_frame> esi::SerialListTypeDeserializer< T >::pending_header_
private

Definition at line 408 of file TypedPorts.h.

Referenced by decode().

◆ remaining_

template<typename T>
count_type esi::SerialListTypeDeserializer< T >::remaining_ = 0
private

Definition at line 410 of file TypedPorts.h.

Referenced by decode().


The documentation for this class was generated from the following file: