| helics 3.6.1

Public Member Functions | List of all members
helics::BrokerApp Class Reference

`#include <BrokerApp.hpp>`

## Public Member Functions
| BrokerApp ()=default
| BrokerApp (std::vector< std::string > &&args)
| BrokerApp (CoreType ctype, std::vector< std::string > &&args)
| BrokerApp (CoreType ctype, const std::string &broker_name, std::vector< std::string > &&args)
| BrokerApp (std::vector< std::string > &args)
| BrokerApp (CoreType ctype, std::vector< std::string > &args)
| BrokerApp (CoreType ctype, const std::string &broker_name, std::vector< std::string > &args)
| BrokerApp (int argc, char *argv[])
| BrokerApp (CoreType ctype, int argc, char *argv[])
| BrokerApp (CoreType ctype, std::string_view brokerName, int argc, char *argv[])
| BrokerApp (std::string_view argString)
| BrokerApp (CoreType ctype, std::string_view argString=std::string_view{})
| BrokerApp (CoreType ctype, std::string_view brokerName, std::string_view argString)
| BrokerApp (std::shared_ptr< Broker > brk)
bool | isConnected () const
bool | connect ()
bool | isOpenToNewFederates () const
void | forceTerminate ()
bool | waitForDisconnect (std::chrono::milliseconds waitTime=std::chrono::milliseconds(0))
void | linkEndpoints (std::string_view source, std::string_view target)
void | dataLink (std::string_view source, std::string_view target)
void | addSourceFilterToEndpoint (std::string_view filter, std::string_view endpoint)
void | addDestinationFilterToEndpoint (std::string_view filter, std::string_view endpoint)
void | addAlias (std::string_view interfaceName, std::string_view alias)
void | makeConnections (const std::string &file)
const std::string & | getIdentifier () const
const std::string & | getAddress () const
std::string | query (std::string_view target, std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
void | setGlobal (std::string_view valueName, std::string_view value)
void | sendCommand (std::string_view target, std::string_view commandStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
void | setLogFile (std::string_view logFile)
void | setLoggingLevel (int loglevel)
void | reset ()
BrokerApp * | operator-> ()
const BrokerApp * | operator-> () const
std::shared_ptr< Broker > | getCopyofBrokerPointer () const
void | setTimeBarrier (Time barrierTime)
void | clearTimeBarrier ()
void | globalError (int32_t errorCode, std::string_view errorString)

## Detailed Description

class implementing a Broker object. This object is meant to a be a very simple broker executor with a similar interface to the other apps

## Constructor & Destructor Documentation

## ◆ BrokerApp() [1/14]

helics::BrokerApp::BrokerApp | ( |  | ) |
| default

default constructor

## ◆ BrokerApp() [2/14]

helics::BrokerApp::BrokerApp | ( | std::vector< std::string > && | args | ) |
| explicit

construct from command line arguments in a vector

Parameters

  args | the command line arguments to pass in a reverse vector

References helics::DEFAULT.

## ◆ BrokerApp() [3/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | std::vector< std::string > && | args
| ) |  |

construct from command line arguments in a vector

Parameters

  ctype | the type of broker to create
  args | the command line arguments to pass in a reverse vector

## ◆ BrokerApp() [4/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | const std::string & | broker_name,
|  | std::vector< std::string > && | args
| ) |  |

construct from command line arguments in a vector

Parameters

  ctype | the type of broker to create
  broker_name | the name of the broker
  args | the command line arguments to pass in a reverse vector

References helics::MULTI.

## ◆ BrokerApp() [5/14]

helics::BrokerApp::BrokerApp | ( | std::vector< std::string > & | args | ) |
| explicit

construct from command line arguments in a vector

Parameters

  args | the command line arguments to pass in a reverse vector

References helics::DEFAULT.

## ◆ BrokerApp() [6/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | std::vector< std::string > & | args
| ) |  |

construct from command line arguments in a vector

Parameters

  ctype | the type of broker to create
  args | the command line arguments to pass in a reverse vector

## ◆ BrokerApp() [7/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | const std::string & | broker_name,
|  | std::vector< std::string > & | args
| ) |  |

construct from command line arguments in a vector

Parameters

  ctype | the type of broker to create
  broker_name | the name of the broker
  args | the command line arguments to pass in a reverse vector

References helics::MULTI.

## ◆ BrokerApp() [8/14]

helics::BrokerApp::BrokerApp | ( | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  argc | the number of arguments
  argv | the strings in the input

References helics::DEFAULT.

## ◆ BrokerApp() [9/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  ctype | the type of broker to create
  argc | the number of arguments
  argv | the strings in the input

## ◆ BrokerApp() [10/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | std::string_view | brokerName,
|  | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  ctype | the type of broker to create
  brokerName | the name of the broker
  argc | the number of arguments
  argv | the strings in the input

References helics::MULTI.

## ◆ BrokerApp() [11/14]

helics::BrokerApp::BrokerApp | ( | std::string_view | argString | ) |
| explicit

construct from command line arguments parsed as a single string

Parameters

  argString | a merged string with all the arguments

References helics::BrokerFactory::findBroker().

## ◆ BrokerApp() [12/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | std::string_view | argString = `std::string_view{}`
| ) |  |
| explicit

construct from command line arguments parsed as a single string

Parameters

  ctype | the type of broker to create
  argString | a merged string with all the arguments

