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

#include <Connector.hpp>

+ Inheritance diagram for helics::apps::Connector:

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 > &core, const FederateInfo &fedInfo)
 
 Connector (std::string_view name, CoreApp &core, const FederateInfo &fedInfo)
 
 Connector (std::string_view appName, const std::string &configString)
 
 Connector (Connector &&other_player)=default
 
Connectoroperator= (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
 
Appoperator= (App &&app)=default
 
Appoperator= (const App &app)=delete
 
void loadFile (const std::string &filename, bool enableFederateInterfaceRegistration=true)
 
virtual void run ()
 
virtual void finalize ()
 
bool isActive () const
 
const CombinationFederateaccessUnderlyingFederate () const
 

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< CombinationFederatefed
 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
 
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
argsthe 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
argcthe number of arguments
argvthe 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
namethe name of the federate (can be empty to use defaults from fedInfo)
fedInfoa 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 > &  core,
const FederateInfo fedInfo 
)

constructor taking a federate information structure and using the given core

Parameters
namethe name of the federate (can be empty to use defaults from fedInfo)
corea pointer to core object which the federate can join
fedInfoa federate information structure

◆ Connector() [6/8]

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

constructor taking a federate information structure and using the given core

Parameters
namethe name of the federate (can be empty to use defaults from fedInfo)
corea coreApp object that can be joined
fedInfoa 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
appNamethe name of the app
configStringJSON, 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
interface1the identifier of the first interface
interface2the identifier of the second interface
directionthe directionality of the interface
tagsany string tags associated with the connection

References addInterface(), and addTag().

◆ 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 ( )
overridevirtual

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 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)
overridevirtual

run the Player until the specified time

Parameters
stopTime_inputthe 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: