![]() |
helics
3.0.1
|
#include <Source.hpp>
Public Member Functions | |
Source ()=default | |
Source (std::vector< std::string > args) | |
Source (int argc, char *argv[]) | |
Source (const std::string &name, const FederateInfo &fi) | |
Source (const std::string &name, const std::shared_ptr< Core > &core, const FederateInfo &fi) | |
Source (const std::string &name, CoreApp &core, const FederateInfo &fi) | |
Source (const std::string &name, const std::string &configString) | |
Source (Source &&other_source)=default | |
Source & | operator= (Source &&fed)=default |
virtual void | initialize () override |
virtual void | runTo (Time stopTime_input) override |
void | addPublication (const std::string &key, const std::string &generator, DataType type, Time period, const std::string &units=std::string()) |
void | addPublication (const std::string &key, DataType type, Time period, const std::string &units=std::string()) |
int | addSignalGenerator (const std::string &name, const std::string &type) |
void | setStartTime (const std::string &key, Time startTime) |
void | setPeriod (const std::string &key, Time period) |
void | linkPublicationToGenerator (const std::string &key, const std::string &generator) |
void | linkPublicationToGenerator (const std::string &key, int genIndex) |
std::shared_ptr< SignalGenerator > | getGenerator (int index) |
![]() | |
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 | |
![]() | |
void | loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString) |
virtual void | loadTextFile (const std::string &textFile) |
![]() | |
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 source federate, which is capable of generating signals of various kinds and sending signals at the appropriate times
the source class is NOT threadsafe, 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 vector of string, the remaining arguments are returned in the args |
helics::apps::Source::Source | ( | int | argc, |
char * | argv[] | ||
) |
construct from command line arguments
argc | the number of arguments |
argv | the strings in the input |
helics::apps::Source::Source | ( | const std::string & | name, |
const FederateInfo & | fi | ||
) |
construct from a federate info object
name | the name of the source object (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::Source::Source | ( | 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 source object (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::Source::Source | ( | 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::Source::Source | ( | const std::string & | name, |
const std::string & | configString | ||
) |
constructor taking a file with the required information
name | the name of the source object (can be empty to use defaults from fi) |
configString | file a JSON or TOML file or string containing configuration informatino |
References helics::apps::App::fed, and HELICS_FLAG_SOURCE_ONLY.
|
default |
move construction
void helics::apps::Source::addPublication | ( | const std::string & | key, |
const std::string & | generator, | ||
DataType | type, | ||
Time | period, | ||
const std::string & | units = std::string() |
||
) |
add a publication to a source
key | the key of the publication to add |
generator | the name of the generator to link with |
type | the type of the publication |
period | the period of the publication |
units | the units associated with the publication |
|
inline |
add a publication to a source
key | the key of the publication to add |
type | the type of the publication |
period | the period of the publication |
units | the units associated with the publication |
int helics::apps::Source::addSignalGenerator | ( | const std::string & | name, |
const std::string & | type | ||
) |
add a signal generator to the source object
std::shared_ptr< SignalGenerator > helics::apps::Source::getGenerator | ( | int | index | ) |
get a pointer to the signal generator
|
overridevirtual |
initialize the source federate
connect all sources with a generator
Reimplemented from helics::apps::App.
References helics::apps::App::fed, and helics::Federate::STARTUP.
Referenced by runTo().
void helics::apps::Source::linkPublicationToGenerator | ( | const std::string & | key, |
const std::string & | generator | ||
) |
tie a publication to a signal generator
void helics::apps::Source::linkPublicationToGenerator | ( | const std::string & | key, |
int | genIndex | ||
) |
tie a publication to a signal generator
|
overridevirtual |
run the source until the specified time
stopTime_input | the desired stop time |
Implements helics::apps::App.
References helics::Federate::EXECUTING, helics::apps::App::fed, initialize(), helics::Federate::STARTUP, helics::timeEpsilon, and helics::timeZero.
void helics::apps::Source::setPeriod | ( | const std::string & | key, |
Time | period | ||
) |
set the start time for a publication
void helics::apps::Source::setStartTime | ( | const std::string & | key, |
Time | startTime | ||
) |
set the start time for a publication