helics  3.5.2
Public Member Functions | List of all members
helics::Broker Class Referenceabstract

#include <Broker.hpp>

+ Inheritance diagram for helics::Broker:

Public Member Functions

 Broker ()=default
 
virtual ~Broker ()=default
 
virtual bool connect ()=0
 
virtual void disconnect ()=0
 
virtual bool isConnected () const =0
 
virtual void setAsRoot ()=0
 
virtual bool isRoot () const =0
 
virtual bool isOpenToNewFederates () const =0
 
virtual void configure (std::string_view configureString)=0
 
virtual void configureFromArgs (int argc, char *argv[])=0
 
virtual void configureFromVector (std::vector< std::string > args)=0
 
virtual const std::string & getIdentifier () const =0
 
virtual const std::string & getAddress () const =0
 
virtual void setLoggingLevel (int logLevel)=0
 
virtual void setLoggingCallback (std::function< void(int, std::string_view, std::string_view)> logFunction)=0
 
virtual void setLogFile (std::string_view lfile)=0
 
virtual bool waitForDisconnect (std::chrono::milliseconds msToWait=std::chrono::milliseconds(0)) const =0
 
virtual std::string query (std::string_view target, std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)=0
 
virtual void setGlobal (std::string_view valueName, std::string_view value)=0
 
virtual void sendCommand (std::string_view target, std::string_view commandStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)=0
 
virtual void makeConnections (const std::string &file)=0
 
virtual void linkEndpoints (std::string_view source, std::string_view target)=0
 
virtual void dataLink (std::string_view source, std::string_view target)=0
 
virtual void addSourceFilterToEndpoint (std::string_view filter, std::string_view target)=0
 
virtual void addDestinationFilterToEndpoint (std::string_view filter, std::string_view target)=0
 
virtual void addAlias (std::string_view interfaceKey, std::string_view alias)=0
 
virtual void setTimeBarrier (Time barrierTime)=0
 
virtual void clearTimeBarrier ()=0
 
virtual void globalError (int32_t errorCode, std::string_view errorString)=0
 

Detailed Description

virtual class defining a public interface to a broker

Constructor & Destructor Documentation

◆ Broker()

helics::Broker::Broker ( )
default

default constructor

◆ ~Broker()

virtual helics::Broker::~Broker ( )
virtualdefault

destructor

Member Function Documentation

◆ addAlias()

virtual void helics::Broker::addAlias ( std::string_view  interfaceKey,
std::string_view  alias 
)
pure virtual

make an alias for an interface, which is a second string that may be used for making connections

Parameters
interfaceKeythe name of the original interface
aliasthe second name by which it can be used

Implemented in helics::CoreBroker.

◆ addDestinationFilterToEndpoint()

virtual void helics::Broker::addDestinationFilterToEndpoint ( std::string_view  filter,
std::string_view  target 
)
pure virtual

create a filter connection between a named filter and a named endpoint for destination processing

Parameters
filterthe name of the filter
targetthe name of the source target

Implemented in helics::CoreBroker.

◆ addSourceFilterToEndpoint()

virtual void helics::Broker::addSourceFilterToEndpoint ( std::string_view  filter,
std::string_view  target 
)
pure virtual

create a filter connection between a named filter and a named endpoint for messages coming from that endpoint

Parameters
filterthe name of the filter
targetthe name of the source target

Implemented in helics::CoreBroker.

◆ clearTimeBarrier()

virtual void helics::Broker::clearTimeBarrier ( )
pure virtual

update a time barrier with a new time

Implemented in helics::CoreBroker.

◆ configure()

virtual void helics::Broker::configure ( std::string_view  configureString)
pure virtual

start up the broker with an initialization string containing commands and parameters

Implemented in helics::CoreBroker.

◆ configureFromArgs()

virtual void helics::Broker::configureFromArgs ( int  argc,
char *  argv[] 
)
pure virtual

initialize from command line arguments

Implemented in helics::CoreBroker.

◆ configureFromVector()

virtual void helics::Broker::configureFromVector ( std::vector< std::string >  args)
pure virtual

Initialize the Broker from command line arguments contained in a vector Should be invoked a single time to initialize the co-simulation broker.

Implemented in helics::CoreBroker.

◆ connect()

virtual bool helics::Broker::connect ( )
pure virtual

connect the core to its broker

should be done after initialization has complete

Implemented in helics::CoreBroker.

◆ dataLink()

virtual void helics::Broker::dataLink ( std::string_view  source,
std::string_view  target 
)
pure virtual

create a data Link between a named publication and a named input

Parameters
sourcethe name of the publication
targetthe name of the input

Implemented in helics::CoreBroker.

◆ disconnect()

virtual void helics::Broker::disconnect ( )
pure virtual

disconnect the broker from any other brokers and communications

Implemented in helics::CoreBroker.

◆ getAddress()

virtual const std::string& helics::Broker::getAddress ( ) const
pure virtual

