| helics 3.6.1

Public Types | Public Member Functions | List of all members
helics::apps::Connector Class Reference

`#include <Connector.hpp>`

Inheritance diagram for helics::apps::Connector:

## Public Types
using | ConnectionsType = std::unordered_multimap< std::string_view, Connection >

## Public Member Functions
| Connector ()=default
| Connector (std::vector< std::string > args)
| Connector (int argc, char *argv[])
| Connector (std::string_view name, const FederateInfo &fedInfo)
| Connector (std::string_view name, const std::shared_ptr< Core > &coreObj, const FederateInfo &fedInfo)
| Connector (std::string_view name, CoreApp &coreObj, const FederateInfo &fedInfo)
| Connector (std::string_view appName, const std::string &configString)
| Connector (Connector &&other_player)=default
Connector & | operator= (Connector &&fed)=default
virtual void | initialize () override
virtual void | runTo (Time stopTime_input) override
void | addConnection (std::string_view interface1, std::string_view interface2, InterfaceDirection direction=InterfaceDirection::BIDIRECTIONAL, const std::vector< std::string > &tags={})
std::size_t | addTag (std::string_view tagName)
std::string_view | addInterface (std::string_view interfaceName)
auto | connectionCount () const
auto | madeConnections () const
void | allowMultipleConnections (bool value=true)
void | matchEndpointTargets (bool value=true)
Public Member Functions inherited from helics::apps::App
| App ()=default
| App (std::string_view defaultAppName, std::vector< std::string > args)
| App (std::string_view defaultAppName, int argc, char *argv[])
| App (std::string_view appName, const FederateInfo &fedInfo)
| App (std::string_view appName, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo)
| App (std::string_view appName, CoreApp &core, const FederateInfo &fedInfo)
| App (std::string_view appName, const std::string &configString)
| App (App &&other_app)=default
| App (const App &other_app)=delete
App & | operator= (App &&app)=default
App & | operator= (const App &app)=delete
void | loadFile (const std::string &filename, bool enableFederateInterfaceRegistration=true)
virtual void | run ()
virtual void | finalize ()
bool | isActive () const
const CombinationFederate & | accessUnderlyingFederate () const
std::shared_ptr< CombinationFederate > | getUnderlyingFederatePointer ()

## Additional Inherited Members
Protected Member Functions inherited from helics::apps::App
void | loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString, bool enableFederateInterfaceRegistration)
void | loadInputFiles ()
void | loadConfigOptions (AppTextParser &aparser)
Protected Attributes inherited from helics::apps::App
std::shared_ptr< CombinationFederate > | fed
| the federate created for the App
Time | stopTime = Time::maxVal()
| the time the App should stop
std::string | configFileName
| name of the config file used for constructing the federate
std::string | inputFileName
| the name of the app input file
std::string | outFileName
| the name of any output file
bool | useLocal {false}
bool | fileLoaded {false}
bool | deactivated {false}
bool | quietMode {false}
bool | helpMode {false}
std::vector< std::string > | remArgs

## Detailed Description

class implementing a Connector object, which is capable of automatically connecting interfaces in HELICS

the Connector class is not thread-safe, don't try to use it from multiple threads without external protection, that will result in undefined behavior

## Constructor & Destructor Documentation

## ◆ Connector() [1/8]

helics::apps::Connector::Connector | ( |  | ) |
| default

default constructor

## ◆ Connector() [2/8]

helics::apps::Connector::Connector | ( | 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

## ◆ Connector() [3/8]

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

construct from command line arguments

Parameters

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

## ◆ Connector() [4/8]

helics::apps::Connector::Connector | ( | std::string_view | name,
|  | const FederateInfo & | fedInfo
| ) |  |
| explicit

construct from a federate info object

Parameters

  name | the name of the federate (can be empty to use defaults from fedInfo)
  fedInfo | a federate info object containing information on the desired federate configuration

## ◆ Connector() [5/8]

helics::apps::Connector::Connector | ( | std::string_view | name,
|  | const std::shared_ptr< Core > & | coreObj,
|  | const FederateInfo & | fedInfo
| ) |  |

constructor taking a federate information structure and using the given core

Parameters

  name | the name of the federate (can be empty to use defaults from fedInfo)
  coreObj | a pointer to core object which the federate can join
  fedInfo | a federate information structure

## ◆ Connector() [6/8]

helics::apps::Connector::Connector | ( | std::string_view | name,
|  | CoreApp & | coreObj,
|  | const FederateInfo & | fedInfo
| ) |  |

constructor taking a federate information structure and using the given core

Parameters

  name | the name of the federate (can be empty to use defaults from fedInfo)
  coreObj | a coreApp object that can be joined
  fedInfo | a federate information structure

## ◆ Connector() [7/8]

helics::apps::Connector::Connector | ( | std::string_view | appName,
|  | const std::string & | configString
| ) |  |

constructor taking a file with the required information

Parameters

  appName | the name of the app
  configString | JSON, TOML or text file or JSON string defining the federate information and other configuration

## ◆ Connector() [8/8]

helics::apps::Connector::Connector | ( | Connector && | other_player | ) |
| default

move construction

## Member Function Documentation

## ◆ addConnection()

void helics::apps::Connector::addConnection | ( | std::string_view | interface1,
|  | std::string_view | interface2,
|  | InterfaceDirection | direction = `InterfaceDirection::BIDIRECTIONAL`,
|  | const std::vector< std::string > & | tags = `{}`
| ) |  |

add a connection to a connector

Parameters

  interface1 | the identifier of the first interface
  interface2 | the identifier of the second interface
  direction | the directionality of the interface
  tags | any string tags associated with the connection

References addInterface(), and addTag().

Referenced by initialize().

## ◆ addInterface()

std::string_view helics::apps::Connector::addInterface | ( | std::string_view | interfaceName | ) |

add an interface name for later reference, return a string_view reference for the interface name

Referenced by addConnection().

## ◆ addTag()

std::size_t helics::apps::Connector::addTag | ( | std::string_view | tagName | ) |

add a tag for later reference, return a string_view reference for the tag

Referenced by addConnection().

## ◆ connectionCount()

auto helics::apps::Connector::connectionCount | ( |  | ) | const
| inline

get the number of connections

## ◆ initialize()

void helics::apps::Connector::initialize | ( |  | ) |
| override virtual

initialize the Player federate

generate all the publications and organize the points, the final publication count will be available after this time and the Player will enter the initialization mode, which means it will not be possible to add more publications; calling run will automatically do this if necessary

Reimplemented from helics::apps::App.

References addConnection(), helics::apps::App::fed, and helics::Federate::STARTUP.

Referenced by runTo().

## ◆ madeConnections()

auto helics::apps::Connector::madeConnections | ( |  | ) | const
| inline

get the number of made connections

## ◆ operator=()

Connector& helics::apps::Connector::operator= | ( | Connector && | fed | ) |
| default

move assignment

## ◆ runTo()

void helics::apps::Connector::runTo | ( | Time | stopTime_input | ) |
| override virtual

run the Player until the specified time

Parameters

  stopTime_input | the desired stop time

Implements helics::apps::App.

References helics::Federate::EXECUTING, helics::apps::App::fed, initialize(), and helics::Federate::STARTUP.

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

- Connector.hpp
- Connector.cpp