## ◆ BrokerApp() [13/14]

helics::BrokerApp::BrokerApp | ( | CoreType | ctype,
|  | std::string_view | brokerName,
|  | std::string_view | argString
| ) |  |

construct from command line arguments parsed as a single string

Parameters

  ctype | the type of broker to create
  brokerName | the name of the broker
  argString | a merged string with all the arguments

References helics::MULTI.

## ◆ BrokerApp() [14/14]

helics::BrokerApp::BrokerApp | ( | std::shared_ptr< Broker > | brk | ) |
| explicit

create a BrokerApp from a broker pointer

## Member Function Documentation

## ◆ addAlias()

void helics::BrokerApp::addAlias | ( | std::string_view | interfaceName,
|  | std::string_view | alias
| ) |  |

add an alias for an interface

## ◆ addDestinationFilterToEndpoint()

void helics::BrokerApp::addDestinationFilterToEndpoint | ( | std::string_view | filter,
|  | std::string_view | endpoint
| ) |  |

add a destination Filter to an endpoint

## ◆ addSourceFilterToEndpoint()

void helics::BrokerApp::addSourceFilterToEndpoint | ( | std::string_view | filter,
|  | std::string_view | endpoint
| ) |  |

add a source Filter to an endpoint

## ◆ clearTimeBarrier()

void helics::BrokerApp::clearTimeBarrier | ( |  | ) |

clear a global time Barrier

## ◆ connect()

bool helics::BrokerApp::connect | ( |  | ) |

connect the broker to the network

## ◆ dataLink()

void helics::BrokerApp::dataLink | ( | std::string_view | source,
|  | std::string_view | target
| ) |  |

link a publication and input

## ◆ forceTerminate()

void helics::BrokerApp::forceTerminate | ( |  | ) |

forcibly disconnect the broker

Referenced by helics::BrokerKeeper::forceTerminate().

## ◆ getAddress()

const std::string & helics::BrokerApp::getAddress | ( |  | ) | const

get the network address of the broker

## ◆ getCopyofBrokerPointer()

std::shared_ptr<Broker> helics::BrokerApp::getCopyofBrokerPointer | ( |  | ) | const
| inline

get a copy of the core pointer

## ◆ getIdentifier()

const std::string & helics::BrokerApp::getIdentifier | ( |  | ) | const

get the identifier of the broker

## ◆ globalError()

void helics::BrokerApp::globalError | ( | int32_t | errorCode,
|  | std::string_view | errorString
| ) |  |

generate a global error that will halt a co-simulation

## ◆ isConnected()

bool helics::BrokerApp::isConnected | ( |  | ) | const

check if the Broker is running

Referenced by helics::BrokerKeeper::isConnected(), and helics::BrokerKeeper::~BrokerKeeper().

## ◆ isOpenToNewFederates()

bool helics::BrokerApp::isOpenToNewFederates | ( |  | ) | const

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

## ◆ linkEndpoints()

void helics::BrokerApp::linkEndpoints | ( | std::string_view | source,
|  | std::string_view | target
| ) |  |

link two endpoints source to destination

## ◆ makeConnections()

void helics::BrokerApp::makeConnections | ( | const std::string & | file | ) |

make connections between interfaces with a file

## ◆ query()

std::string helics::BrokerApp::query | ( | std::string_view | target,
|  | std::string_view | queryStr,
|  | HelicsSequencingModes | mode = `HELICS_SEQUENCING_MODE_FAST`
| ) |  |

make a query at the broker

Parameters

  target | the target of the query "federation", "parent", "broker", or a specific named object
  queryStr | the query to make
  mode | the ordering mode to use (fast for asynchronous priority channels, and ordered for slower but well ordered queries)

Returns
  a string containing the query results

make a query at the broker

## ◆ reset()

void helics::BrokerApp::reset | ( |  | ) |

clear the pointer to the broker

## ◆ sendCommand()

void helics::BrokerApp::sendCommand | ( | std::string_view | target,
|  | std::string_view | commandStr,
|  | HelicsSequencingModes | mode = `HELICS_SEQUENCING_MODE_FAST`
| ) |  |

send a command to a specific target

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

Parameters

  target | the specific target of the command
  commandStr | the actual command
  mode | the ordering mode to use (fast for asynchronous priority channels, and ordered for slower but well ordered commands)

## ◆ setGlobal()

void helics::BrokerApp::setGlobal | ( | std::string_view | valueName,
|  | std::string_view | value
| ) |  |

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

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

## ◆ setLogFile()

void helics::BrokerApp::setLogFile | ( | std::string_view | logFile | ) |

set the log file to use for the broker

## ◆ setLoggingLevel()

void helics::BrokerApp::setLoggingLevel | ( | int | loglevel | ) |

set the minimum log level to use in the broker

## ◆ setTimeBarrier()

void helics::BrokerApp::setTimeBarrier | ( | Time | barrierTime | ) |

set a global time Barrier

## ◆ waitForDisconnect()

bool helics::BrokerApp::waitForDisconnect | ( | std::chrono::milliseconds | waitTime = `std::chrono::milliseconds(0)` | ) |

wait for the broker to normally disconnect for a certain amount of time

Referenced by helics::BrokerKeeper::~BrokerKeeper().

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

- application_api/BrokerApp.hpp
- BrokerApp.cpp