|
CIRCT 22.0.0git
|
A gRPC client for communicating with the cosimulation server. More...
#include <RpcClient.h>

Classes | |
| struct | ChannelDesc |
| Description of a channel from the server. More... | |
| class | Impl |
| class | ReadChannelConnection |
| Abstract handle for a read channel connection. More... | |
Public Types | |
| enum class | ChannelDirection { ToServer , ToClient } |
| Channel direction as reported by the server. More... | |
| using | ReadCallback = std::function< bool(const MessageData &)> |
| Callback type for receiving messages from a client-bound channel. | |
Public Member Functions | |
| RpcClient (const std::string &hostname, uint16_t port) | |
| ~RpcClient () | |
| RpcClient (const RpcClient &)=delete | |
| RpcClient & | operator= (const RpcClient &)=delete |
| uint32_t | getEsiVersion () const |
| Get the ESI version from the manifest. | |
| std::vector< uint8_t > | getCompressedManifest () const |
| Get the compressed manifest from the server. | |
| bool | getChannelDesc (const std::string &channelName, ChannelDesc &desc) const |
| Get the channel description for a channel name. | |
| std::vector< ChannelDesc > | listChannels () const |
| List all channels available on the server. | |
| void | writeToServer (const std::string &channelName, const MessageData &data) |
| Send a message to a server-bound channel. | |
| std::unique_ptr< ReadChannelConnection > | connectClientReceiver (const std::string &channelName, ReadCallback callback) |
| Connect to a client-bound channel and receive messages via callback. | |
Private Attributes | |
| std::unique_ptr< Impl > | impl |
A gRPC client for communicating with the cosimulation server.
This class wraps all gRPC/protobuf dependencies.
Definition at line 36 of file RpcClient.h.
| using esi::backends::cosim::RpcClient::ReadCallback = std::function<bool(const MessageData &)> |
Callback type for receiving messages from a client-bound channel.
Return true if the message was consumed, false to retry.
Definition at line 73 of file RpcClient.h.
|
strong |
Channel direction as reported by the server.
| Enumerator | |
|---|---|
| ToServer | |
| ToClient | |
Definition at line 52 of file RpcClient.h.
| RpcClient::RpcClient | ( | const std::string & | hostname, |
| uint16_t | port | ||
| ) |
Definition at line 204 of file RpcClient.cpp.
|
default |
|
delete |
| std::unique_ptr< RpcClient::ReadChannelConnection > RpcClient::connectClientReceiver | ( | const std::string & | channelName, |
| ReadCallback | callback | ||
| ) |
Connect to a client-bound channel and receive messages via callback.
Returns a handle that disconnects when destroyed.
Definition at line 246 of file RpcClient.cpp.
References impl.
| bool RpcClient::getChannelDesc | ( | const std::string & | channelName, |
| ChannelDesc & | desc | ||
| ) | const |
Get the channel description for a channel name.
Returns true if the channel was found.
Definition at line 220 of file RpcClient.cpp.
References esi::backends::cosim::RpcClient::ChannelDesc::dir, impl, esi::backends::cosim::RpcClient::ChannelDesc::name, ToClient, ToServer, and esi::backends::cosim::RpcClient::ChannelDesc::type.
| std::vector< uint8_t > RpcClient::getCompressedManifest | ( | ) | const |
Get the compressed manifest from the server.
Definition at line 213 of file RpcClient.cpp.
References impl.
| uint32_t RpcClient::getEsiVersion | ( | ) | const |
Get the ESI version from the manifest.
Definition at line 209 of file RpcClient.cpp.
References impl.
| std::vector< RpcClient::ChannelDesc > RpcClient::listChannels | ( | ) | const |
List all channels available on the server.
Definition at line 236 of file RpcClient.cpp.
References impl.
| void RpcClient::writeToServer | ( | const std::string & | channelName, |
| const MessageData & | data | ||
| ) |
Send a message to a server-bound channel.
Definition at line 240 of file RpcClient.cpp.
References impl.
|
private |
Definition at line 90 of file RpcClient.h.
Referenced by connectClientReceiver(), getChannelDesc(), getCompressedManifest(), getEsiVersion(), listChannels(), and writeToServer().