|
CIRCT 24.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 798 of file TypedPorts.h.
|
private |
Definition at line 930 of file TypedPorts.h.
|
private |
Definition at line 932 of file TypedPorts.h.
|
private |
| Enumerator | |
|---|---|
| Disconnected | |
| Callback | |
| Polling | |
Definition at line 931 of file TypedPorts.h.
|
inlineexplicit |
Definition at line 800 of file TypedPorts.h.
References inner.
Referenced by operator=(), operator=(), TypedReadPort(), and TypedReadPort().
|
inline |
Definition at line 802 of file TypedPorts.h.
References inner.
|
delete |
References TypedReadPort().
|
delete |
References TypedReadPort().
|
inline |
Definition at line 808 of file TypedPorts.h.
References disconnect(), Disconnected, inner, and mode.
|
inline |
Connect in polling mode.
The port installs an internal typed output queue. read() and readAsync() consume from that queue.
Definition at line 817 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 857 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 844 of file TypedPorts.h.
|
inline |
Disconnect the typed port and abandon any pending polling reads.
Definition at line 919 of file TypedPorts.h.
References Disconnected, inner, mode, and resetConnectState().
Referenced by ~TypedReadPort(), and esi::TypedReadPort< void >::~TypedReadPort().
|
inlineprivate |
Definition at line 939 of file TypedPorts.h.
References deserializer, esi::detail::has_type_deserializer_v, and wireInfo_.
|
inline |
Definition at line 924 of file TypedPorts.h.
References inner.
|
delete |
References TypedReadPort().
|
delete |
References TypedReadPort().
|
inlineprivate |
Definition at line 947 of file TypedPorts.h.
References Disconnected, esi::getWireInfo(), esi::has_esi_id_v, esi::detail::has_type_deserializer_v, inner, mode, esi::verifyTypeCompatibility(), and wireInfo_.
|
inline |
Definition at line 926 of file TypedPorts.h.
References inner.
|
inline |
Definition at line 927 of file TypedPorts.h.
References inner.
|
inline |
Blocking typed read in polling mode.
Definition at line 881 of file TypedPorts.h.
References readAsync().
Referenced by runCustomServiceDeclChannel(), and runLoopbackI8().
|
inline |
Asynchronous typed read in polling mode.
The returned future yields ownership of the next decoded value.
Definition at line 890 of file TypedPorts.h.
References Callback, deserializer, Disconnected, mode, and pollingState.
Referenced by read().
|
inlineprivate |
Definition at line 934 of file TypedPorts.h.
References deserializer, and pollingState.
Referenced by disconnect().
|
inline |
Set the maximum number of decoded typed values buffered in polling mode.
0 means unbounded.
Definition at line 912 of file TypedPorts.h.
References maxDataQueueMsgs, and pollingState.
|
private |
Definition at line 967 of file TypedPorts.h.
Referenced by emplaceDeserializer(), readAsync(), and resetConnectState().
|
private |
Definition at line 963 of file TypedPorts.h.
Referenced by disconnect(), isConnected(), prepareConnect(), raw(), raw(), TypedReadPort(), TypedReadPort(), and ~TypedReadPort().
|
private |
Definition at line 966 of file TypedPorts.h.
Referenced by setMaxDataQueueMsgs().
|
private |
Definition at line 965 of file TypedPorts.h.
Referenced by disconnect(), prepareConnect(), readAsync(), and ~TypedReadPort().
|
private |
Definition at line 968 of file TypedPorts.h.
Referenced by readAsync(), resetConnectState(), and setMaxDataQueueMsgs().
|
private |
Definition at line 964 of file TypedPorts.h.
Referenced by emplaceDeserializer(), and prepareConnect().