CIRCT
19.0.0git
|
Implements a bi-directional, thread-safe bridge between the RPC server and DPI functions. More...
#include <Endpoint.h>
Public Types | |
using | MessageDataPtr = std::unique_ptr< MessageData > |
Representing messages as shared pointers to vectors may be a performance issue in the future but it is the easiest way to ensure memory correctness. More... | |
Public Member Functions | |
Endpoint (std::string fromHostTypeId, std::string toHostTypeId) | |
Construct an endpoint which knows and the type IDs in both directions. More... | |
~Endpoint () | |
Endpoint (const Endpoint &)=delete | |
Disallow copying. More... | |
std::string | getSendTypeId () const |
std::string | getRecvTypeId () const |
bool | setInUse () |
These two are used to set and unset the inUse flag, to ensure that an open endpoint is not opened again. More... | |
void | returnForUse () |
void | pushMessageToSim (MessageDataPtr msg) |
Queue message to the simulation. More... | |
bool | getMessageToSim (MessageDataPtr &msg) |
Pop from the to-simulator queue. More... | |
void | pushMessageToClient (MessageDataPtr msg) |
Queue message to the RPC client. More... | |
bool | getMessageToClient (MessageDataPtr &msg) |
Pop from the to-RPC-client queue. More... | |
Private Types | |
using | Lock = std::lock_guard< std::mutex > |
Private Attributes | |
const std::string | fromHostTypeId |
const std::string | toHostTypeId |
bool | inUse |
std::mutex | m |
This class needs to be thread-safe. More... | |
std::queue< MessageDataPtr > | toCosim |
Message queue from RPC client to the simulation. More... | |
std::queue< MessageDataPtr > | toClient |
Message queue to RPC client from the simulation. More... | |
Implements a bi-directional, thread-safe bridge between the RPC server and DPI functions.
Several of the methods below are inline with the declaration to make them candidates for inlining during compilation. This is particularly important on the simulation side since polling happens at each clock and we do not want to slow down the simulation any more than necessary.
Definition at line 35 of file Endpoint.h.
|
private |
Definition at line 96 of file Endpoint.h.
using esi::cosim::Endpoint::MessageDataPtr = std::unique_ptr<MessageData> |
Representing messages as shared pointers to vectors may be a performance issue in the future but it is the easiest way to ensure memory correctness.
Definition at line 40 of file Endpoint.h.
Endpoint::Endpoint | ( | std::string | fromHostTypeId, |
std::string | toHostTypeId | ||
) |
Construct an endpoint which knows and the type IDs in both directions.
Definition at line 17 of file Endpoint.cpp.
Endpoint::~Endpoint | ( | ) |
Definition at line 20 of file Endpoint.cpp.
|
delete |
Disallow copying.
There is only ONE endpoint object per logical endpoint so copying is almost always a bug.
|
inline |
Pop from the to-RPC-client queue.
Return true if there was a message in the queue.
Definition at line 82 of file Endpoint.h.
|
inline |
Pop from the to-simulator queue.
Return true if there was a message in the queue.
Definition at line 65 of file Endpoint.h.
Referenced by sv2cCosimserverEpTryGet().
|
inline |
Definition at line 50 of file Endpoint.h.
References toHostTypeId.
|
inline |
Definition at line 49 of file Endpoint.h.
References fromHostTypeId.
|
inline |
Queue message to the RPC client.
Definition at line 75 of file Endpoint.h.
Referenced by sv2cCosimserverEpTryPut().
|
inline |
Queue message to the simulation.
Definition at line 58 of file Endpoint.h.
void Endpoint::returnForUse | ( | ) |
Definition at line 30 of file Endpoint.cpp.
bool Endpoint::setInUse | ( | ) |
These two are used to set and unset the inUse flag, to ensure that an open endpoint is not opened again.
Definition at line 22 of file Endpoint.cpp.
|
private |
Definition at line 92 of file Endpoint.h.
Referenced by getSendTypeId().
|
private |
Definition at line 94 of file Endpoint.h.
Referenced by returnForUse(), and setInUse().
|
private |
This class needs to be thread-safe.
All of the mutable member variables are protected with this object-wide lock. This may be a performance issue in the future.
Definition at line 101 of file Endpoint.h.
Referenced by getMessageToClient(), getMessageToSim(), pushMessageToClient(), pushMessageToSim(), returnForUse(), and setInUse().
|
private |
Message queue to RPC client from the simulation.
Definition at line 105 of file Endpoint.h.
Referenced by getMessageToClient(), and pushMessageToClient().
|
private |
Message queue from RPC client to the simulation.
Definition at line 103 of file Endpoint.h.
Referenced by getMessageToSim(), and pushMessageToSim().
|
private |
Definition at line 93 of file Endpoint.h.
Referenced by getRecvTypeId().