helics  2.8.1
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 (const std::string &configureString)=0
 
virtual void configureFromArgs (int argc, char *argv[])=0
 
void initialize (const std::string &configureString)
 
void initializeFromArgs (int argc, char *argv[])
 
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 (const std::function< void(int, const std::string &, const std::string &)> &logFunction)=0
 
virtual void setLogFile (const std::string &lfile)=0
 
virtual bool waitForDisconnect (std::chrono::milliseconds msToWait=std::chrono::milliseconds(0)) const =0
 
virtual std::string query (const std::string &target, const std::string &queryStr, helics_sequencing_mode mode=helics_sequencing_mode_fast)=0
 
virtual void setGlobal (const std::string &valueName, const std::string &value)=0
 
virtual void makeConnections (const std::string &file)=0
 
virtual void dataLink (const std::string &source, const std::string &target)=0
 
virtual void addSourceFilterToEndpoint (const std::string &filter, const std::string &target)=0
 
virtual void addDestinationFilterToEndpoint (const std::string &filter, const std::string &target)=0
 
virtual void setTimeBarrier (Time barrierTime)=0
 
virtual void clearTimeBarrier ()=0
 
virtual void globalError (int32_t errorCode, const std::string &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

◆ addDestinationFilterToEndpoint()

virtual void helics::Broker::addDestinationFilterToEndpoint ( const std::string &  filter,
const std::string &  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 ( const std::string &  filter,
const std::string &  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 ( const std::string &  configureString)
pure virtual

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

Implemented in helics::CoreBroker.

Referenced by initialize().

◆ configureFromArgs()

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

initialize from command line arguments

Implemented in helics::CoreBroker.

Referenced by initializeFromArgs().

◆ 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 ( const std::string &  source,
const std::string &  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,
const std::string &  errorString 
)
pure virtual

generate a global error and halt the federation

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

Implemented in helics::CoreBroker.

◆ initialize()

void helics::Broker::initialize ( const std::string &  configureString)
inline

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

References configure().

◆ initializeFromArgs()

void helics::Broker::initializeFromArgs ( int  argc,
char *  argv[] 
)
inline

initialize from command line arguments

References configureFromArgs().

◆ 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.

◆ 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 ( const std::string &  target,
const std::string &  queryStr,
helics_sequencing_mode  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.

◆ 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 ( const std::string &  valueName,
const std::string &  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" 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 ( const std::string &  lfile)
pure virtual

set the broker logging file

Implemented in helics::CoreBroker.

◆ setLoggingCallback()

virtual void helics::Broker::setLoggingCallback ( const std::function< void(int, const std::string &, const std::string &)> &  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: