|
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 733 of file TypedPorts.h.
|
private |
Definition at line 865 of file TypedPorts.h.
|
private |
Definition at line 867 of file TypedPorts.h.
|
private |
| Enumerator | |
|---|---|
| Disconnected | |
| Callback | |
| Polling | |
Definition at line 866 of file TypedPorts.h.
|
inlineexplicit |
Definition at line 735 of file TypedPorts.h.
References inner.
Referenced by operator=(), operator=(), TypedReadPort(), and TypedReadPort().
|
inline |
Definition at line 737 of file TypedPorts.h.
References inner.
|
delete |
References TypedReadPort().
|
delete |
References TypedReadPort().
|
inline |
Definition at line 743 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 752 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 792 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 779 of file TypedPorts.h.
|
inline |
Disconnect the typed port and abandon any pending polling reads.
Definition at line 854 of file TypedPorts.h.
References Disconnected, inner, mode, and resetConnectState().
Referenced by ~TypedReadPort(), and esi::TypedReadPort< void >::~TypedReadPort().
|
inlineprivate |
Definition at line 874 of file TypedPorts.h.
References deserializer, esi::detail::has_type_deserializer_v, and wireInfo_.
|
inline |
Definition at line 859 of file TypedPorts.h.
References inner.
|
delete |
References TypedReadPort().
|
delete |
References TypedReadPort().
|
inlineprivate |
Definition at line 882 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 861 of file TypedPorts.h.
References inner.
|
inline |
Definition at line 862 of file TypedPorts.h.
References inner.
|
inline |
Blocking typed read in polling mode.
Definition at line 816 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 825 of file TypedPorts.h.
References Callback, deserializer, Disconnected, mode, and pollingState.
Referenced by read().
|
inlineprivate |
Definition at line 869 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 847 of file TypedPorts.h.
References maxDataQueueMsgs, and pollingState.
|
private |
Definition at line 902 of file TypedPorts.h.
Referenced by emplaceDeserializer(), readAsync(), and resetConnectState().
|
private |
Definition at line 898 of file TypedPorts.h.
Referenced by disconnect(), isConnected(), prepareConnect(), raw(), raw(), TypedReadPort(), TypedReadPort(), and ~TypedReadPort().
|
private |
Definition at line 901 of file TypedPorts.h.
Referenced by setMaxDataQueueMsgs().
|
private |
Definition at line 900 of file TypedPorts.h.
Referenced by disconnect(), prepareConnect(), readAsync(), and ~TypedReadPort().
|
private |
Definition at line 903 of file TypedPorts.h.
Referenced by readAsync(), resetConnectState(), and setMaxDataQueueMsgs().
|
private |
Definition at line 899 of file TypedPorts.h.
Referenced by emplaceDeserializer(), and prepareConnect().