CIRCT 24.0.0git
Loading...
Searching...
No Matches
esi::QueuedDecodeTypeDeserializer< T > Class Template Referenceabstract

Helper base class for stateful deserializers which may emit zero, one, or many typed outputs for each raw input message. More...

#include <TypedPorts.h>

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

Public Types

using OutputCallback = detail::TypedReadOwnedCallback<T>
using DecodedOutputs = std::vector<std::unique_ptr<T>>

Public Member Functions

 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.

Protected Member Functions

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

Private Member Functions

bool pokeLocked ()

Private Attributes

OutputCallback output
std::queue< std::unique_ptr< T > > pendingOutputs
std::mutex mutex

Detailed Description

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

Helper base class for stateful deserializers which may emit zero, one, or many typed outputs for each raw input message.

Derived classes implement decode() and must consume the raw input message before returning. This base class handles retrying blocked typed outputs and preserving them in FIFO order until the client accepts them.

Definition at line 239 of file TypedPorts.h.

Member Typedef Documentation

◆ DecodedOutputs

template<typename T>
using esi::QueuedDecodeTypeDeserializer< T >::DecodedOutputs = std::vector<std::unique_ptr<T>>

Definition at line 242 of file TypedPorts.h.

◆ OutputCallback

template<typename T>
using esi::QueuedDecodeTypeDeserializer< T >::OutputCallback = detail::TypedReadOwnedCallback<T>

Definition at line 241 of file TypedPorts.h.

Constructor & Destructor Documentation

◆ QueuedDecodeTypeDeserializer()

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

Definition at line 244 of file TypedPorts.h.

◆ ~QueuedDecodeTypeDeserializer()

template<typename T>
virtual esi::QueuedDecodeTypeDeserializer< T >::~QueuedDecodeTypeDeserializer ( )
virtualdefault

Member Function Documentation

◆ decode()

template<typename T>
virtual DecodedOutputs esi::QueuedDecodeTypeDeserializer< T >::decode ( std::unique_ptr< SegmentedMessageData > & msg)
protectedpure virtual

Decode one raw message into zero or more typed outputs.

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

Implemented in esi::SerialListTypeDeserializer< T >, and SerialCoordOutputBatch::TypeDeserializer.

Referenced by esi::QueuedDecodeTypeDeserializer< SerialCoordOutputBatch >::push().

◆ poke()

template<typename T>
bool esi::QueuedDecodeTypeDeserializer< T >::poke ( )
inline

Retry delivery of any typed outputs which were previously blocked by the client callback.

Definition at line 284 of file TypedPorts.h.

◆ pokeLocked()

◆ push()

template<typename T>
bool esi::QueuedDecodeTypeDeserializer< T >::push ( std::unique_ptr< SegmentedMessageData > & msg)
inline

Push one raw message into the deserializer.

Returns false only when previously decoded typed outputs are still blocked on delivery. In that case msg is left untouched so the caller can retry it later.

Definition at line 254 of file TypedPorts.h.

Member Data Documentation

◆ mutex

template<typename T>
std::mutex esi::QueuedDecodeTypeDeserializer< T >::mutex
private

Definition at line 312 of file TypedPorts.h.

◆ output

◆ pendingOutputs

template<typename T>
std::queue<std::unique_ptr<T> > esi::QueuedDecodeTypeDeserializer< T >::pendingOutputs
private

Definition at line 311 of file TypedPorts.h.


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