coral
A C++ library for distributed co-simulation
|
A class for communicating with a single slave provider. More...
#include "coral/bus/slave_provider_comm.hpp"
Public Types | |
typedef std::function< void(const std::error_code &error, const coral::model::SlaveTypeDescription *slaveTypes, std::size_t slaveTypeCount)> | GetSlaveTypesHandler |
Completion handler type for GetSlaveTypes(). | |
typedef std::function< void(const std::error_code &ec, const coral::net::SlaveLocator &slaveLocator, const std::string &errorMessage)> | InstantiateSlaveHandler |
Completion handler type for InstantiateSlave(). | |
Public Member Functions | |
SlaveProviderClient (coral::net::Reactor &reactor, const coral::net::ip::Endpoint &endpoint) | |
Constructor. More... | |
~SlaveProviderClient () CORAL_NOEXCEPT | |
Destructor. | |
SlaveProviderClient (SlaveProviderClient &&) CORAL_NOEXCEPT | |
Move constructor. | |
SlaveProviderClient & | operator= (SlaveProviderClient &&) CORAL_NOEXCEPT |
Move assignment operator. | |
void | GetSlaveTypes (GetSlaveTypesHandler onComplete, std::chrono::milliseconds timeout) |
Requests a list of slave types provided. More... | |
void | InstantiateSlave (const std::string &slaveTypeUUID, std::chrono::milliseconds instantiationTimeout, InstantiateSlaveHandler onComplete, std::chrono::milliseconds requestTimeout=std::chrono::milliseconds(0)) |
Requests the instantiation of a slave. More... | |
A class for communicating with a single slave provider.
coral::bus::SlaveProviderClient::SlaveProviderClient | ( | coral::net::Reactor & | reactor, |
const coral::net::ip::Endpoint & | endpoint | ||
) |
Constructor.
[in] | reactor | Used to listen for incoming messages from the slave provider. |
[in] | address | The IP address or hostname of the slave provider. |
[in] | port | The port on which the slave provider is accepting connections. |
void coral::bus::SlaveProviderClient::GetSlaveTypes | ( | GetSlaveTypesHandler | onComplete, |
std::chrono::milliseconds | timeout | ||
) |
Requests a list of slave types provided.
[in] | onComplete | Function which is called when the result is ready, or with an error code in case of failure. |
[in] | timeout | Maximum time allowed for the request to complete. |
void coral::bus::SlaveProviderClient::InstantiateSlave | ( | const std::string & | slaveTypeUUID, |
std::chrono::milliseconds | instantiationTimeout, | ||
InstantiateSlaveHandler | onComplete, | ||
std::chrono::milliseconds | requestTimeout = std::chrono::milliseconds(0) |
||
) |
Requests the instantiation of a slave.
[in] | slaveTypeUUID | The slave type identifier. |
[in] | instantiationTimeout | The max allowed time for the slave to start up. |
[in] | onComplete | Function which is called with the slave address when the slave has been instantiated, or with an error code and message in case of failure. |
[in] | requestTimeout | Maximum time allowed for the request to complete, which must of course be greater than instantiationTimeout . |