| helics 3.6.1

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
helics::apps::App Class Referenceabstract

`#include <helicsApp.hpp>`

Inheritance diagram for helics::apps::App:

## Public Member Functions
| 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 | initialize ()
virtual void | run ()
virtual void | runTo (Time stopTime_input)=0
virtual void | finalize ()
bool | isActive () const
const CombinationFederate & | accessUnderlyingFederate () const
std::shared_ptr< CombinationFederate > | getUnderlyingFederatePointer ()

## Protected Member Functions
virtual void | loadJsonFile (const std::string &jsonString, bool enableFederateInterfaceRegistration)
void | loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString, bool enableFederateInterfaceRegistration)
virtual void | loadTextFile (const std::string &textFile)
void | loadInputFiles ()
void | loadConfigOptions (AppTextParser &aparser)

## Protected Attributes
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 defining a basic helics App

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

## Constructor & Destructor Documentation

## ◆ App() [1/9]

helics::apps::App::App | ( |  | ) |
| default

default constructor

## ◆ App() [2/9]

helics::apps::App::App | ( | std::string_view | defaultAppName,
|  | std::vector< std::string > | args
| ) |  |

construct from command line arguments in a vector

Parameters

  defaultAppName | the name to use if not specified in one of the arguments
  args | the command line arguments to pass in a reverse vector

References helics::FederateInfo::injectParser().

## ◆ App() [3/9]

helics::apps::App::App | ( | std::string_view | defaultAppName,
|  | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  defaultAppName | the name to use if not specified in one of the arguments
  argc | the number of arguments
  argv | the strings in the input

References helics::FederateInfo::injectParser().

## ◆ App() [4/9]

helics::apps::App::App | ( | std::string_view | appName,
|  | const FederateInfo & | fedInfo
| ) |  |

construct from a federate info object

Parameters

  appName | the name of the application, can be left empty to use a name specified in fedInfo
  fedInfo | a pointer info object containing information on the desired federate configuration

References configFileName, and fed.

## ◆ App() [5/9]

helics::apps::App::App | ( | std::string_view | appName,
|  | const std::shared_ptr< Core > & | core,
|  | const FederateInfo & | fedInfo
| ) |  |

constructor taking a federate information structure and using the given core

Parameters

  appName | the name of the application, can be left empty to use a name specified in fedInfo
  core | a pointer to core object which the federate can join
  fedInfo | a federate information structure

References configFileName, and fed.

## ◆ App() [6/9]

helics::apps::App::App | ( | std::string_view | appName,
|  | CoreApp & | core,
|  | const FederateInfo & | fedInfo
| ) |  |

constructor taking a federate information structure and using the given coreApp

Parameters

  appName | the name of the application, can be left empty to use a name specified in fedInfo
  core | a pointer to core object which the federate can join
  fedInfo | a federate information structure

References configFileName, and fed.

## ◆ App() [7/9]

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

constructor taking a file with the required information

Parameters

  appName | the name of the application, can be left empty to use a name specified in configString
  configString | file or JSON string defining the federate information and other configuration

References helics::FederateInfo::injectParser().

## ◆ App() [8/9]

helics::apps::App::App | ( | App && | other_app | ) |
| default

move construction

## ◆ App() [9/9]

helics::apps::App::App | ( | const App & | other_app | ) |
| delete

don't allow the copy constructor

## Member Function Documentation

## ◆ accessUnderlyingFederate()

const CombinationFederate& helics::apps::App::accessUnderlyingFederate | ( |  | ) | const
| inline

get a const reference to the federate

## ◆ finalize()

void helics::apps::App::finalize | ( |  | ) |
| virtual

finalize the Player federate

References fed.

## ◆ getUnderlyingFederatePointer()

std::shared_ptr<CombinationFederate> helics::apps::App::getUnderlyingFederatePointer | ( |  | ) |
| inline

get a copy of the federate pointer (this can be dangerous if misused)

## ◆ initialize()

void helics::apps::App::initialize | ( |  | ) |
| virtual

initialize the App federate

generate all the publications and organize the points, the final publication count will be available after this time and the App 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 in helics::apps::Source, helics::apps::Probe, helics::apps::Player, and helics::apps::Connector.

References fed, and helics::Federate::STARTUP.

Referenced by helics::apps::Echo::runTo().

## ◆ isActive()

bool helics::apps::App::isActive | ( |  | ) | const
| inline

check if the Player is ready to run

## ◆ loadConfigOptions()

void helics::apps::App::loadConfigOptions | ( | AppTextParser & | aparser | ) |
| protected

load the config options from a text parser

Referenced by loadJsonFileConfiguration(), and loadTextFile().

## ◆ loadFile()

void helics::apps::App::loadFile | ( | const std::string & | filename,
|  | bool | enableFederateInterfaceRegistration = `true`
| ) |  |

load a file containing interface information

Parameters

  filename | the file containing the configuration and App data accepted format are JSON, and a App format which is tab delimited or comma delimited toml file can be used load interfaces but not app configuration
  enableFederateInterfaceRegistration | default true, if set to false will not load federate information

References fed, loadJsonFile(), and loadTextFile().

Referenced by loadInputFiles().

## ◆ loadInputFiles()

void helics::apps::App::loadInputFiles | ( |  | ) |
| protected

actively load the specified files from the configuration

this one would have been loaded through the federate already

References configFileName, inputFileName, and loadFile().

## ◆ loadJsonFile()

void helics::apps::App::loadJsonFile | ( | const std::string & | jsonString,
|  | bool | enableFederateInterfaceRegistration
| ) |  |
| protected virtual

load from a jsonString

Parameters

  jsonString | either a JSON filename or a string containing JSON

References loadJsonFileConfiguration().

Referenced by loadFile().

## ◆ loadJsonFileConfiguration()

void helics::apps::App::loadJsonFileConfiguration | ( | const std::string & | appName,
|  | const std::string & | jsonString,
|  | bool | enableFederateInterfaceRegistration
| ) |  |
| protected

load from a jsonString and check a field named appName for configuration options

Parameters

  appName | the name of the app which may be used in section of the JSON for some local configuration
  jsonString | either a JSON filename or a string containing JSON

References fed, and loadConfigOptions().

Referenced by loadJsonFile().

## ◆ loadTextFile()

void helics::apps::App::loadTextFile | ( | const std::string & | textFile | ) |
| protected virtual

load a text file

References loadConfigOptions(), and helics::apps::AppTextParser::preParseFile().

Referenced by loadFile().

## ◆ operator=() [1/2]

App& helics::apps::App::operator= | ( | App && | app | ) |
| default

move assignment

Referenced by helics::apps::Echo::operator=().

## ◆ operator=() [2/2]

App& helics::apps::App::operator= | ( | const App & | app | ) |
| delete

don't allow the copy assignment, the default would fail anyway since federates are not copyable either

## ◆ runTo()

virtual void helics::apps::App::runTo | ( | Time | stopTime_input | ) |
| pure virtual

run the Player until the specified time

Parameters

  stopTime_input | the desired stop time

Implemented in helics::apps::Source, helics::apps::Probe, helics::apps::Player, helics::apps::Echo, helics::apps::Connector, helics::apps::Tracer, helics::apps::Recorder, and helics::apps::Clone.

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

- helicsApp.hpp
- helicsApp.cpp