get the connection address for the broker

Implemented in helics::CoreBroker.

◆ getIdentifier()

virtual const std::string& helics::Broker::getIdentifier ( ) const
pure virtual

get the local identification for the broker

Implemented in helics::CoreBroker.

◆ globalError()

virtual void helics::Broker::globalError ( int32_t  errorCode,
std::string_view  errorString 
)
pure virtual

generate a global ERROR_STATE and halt the federation

Parameters
errorCodethe code to use for the ERROR_STATE
errorStringthe ERROR_STATE message to associate with the ERROR_STATE

Implemented in helics::CoreBroker.

◆ isConnected()

virtual bool helics::Broker::isConnected ( ) const
pure virtual

check if the broker is CONNECTED

Implemented in helics::CoreBroker.

◆ isOpenToNewFederates()

virtual bool helics::Broker::isOpenToNewFederates ( ) const
pure virtual

check if the broker is ready to accept new federates or cores

Implemented in helics::CoreBroker.

◆ isRoot()

virtual bool helics::Broker::isRoot ( ) const
pure virtual

return true if the broker is a root broker

Implemented in helics::CoreBroker.

◆ linkEndpoints()

virtual void helics::Broker::linkEndpoints ( std::string_view  source,
std::string_view  target 
)
pure virtual

create a data Link between two endpoints sending data from source to destination

Parameters
sourcethe name of the endpoint to send from
targetthe name of the endpoint to send the data to

Implemented in helics::CoreBroker.

◆ makeConnections()

virtual void helics::Broker::makeConnections ( const std::string &  file)
pure virtual

load a file containing connection information

Parameters
filea JSON or TOML file containing connection information

Implemented in helics::CoreBroker.

◆ query()

virtual std::string helics::Broker::query ( std::string_view  target,
std::string_view  queryStr,
HelicsSequencingModes  mode = HELICS_SEQUENCING_MODE_FAST 
)
pure virtual

make a query for information from the co-simulation

the format is somewhat unspecified target is the name of an object typically one of "federation", "broker", or the name of a specific object query is a broken

Parameters
targetthe specific target of the query
queryStrthe actual query
modefast (asynchronous; default) means the query goes on priority channels, ordered (synchronous) is slower but has more ordering guarantees
Returns
a string containing the response to the query. Query is a blocking call and will not return until the query is answered so use with caution

Implemented in helics::CoreBroker.

◆ sendCommand()

virtual void helics::Broker::sendCommand ( std::string_view  target,
std::string_view  commandStr,
HelicsSequencingModes  mode = HELICS_SEQUENCING_MODE_FAST 
)
pure virtual

send a command to a specific target

the format is somewhat unspecified; target is the name of an object, typically one of "federation","root", "broker", "core", or the name of a specific object/core/broker

Parameters
targetthe specific target of the command
commandStrthe actual command
modefast (asynchronous; default) means the command goes on priority channels, ordered (synchronous) is slower but has more ordering guarantees

Implemented in helics::CoreBroker.

◆ setAsRoot()

virtual void helics::Broker::setAsRoot ( )
pure virtual

set the broker to be a root broker

only valid before the initialization function is called

Implemented in helics::CoreBroker.

◆ setGlobal()

virtual void helics::Broker::setGlobal ( std::string_view  valueName,
std::string_view  value 
)
pure virtual

set a federation global value

this overwrites any previous value for this name globals can be queried with a target of "global" or "global_value" and queryStr of the value to Query

Parameters
valueNamethe name of the global to set
valuethe value of the global

Implemented in helics::CoreBroker.

◆ setLogFile()

virtual void helics::Broker::setLogFile ( std::string_view  lfile)
pure virtual

set the broker logging file

Implemented in helics::CoreBroker.

◆ setLoggingCallback()

virtual void helics::Broker::setLoggingCallback ( std::function< void(int, std::string_view, std::string_view)>  logFunction)
pure virtual

set the logging callback function

Parameters
logFunctiona function with a signature of void(int level, const std::string &source, const std::string &message) the function takes a level indicating the logging level string with the source name and a string with the message

Implemented in helics::CoreBroker.

◆ setLoggingLevel()

virtual void helics::Broker::setLoggingLevel ( int  logLevel)
pure virtual

set the broker logging level

Implemented in helics::CoreBroker.

◆ setTimeBarrier()

virtual void helics::Broker::setTimeBarrier ( Time  barrierTime)
pure virtual

update a time barrier with a new time

Implemented in helics::CoreBroker.

◆ waitForDisconnect()

virtual bool helics::Broker::waitForDisconnect ( std::chrono::milliseconds  msToWait = std::chrono::milliseconds(0)) const
pure virtual

waits in the current thread until the broker is DISCONNECTED

Parameters
msToWaitthe timeout to wait for disconnect
Returns
true if the disconnect was successful false if it timed out

Implemented in helics::CoreBroker.


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