| helics 3.6.1

Public Member Functions | Protected Attributes | List of all members
helicscpp::Broker Class Reference

## Public Member Functions
| Broker () HELICS_NOTHROW
| Broker (std::string type, std::string name, std::string initString)
| Broker (std::string type, std::string name, int argc, char **argv)
| Broker (const Broker &brk)
Broker & | operator= (const Broker &brk)
virtual | ~Broker ()
| operator HelicsBroker ()
HelicsBroker | baseObject () const
bool | isConnected () const
bool | waitForDisconnect (int msToWait=-1)
void | disconnect ()
const char * | getIdentifier () const
const char * | getAddress () const
void | setGlobal (const std::string &valueName, const std::string &value)
void | addAlias (const std::string &interfaceName, const std::string &alias)
void | dataLink (const std::string &source, const std::string &target)
void | addSourceFilterToEndpoint (const std::string &filter, const std::string &target)
void | addDestinationFilterToEndpoint (const std::string &filter, const std::string &target)
std::string | query (const std::string &target, const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST) const
void | sendCommand (const std::string &target, const std::string &command)
void | setTimeBarrier (HelicsTime barrierTime)
void | clearTimeBarrier ()
void | globalError (int errorCode, const std::string &errorString)

## Protected Attributes
HelicsBroker | broker
| underlying broker information

## Constructor & Destructor Documentation

## ◆ Broker() [1/4]

helicscpp::Broker::Broker | ( |  | ) |
| inline

Default constructor

## ◆ Broker() [2/4]

helicscpp::Broker::Broker | ( | std::string | type,
|  | std::string | name,
|  | std::string | initString
| ) |  |
| inline

construct broker

Parameters

  type | string with the type of the broker to create
  name | the name of the broker
  initString | command line argument for starting the broker

References broker, HELICS_TRUE, helicsBrokerIsConnected(), and helicsCreateBroker().

## ◆ Broker() [3/4]

helicscpp::Broker::Broker | ( | std::string | type,
|  | std::string | name,
|  | int | argc,
|  | char ** | argv
| ) |  |
| inline

construct broker

Parameters

  type | string with the type of the broker to create
  name | the name of the broker
  argc | the number of command line arguments
  argv | command line argument strings

References broker, and helicsCreateBrokerFromArgs().

## ◆ Broker() [4/4]

helicscpp::Broker::Broker | ( | const Broker & | brk | ) |
| inline

copy constructor

References broker, and helicsBrokerClone().

## ◆ ~Broker()

virtual helicscpp::Broker::~Broker | ( |  | ) |
| inline virtual

destructor

References broker, and helicsBrokerFree().

## Member Function Documentation

## ◆ addAlias()

void helicscpp::Broker::addAlias | ( | const std::string & | interfaceName,
|  | const std::string & | alias
| ) |  |
| inline

add a global alias for an interface

Parameters

  interfaceName | the given name of the interface
  alias | the new name by which the interface can be referenced

References broker, and helicsBrokerAddAlias().

## ◆ addDestinationFilterToEndpoint()

void helicscpp::Broker::addDestinationFilterToEndpoint | ( | const std::string & | filter,
|  | const std::string & | target
| ) |  |
| inline

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

Parameters

  filter | the name of the filter
  target | the name of the source target

References broker, and helicsBrokerAddDestinationFilterToEndpoint().

## ◆ addSourceFilterToEndpoint()

void helicscpp::Broker::addSourceFilterToEndpoint | ( | const std::string & | filter,
|  | const std::string & | target
| ) |  |
| inline

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

Parameters

  filter | the name of the filter
  target | the name of the source target

References broker, and helicsBrokerAddSourceFilterToEndpoint().

## ◆ baseObject()

HelicsBroker helicscpp::Broker::baseObject | ( |  | ) | const
| inline

get the underlying HelicsBroker object

Returns
  a HelicsBroker object

References broker.

## ◆ dataLink()

void helicscpp::Broker::dataLink | ( | const std::string & | source,
|  | const std::string & | target
| ) |  |
| inline

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

Parameters

  source | the name of the publication
  target | the name of the input

References broker, and helicsBrokerDataLink().

## ◆ disconnect()

void helicscpp::Broker::disconnect | ( |  | ) |
| inline

disconnect the broker from any other brokers and communications

References broker, and helicsBrokerDisconnect().

## ◆ getAddress()

const char* helicscpp::Broker::getAddress | ( |  | ) | const
| inline

get the connection address for the broker

References broker, and helicsBrokerGetAddress().

## ◆ getIdentifier()

const char* helicscpp::Broker::getIdentifier | ( |  | ) | const
| inline

get the local identification for the broker

References broker, and helicsBrokerGetIdentifier().

## ◆ isConnected()

bool helicscpp::Broker::isConnected | ( |  | ) | const
| inline

check if the broker is connected

References broker, HELICS_FALSE, and helicsBrokerIsConnected().

## ◆ operator HelicsBroker()

helicscpp::Broker::operator HelicsBroker | ( |  | ) |
| inline

cast to the underlying broker

References broker.

## ◆ operator=()

Broker& helicscpp::Broker::operator= | ( | const Broker & | brk | ) |
| inline

copy assignment

References broker, and helicsBrokerClone().

## ◆ query()

std::string helicscpp::Broker::query | ( | const std::string & | target,
|  | const std::string & | queryStr,
|  | HelicsSequencingModes | mode = `HELICS_SEQUENCING_MODE_FAST`
| ) |  | const
| inline

make a query of the broker

this call is blocking until the value is returned which may take some time depending on the size of the federation and the specific string being queried

Parameters

  target | the target of the query can be "federation", "federate", "broker", "core", or a specific name of a federate, core, or broker
  queryStr | a string with the query, see other documentation for specific properties to query, can be defined by the federate
  mode | the ordering mode to use for the query (fast for priority channels, ordered for normal channels ordered with all other messages)

Returns
  a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string "#invalid" is returned if the query was not valid

References broker, HELICS_SEQUENCING_MODE_FAST, helicsCreateQuery(), helicsQueryBrokerExecute(), helicsQueryFree(), and helicsQuerySetOrdering().

## ◆ sendCommand()

void helicscpp::Broker::sendCommand | ( | const std::string & | target,
|  | const std::string & | command
| ) |  |
| inline

send an asynchronous command to another object

Parameters

  target | the name of the target of the command
  command | the command message to send

References broker, and helicsBrokerSendCommand().

## ◆ setGlobal()

void helicscpp::Broker::setGlobal | ( | const std::string & | valueName,
|  | const std::string & | value
| ) |  |
| inline

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 "global_value" will return the string directly. "global" will return the value and name in a JSON structure

Parameters

  valueName | the name of the global to set
  value | the value of the global

References broker, and helicsBrokerSetGlobal().

## ◆ waitForDisconnect()

bool helicscpp::Broker::waitForDisconnect | ( | int | msToWait = `-1` | ) |
| inline

waits in the current thread until the broker is disconnected

Parameters

  msToWait | the timeout to wait for disconnect (-1) implies no timeout

Returns
  true if the disconnect was successful false if it timed out

References broker, HELICS_FALSE, and helicsBrokerWaitForDisconnect().

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

- cpp98/Broker.hpp