A C++ library for distributed co-simulation
Public Member Functions | List of all members
coral::provider::SlaveCreator Class Referenceabstract

An interface for classes that create slaves of a specific type. More...

#include "coral/provider/slave_creator.hpp"

Public Member Functions

virtual const coral::model::SlaveTypeDescriptionDescription () const =0
 A description of this slave type.
virtual bool Instantiate (std::chrono::milliseconds timeout, coral::net::SlaveLocator &slaveLocator)=0
 Creates a new instance of this slave type. More...
virtual std::string InstantiationFailureDescription () const =0
 A textual description of why a previous Instantiate() call failed. More...

Detailed Description

An interface for classes that create slaves of a specific type.

Member Function Documentation

virtual bool coral::provider::SlaveCreator::Instantiate ( std::chrono::milliseconds  timeout,
coral::net::SlaveLocator slaveLocator 
pure virtual

Creates a new instance of this slave type.

This function must report whether a slave was successfully instantiated. For example, the slave may represent a particular piece of hardware (e.g. a human interface device), of which there is only one. The function would then return false if multiple instantiations are attempted.

If the function returns true, it must also update slaveLocator with information about the new slave. slaveLocator.Endpoint() may then have one of three forms:

  1. "Normal", i.e. transport://address
  2. Empty, which means that the slave is accessible through the same endpoint as the slave provider (typically a proxy), except of course with a different identity.
  3. Only a port specification starting with a colon, e.g. :12345. This may be used if the slave provider is bound to a TCP endpoint, and the slave is accessible on the same hostname but with a different port number.

If the function returns false, InstantiationFailureDescription() must return a textual description of the reasons for this. slaveLocator must then be left untouched.

[in]timeoutHow long the master will wait for the slave to start up. If possible, instantiation should be aborted and considered "failed" after this time has passed.
[out]slaveLocatorAn object that describes how to connect to the slave. See the list above for different endpoint formats.
true if a slave was successfully instantiated, false otherwise.
virtual std::string coral::provider::SlaveCreator::InstantiationFailureDescription ( ) const
pure virtual

A textual description of why a previous Instantiate() call failed.

This function is only called if Instantiate() has returned false.

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