![]() |
helics
3.0.1
|
#include <helicsApp.hpp>
Public Member Functions | |
App ()=default | |
App (const std::string &defaultAppName, std::vector< std::string > args) | |
App (const std::string &defaultAppName, int argc, char *argv[]) | |
App (const std::string &appName, const FederateInfo &fi) | |
App (const std::string &appName, const std::shared_ptr< Core > &core, const FederateInfo &fi) | |
App (const std::string &appName, CoreApp &core, const FederateInfo &fi) | |
App (const std::string &appName, const std::string &jsonString) | |
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) |
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) |
void | loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString) |
virtual void | loadTextFile (const std::string &textFile) |
Protected Attributes | |
std::shared_ptr< CombinationFederate > | fed |
the federate created for the Player | |
Time | stopTime = Time::maxVal() |
the time the Player should stop | |
std::string | masterFileName |
the name of the master file used to do the construction | |
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 | ( | const std::string & | 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 |
helics::apps::App::App | ( | const std::string & | 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 |
helics::apps::App::App | ( | const std::string & | appName, |
const FederateInfo & | fi | ||
) |
construct from a federate info object
appName | the name of the application, can be left empty to use a name specified in fi |
fi | a pointer info object containing information on the desired federate configuration |
helics::apps::App::App | ( | const std::string & | appName, |
const std::shared_ptr< Core > & | core, | ||
const FederateInfo & | fi | ||
) |
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 fi |
core | a pointer to core object which the federate can join |
fi | a federate information structure |
helics::apps::App::App | ( | const std::string & | appName, |
CoreApp & | core, | ||
const FederateInfo & | fi | ||
) |
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 fi |
core | a pointer to core object which the federate can join |
fi | a federate information structure |
helics::apps::App::App | ( | const std::string & | appName, |
const std::string & | jsonString | ||
) |
constructor taking a file with the required information
appName | the name of the application, can be left empty to use a name specified in jsonString |
jsonString | file or JSON string defining the federate information and other configuration |
References masterFileName.
|
default |
move construction
|
delete |
don't allow the copy constructor
|
inline |
get a const reference to the federate
|
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 in helics::apps::Source, and helics::apps::Player.
References fed, and helics::Federate::STARTUP.
Referenced by helics::apps::Echo::runTo().
|
inline |
check if the Player is ready to run
void helics::apps::App::loadFile | ( | const std::string & | filename | ) |
load a file containing publication information
filename | the file containing the configuration and Player data accepted format are JSON, xml, and a Player format which is tab delimited or comma delimited |
References loadJsonFile(), and loadTextFile().
|
protectedvirtual |
load from a jsonString
jsonString | either a JSON filename or a string containing JSON |
References loadJsonFileConfiguration().
Referenced by helics::apps::Clone::Clone(), and 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.
Referenced by loadJsonFile().
|
protectedvirtual |
load a text file
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::Player, helics::apps::Echo, helics::apps::Clone, helics::apps::Recorder, and helics::apps::Tracer.