helics
3.5.2
|
#include <helicsApp.hpp>
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 |
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 | |
bool | useLocal {false} |
bool | fileLoaded {false} |
bool | deactivated {false} |
bool | quietMode {false} |
bool | helpMode {false} |
std::vector< std::string > | remArgs |
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
|
default |
default constructor
helics::apps::App::App | ( | std::string_view | defaultAppName, |
std::vector< std::string > | args | ||
) |
construct from command line arguments in a vector
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().
helics::apps::App::App | ( | std::string_view | defaultAppName, |
int | argc, | ||
char * | argv[] | ||
) |
construct from command line arguments
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().
helics::apps::App::App | ( | std::string_view | appName, |
const FederateInfo & | fedInfo | ||
) |
construct from a federate info object
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.
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
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.
helics::apps::App::App | ( | std::string_view | appName, |
CoreApp & | core, | ||
const FederateInfo & | fedInfo | ||
) |
constructor taking a federate information structure and using the given coreApp
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.
helics::apps::App::App | ( | std::string_view | appName, |
const std::string & | configString | ||
) |
constructor taking a file with the required information
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 configFileName, and fed.
|
default |
move construction
|
delete |
don't allow the copy constructor
|
inline |
get a const reference to the federate
|
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().
|
inline |
check if the Player is ready to run
|
protected |
load the config options from a text parser
Referenced by loadJsonFileConfiguration(), and loadTextFile().
void helics::apps::App::loadFile | ( | const std::string & | filename, |
bool | enableFederateInterfaceRegistration = true |
||
) |
load a file containing interface information
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().
|
protected |
actively load the specified files from the configuration
this one would have been loaded through the federate already
References configFileName, inputFileName, and loadFile().
|
protectedvirtual |
load from a jsonString
jsonString | either a JSON filename or a string containing JSON |
References loadJsonFileConfiguration().
Referenced by loadFile().
|
protected |
load from a jsonString and check a field named appName for configuration options
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().
|
protectedvirtual |
load a text file
References loadConfigOptions(), and helics::apps::AppTextParser::preParseFile().
Referenced by loadFile().
move assignment
Referenced by helics::apps::Echo::operator=().
don't allow the copy assignment, the default would fail anyway since federates are not copyable either
|
pure virtual |
run the Player until the specified time
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.