coral
A C++ library for distributed co-simulation
Public Types | Public Member Functions | List of all members
coral::bus::SlaveProviderClient Class Reference

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.
 
SlaveProviderClientoperator= (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...
 

Detailed Description

A class for communicating with a single slave provider.

Constructor & Destructor Documentation

coral::bus::SlaveProviderClient::SlaveProviderClient ( coral::net::Reactor reactor,
const coral::net::ip::Endpoint endpoint 
)

Constructor.

Parameters
[in]reactorUsed to listen for incoming messages from the slave provider.
[in]addressThe IP address or hostname of the slave provider.
[in]portThe port on which the slave provider is accepting connections.

Member Function Documentation

void coral::bus::SlaveProviderClient::GetSlaveTypes ( GetSlaveTypesHandler  onComplete,
std::chrono::milliseconds  timeout 
)

Requests a list of slave types provided.

Parameters
[in]onCompleteFunction which is called when the result is ready, or with an error code in case of failure.
[in]timeoutMaximum 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.

Parameters
[in]slaveTypeUUIDThe slave type identifier.
[in]instantiationTimeoutThe max allowed time for the slave to start up.
[in]onCompleteFunction 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]requestTimeoutMaximum time allowed for the request to complete, which must of course be greater than instantiationTimeout.

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