|
CIRCT 23.0.0git
|
Strongly typed wrapper around a raw read channel. More...
#include <TypedPorts.h>

Public Member Functions | |
| TypedReadPort (ReadChannelPort &port) | |
| TypedReadPort (ReadChannelPort *port) | |
| TypedReadPort (const TypedReadPort &)=delete | |
| TypedReadPort & | operator= (const TypedReadPort &)=delete |
| TypedReadPort (TypedReadPort &&)=delete | |
| TypedReadPort & | operator= (TypedReadPort &&)=delete |
| ~TypedReadPort () | |
| void | connect (const ChannelPort::ConnectOptions &opts={std::nullopt, false}) |
| Connect in polling mode. | |
| void | connect (std::function< bool(const T &)> callback, const ChannelPort::ConnectOptions &opts={std::nullopt, false}) |
| Connect a non-owning typed callback. | |
| void | connect (detail::TypedReadOwnedCallback< T > callback, const ChannelPort::ConnectOptions &opts={std::nullopt, false}) |
| Connect an owning typed callback. | |
| std::unique_ptr< T > | read () |
| Blocking typed read in polling mode. | |
| std::future< std::unique_ptr< T > > | readAsync () |
| Asynchronous typed read in polling mode. | |
| void | setMaxDataQueueMsgs (uint64_t maxMsgs) |
| Set the maximum number of decoded typed values buffered in polling mode. | |
| void | disconnect () |
| Disconnect the typed port and abandon any pending polling reads. | |
| bool | isConnected () const |
| ReadChannelPort & | raw () |
| const ReadChannelPort & | raw () const |
Private Types | |
| enum | Mode { Disconnected , Callback , Polling } |
| using | Deserializer = detail::DeserializerFor< T > |
| using | PollingState = detail::PollingBuffer< std::unique_ptr< T > > |
Private Member Functions | |
| void | resetConnectState () |
| void | emplaceDeserializer (detail::DeserializerOutputCallback< T > callback) |
| void | prepareConnect () |
Private Attributes | |
| ReadChannelPort * | inner |
| WireInfo | wireInfo_ |
| Mode | mode = Mode::Disconnected |
| uint64_t | maxDataQueueMsgs = ReadChannelPort::DefaultMaxDataQueueMsgs |
| std::optional< Deserializer > | deserializer |
| std::optional< PollingState > | pollingState |
Strongly typed wrapper around a raw read channel.
For scalar/POD-like T, this performs a 1:1 conversion from raw messages. If T defines a nested TypeDeserializer, one instance is created per connection and drives both callback and polling reads through that deserializer.
Polling reads return std::unique_ptr<T> so complex decoded values can be delivered without an extra copy.
Definition at line 718 of file TypedPorts.h.
|
private |
Definition at line 850 of file TypedPorts.h.
|
private |
Definition at line 852 of file TypedPorts.h.
|
private |
| Enumerator | |
|---|---|
| Disconnected | |
| Callback | |
| Polling | |
Definition at line 851 of file TypedPorts.h.
|
inlineexplicit |
Definition at line 720 of file TypedPorts.h.
|
inline |
Definition at line 722 of file TypedPorts.h.
|
delete |
|
delete |
|
inline |
Definition at line 728 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::disconnect(), esi::TypedReadPort< T, SkipTypeCheck >::Disconnected, esi::TypedReadPort< T, SkipTypeCheck >::inner, and esi::TypedReadPort< T, SkipTypeCheck >::mode.
|
inline |
Connect in polling mode.
The port installs an internal typed output queue. read() and readAsync() consume from that queue.
Definition at line 737 of file TypedPorts.h.
Referenced by runCustomServiceDeclChannel(), and runLoopbackI8().
|
inline |
Connect an owning typed callback.
This is the typed analogue of ReadChannelPort::ReadCallback: the callback may take ownership of the decoded value or return false to retry delivery later with the same object.
Definition at line 777 of file TypedPorts.h.
|
inline |
Connect a non-owning typed callback.
The callback sees the decoded value by reference. Returning false requests that the same decoded value be retried later.
Definition at line 764 of file TypedPorts.h.
|
inline |
Disconnect the typed port and abandon any pending polling reads.
Definition at line 839 of file TypedPorts.h.
References esi::ReadChannelPort::disconnect(), esi::TypedReadPort< T, SkipTypeCheck >::Disconnected, esi::TypedReadPort< T, SkipTypeCheck >::inner, esi::TypedReadPort< T, SkipTypeCheck >::mode, and esi::TypedReadPort< T, SkipTypeCheck >::resetConnectState().
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::~TypedReadPort(), and esi::TypedReadPort< void >::~TypedReadPort().
|
inlineprivate |
Definition at line 859 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::deserializer, and esi::TypedReadPort< T, SkipTypeCheck >::wireInfo_.
|
inline |
Definition at line 844 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::inner, and esi::ReadChannelPort::isConnected().
|
delete |
|
delete |
|
inlineprivate |
Definition at line 867 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::Disconnected, esi::ChannelPort::getType(), esi::getWireInfo(), esi::TypedReadPort< T, SkipTypeCheck >::inner, esi::TypedReadPort< T, SkipTypeCheck >::mode, and esi::TypedReadPort< T, SkipTypeCheck >::wireInfo_.
|
inline |
Definition at line 846 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::inner.
|
inline |
Definition at line 847 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::inner.
|
inline |
Blocking typed read in polling mode.
Definition at line 801 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::readAsync().
Referenced by esiaccel.bsp.common.ESI_Manifest_ROM_Wrapper::build(), runCustomServiceDeclChannel(), and runLoopbackI8().
|
inline |
Asynchronous typed read in polling mode.
The returned future yields ownership of the next decoded value.
Definition at line 810 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::Callback, esi::TypedReadPort< T, SkipTypeCheck >::deserializer, esi::TypedReadPort< T, SkipTypeCheck >::Disconnected, esi::TypedReadPort< T, SkipTypeCheck >::mode, and esi::TypedReadPort< T, SkipTypeCheck >::pollingState.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::read().
|
inlineprivate |
Definition at line 854 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::deserializer, and esi::TypedReadPort< T, SkipTypeCheck >::pollingState.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::disconnect().
|
inline |
Set the maximum number of decoded typed values buffered in polling mode.
0 means unbounded.
Definition at line 832 of file TypedPorts.h.
References esi::TypedReadPort< T, SkipTypeCheck >::maxDataQueueMsgs, and esi::TypedReadPort< T, SkipTypeCheck >::pollingState.
|
private |
Definition at line 887 of file TypedPorts.h.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::emplaceDeserializer(), esi::TypedReadPort< T, SkipTypeCheck >::readAsync(), and esi::TypedReadPort< T, SkipTypeCheck >::resetConnectState().
|
private |
Definition at line 883 of file TypedPorts.h.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::disconnect(), esi::TypedReadPort< void >::disconnect(), esi::TypedReadPort< T, SkipTypeCheck >::isConnected(), esi::TypedReadPort< void >::isConnected(), esi::TypedReadPort< T, SkipTypeCheck >::prepareConnect(), esi::TypedReadPort< T, SkipTypeCheck >::raw(), esi::TypedReadPort< void >::raw(), esi::TypedReadPort< T, SkipTypeCheck >::raw(), esi::TypedReadPort< void >::raw(), esi::TypedReadPort< void >::read(), esi::TypedReadPort< void >::readAsync(), esi::TypedReadPort< T, SkipTypeCheck >::~TypedReadPort(), and esi::TypedReadPort< void >::~TypedReadPort().
|
private |
Definition at line 886 of file TypedPorts.h.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::setMaxDataQueueMsgs().
|
private |
|
private |
Definition at line 888 of file TypedPorts.h.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::readAsync(), esi::TypedReadPort< T, SkipTypeCheck >::resetConnectState(), and esi::TypedReadPort< T, SkipTypeCheck >::setMaxDataQueueMsgs().
|
private |
Definition at line 884 of file TypedPorts.h.
Referenced by esi::TypedReadPort< T, SkipTypeCheck >::emplaceDeserializer(), and esi::TypedReadPort< T, SkipTypeCheck >::prepareConnect().