CIRCT  19.0.0git
Public Member Functions | Private Types | Private Attributes | List of all members
esi::cosim::EndpointRegistry Class Reference

The Endpoint registry is where Endpoints report their existence (register) and they are looked up by RPC clients. More...

#include <Endpoint.h>

Collaboration diagram for esi::cosim::EndpointRegistry:
Collaboration graph
[legend]

Public Member Functions

bool registerEndpoint (std::string epId, std::string fromHostTypeId, std::string toHostTypeId)
 Register an Endpoint. More...
 
Endpointoperator[] (const std::string &epId)
 Get the specified endpoint. More...
 
void iterateEndpoints (const std::function< void(std::string id, const Endpoint &)> &f) const
 Iterate over the list of endpoints, calling the provided function for each endpoint. More...
 
size_t size () const
 Return the number of endpoints. More...
 

Private Types

using Lock = std::lock_guard< std::mutex >
 

Private Attributes

std::mutex m
 This object needs to be thread-safe. An object-wide mutex is sufficient. More...
 
std::map< std::string, Endpointendpoints
 Endpoint ID to object pointer mapping. More...
 

Detailed Description

The Endpoint registry is where Endpoints report their existence (register) and they are looked up by RPC clients.

Definition at line 110 of file Endpoint.h.

Member Typedef Documentation

◆ Lock

using esi::cosim::EndpointRegistry::Lock = std::lock_guard<std::mutex>
private

Definition at line 137 of file Endpoint.h.

Member Function Documentation

◆ iterateEndpoints()

void EndpointRegistry::iterateEndpoints ( const std::function< void(std::string id, const Endpoint &)> &  f) const

Iterate over the list of endpoints, calling the provided function for each endpoint.

Definition at line 55 of file Endpoint.cpp.

References endpoints, and m.

◆ operator[]()

Endpoint* esi::cosim::EndpointRegistry::operator[] ( const std::string &  epId)
inline

Get the specified endpoint.

Return nullptr if it does not exist. This method is defined inline so it can be inlined at compile time. Performance is important here since this method is used in the polling call from the simulator. Returns nullptr if the endpoint cannot be found.

Definition at line 121 of file Endpoint.h.

References endpoints, and m.

◆ registerEndpoint()

bool EndpointRegistry::registerEndpoint ( std::string  epId,
std::string  fromHostTypeId,
std::string  toHostTypeId 
)

Register an Endpoint.

Creates the Endpoint object and owns it. Returns false if unsuccessful.

Definition at line 37 of file Endpoint.cpp.

References endpoints, and m.

Referenced by esi::cosim::RpcClient::Impl::Impl(), and esi::cosim::RpcServer::registerEndpoint().

◆ size()

size_t EndpointRegistry::size ( ) const

Return the number of endpoints.

Definition at line 65 of file Endpoint.cpp.

References endpoints, and m.

Referenced by esiaccel.types.ArrayType::bit_width(), esiaccel.types.ArrayType::deserialize(), and esiaccel.types.ArrayType::is_valid().

Member Data Documentation

◆ endpoints

std::map<std::string, Endpoint> esi::cosim::EndpointRegistry::endpoints
private

Endpoint ID to object pointer mapping.

Definition at line 143 of file Endpoint.h.

Referenced by iterateEndpoints(), operator[](), registerEndpoint(), and size().

◆ m

std::mutex esi::cosim::EndpointRegistry::m
private

This object needs to be thread-safe. An object-wide mutex is sufficient.

Definition at line 140 of file Endpoint.h.

Referenced by iterateEndpoints(), operator[](), registerEndpoint(), and size().


The documentation for this class was generated from the following files: