coral
A C++ library for distributed co-simulation
Classes | Public Member Functions | List of all members
coral::master::ProviderCluster Class Reference

A common communication interface to a cluster of slave providers. More...

#include "coral/master/cluster.hpp"

Classes

struct  SlaveType
 Information about a slave type. More...
 

Public Member Functions

 ProviderCluster (const coral::net::ip::Address &networkInterface, coral::net::ip::Port discoveryPort)
 Constructor. More...
 
 ~ProviderCluster () CORAL_NOEXCEPT
 Destructor.
 
 ProviderCluster (ProviderCluster &&) CORAL_NOEXCEPT
 Move constructor.
 
ProviderClusteroperator= (ProviderCluster &&) CORAL_NOEXCEPT
 Move assignment operator.
 
std::vector< SlaveTypeGetSlaveTypes (std::chrono::milliseconds timeout)
 Returns available slave types. More...
 
coral::net::SlaveLocator InstantiateSlave (const std::string &slaveProviderID, const std::string &slaveTypeUUID, std::chrono::milliseconds timeout)
 Instantiates a slave. More...
 

Detailed Description

A common communication interface to a cluster of slave providers.

This class represents a common interface to several slave providers in a network. It can be used to get information about the available slave types and to instantiate slaves on specific providers.

Remarks
When an object of this class is created, it will spawn a background thread that performs the actual communication with the slave providers. To ensure that there is a one-to-one relationship between an object of this class and its underlying communication thread, the objects are noncopyable (but movable), and will attempt to shut down the thread on destruction.

Constructor & Destructor Documentation

coral::master::ProviderCluster::ProviderCluster ( const coral::net::ip::Address networkInterface,
coral::net::ip::Port  discoveryPort 
)

Constructor.

Parameters
[in]networkInterfaceThe name or IP address of the network interface that should be used, or "*" for all available interfaces.
[in]discoveryPortThe UDP port used for discovering other entities such as slave providers.

Member Function Documentation

std::vector<SlaveType> coral::master::ProviderCluster::GetSlaveTypes ( std::chrono::milliseconds  timeout)

Returns available slave types.

Parameters
[in]timeoutMaximum time to wait for replies from known slave providers.
coral::net::SlaveLocator coral::master::ProviderCluster::InstantiateSlave ( const std::string slaveProviderID,
const std::string slaveTypeUUID,
std::chrono::milliseconds  timeout 
)

Instantiates a slave.

timeout specifies how long the slave provider should wait for the slave to start up before assuming it has crashed or frozen. The master will wait twice as long as this for the slave provider to report that the slave has been successfully instantiated before it assumes the slave provider itself has crashed or the connection has been lost. In both cases, an exception is thrown.

Parameters
[in]slaveProviderIDThe ID of the slave provider that should instantiate the slave.
[in]slaveTypeUUIDThe UUID that identifies the type of the slave that is to be instantiated.
[in]timeoutHow much time the slave gets to start up.
Returns
An object that contains the information needed to locate the slave.

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