CIRCT 23.0.0git
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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 >:
Inheritance graph
[legend]
Collaboration diagram for esi::QueuedDecodeTypeDeserializer< T >:
Collaboration graph
[legend]

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 246 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 249 of file TypedPorts.h.

◆ OutputCallback

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

Definition at line 248 of file TypedPorts.h.

Constructor & Destructor Documentation

◆ QueuedDecodeTypeDeserializer()

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

Definition at line 251 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< T >::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 291 of file TypedPorts.h.

References esi::QueuedDecodeTypeDeserializer< T >::mutex, and esi::QueuedDecodeTypeDeserializer< T >::pokeLocked().

◆ pokeLocked()

template<typename T >
bool esi::QueuedDecodeTypeDeserializer< T >::pokeLocked ( )
inlineprivate

◆ 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 261 of file TypedPorts.h.

References esi::QueuedDecodeTypeDeserializer< T >::decode(), esi::QueuedDecodeTypeDeserializer< T >::mutex, esi::QueuedDecodeTypeDeserializer< T >::pendingOutputs, and esi::QueuedDecodeTypeDeserializer< T >::pokeLocked().

Member Data Documentation

◆ mutex

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

◆ output

template<typename T >
OutputCallback esi::QueuedDecodeTypeDeserializer< T >::output
private

Definition at line 317 of file TypedPorts.h.

Referenced by esi::QueuedDecodeTypeDeserializer< T >::pokeLocked().

◆ pendingOutputs

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

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