![]() |
helics
2.8.1
|
#include <Player.hpp>
Inheritance diagram for helics::apps::Player:Public Member Functions | |
| Player ()=default | |
| Player (std::vector< std::string > args) | |
| Player (int argc, char *argv[]) | |
| Player (const std::string &name, const FederateInfo &fi) | |
| Player (const std::string &name, const std::shared_ptr< Core > &core, const FederateInfo &fi) | |
| Player (const std::string &name, CoreApp &core, const FederateInfo &fi) | |
| Player (const std::string &appName, const std::string &configString) | |
| Player (Player &&other_player)=default | |
| Player & | operator= (Player &&fed)=default |
| virtual void | initialize () override |
| virtual void | runTo (Time stopTime_input) override |
| void | addPublication (const std::string &key, data_type type, const std::string &pubUnits=std::string()) |
| template<class valType > | |
| std::enable_if_t< helicsType< valType >) !=data_type::helics_custom > | addPublication (const std::string &key, const std::string &pubUnits=std::string()) |
| void | addEndpoint (const std::string &endpointName, const std::string &endpointType=std::string()) |
| template<class valType > | |
| void | addPoint (Time pubTime, const std::string &key, const valType &val) |
| template<class valType > | |
| void | addPoint (Time pubTime, int iteration, const std::string &key, const valType &val) |
| void | addMessage (Time sendTime, const std::string &src, const std::string &dest, const std::string &payload) |
| void | addMessage (Time sendTime, Time actionTime, const std::string &src, const std::string &dest, const std::string &payload) |
| auto | pointCount () const |
| auto | messageCount () const |
| auto | publicationCount () const |
| auto | endpointCount () const |
| const auto & | getPoint (int index) const |
| const auto & | getMessage (int index) const |
Public Member Functions inherited from helics::apps::App | |
| 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 | run () |
| virtual void | finalize () |
| bool | isActive () const |
| const CombinationFederate & | accessUnderlyingFederate () const |
Additional Inherited Members | |
Protected Member Functions inherited from helics::apps::App | |
| void | loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString) |
Protected Attributes inherited from helics::apps::App | |
| 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 implementing a Player object, which is capable of reading a file and generating interfaces and sending signals at the appropriate times
the Player class is not thread-safe, don't try to use it from multiple threads without external protection, that will result in undefined behavior
|
default |
default constructor
|
explicit |
construct from command line arguments in a vector
| args | the command line arguments to pass in a reverse vector |
| helics::apps::Player::Player | ( | int | argc, |
| char * | argv[] | ||
| ) |
construct from command line arguments
| argc | the number of arguments |
| argv | the strings in the input |
|
explicit |
construct from a federate info object
| name | the name of the federate (can be empty to use defaults from fi) |
| fi | a pointer info object containing information on the desired federate configuration |
References helics::apps::App::fed, and helics_flag_source_only.
| helics::apps::Player::Player | ( | const std::string & | name, |
| const std::shared_ptr< Core > & | core, | ||
| const FederateInfo & | fi | ||
| ) |
constructor taking a federate information structure and using the given core
| name | the name of the federate (can be empty to use defaults from fi) |
| core | a pointer to core object which the federate can join |
| fi | a federate information structure |
References helics::apps::App::fed, and helics_flag_source_only.
| helics::apps::Player::Player | ( | const std::string & | name, |
| CoreApp & | core, | ||
| const FederateInfo & | fi | ||
| ) |
constructor taking a federate information structure and using the given core
| name | the name of the federate (can be empty to use defaults from fi) |
| core | a coreApp object that can be joined |
| fi | a federate information structure |
References helics::apps::App::fed, and helics_flag_source_only.
| helics::apps::Player::Player | ( | const std::string & | appName, |
| const std::string & | configString | ||
| ) |
constructor taking a file with the required information
| appName | the name of the app |
| configString | JSON, TOML or text file or JSON string defining the federate information and other configuration |
References helics::apps::App::fed, and helics_flag_source_only.
|
default |
move construction
| void helics::apps::Player::addEndpoint | ( | const std::string & | endpointName, |
| const std::string & | endpointType = std::string() |
||
| ) |
add an endpoint to the Player
| endpointName | the name of the endpoint |
| endpointType | the named type of the endpoint |
References helics::apps::App::fed.
| void helics::apps::Player::addMessage | ( | Time | sendTime, |
| const std::string & | src, | ||
| const std::string & | dest, | ||
| const std::string & | payload | ||
| ) |
add a message to a Player queue
| sendTime | the time the message should be sent |
| src | the source endpoint of the message |
| dest | the destination endpoint of the message |
| payload | the payload of the message |
| void helics::apps::Player::addMessage | ( | Time | sendTime, |
| Time | actionTime, | ||
| const std::string & | src, | ||
| const std::string & | dest, | ||
| const std::string & | payload | ||
| ) |
add an event for a specific time to a Player queue
| sendTime | the time the message should be sent |
| actionTime | the eventTime listed for the message |
| src | the source endpoint of the message |
| dest | the destination endpoint of the message |
| payload | the payload of the message |
|
inline |
add a data point to publish through a Player
| pubTime | the time of the publication |
| key | the key for the publication |
| val | the value to publish |
|
inline |
add a data point to publish through a Player
| pubTime | the time of the publication |
| iteration | the iteration count on which the value should be published |
| key | the key for the publication |
| val | the value to publish |
|
inline |
| void helics::apps::Player::addPublication | ( | const std::string & | key, |
| data_type | type, | ||
| const std::string & | pubUnits = std::string() |
||
| ) |
add a publication to a Player
| key | the key of the publication to add |
| type | the type of the publication |
| pubUnits | the units associated with the publication |
References helics::apps::App::fed.
|
inline |
get the number of endpoints
|
inline |
get the messages from an index
|
inline |
get the point from an index
|
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().
|
inline |
get the number of messages loaded
|
inline |
get the number of points loaded
|
inline |
get the number of publications
|
overridevirtual |
run the Player until the specified time
| stopTime_input | the desired stop time |
Implements helics::apps::App.
References helics::Federate::executing, helics::apps::App::fed, helics::force_iteration, initialize(), helics::isValidIndex(), helics::Federate::startup, and helics::timeZero.
1.8.17