helics
3.5.2
|
#include <Source.hpp>
Public Member Functions | |
Source ()=default | |
Source (std::vector< std::string > args) | |
Source (int argc, char *argv[]) | |
Source (std::string_view name, const FederateInfo &fi) | |
Source (std::string_view name, const std::shared_ptr< Core > &core, const FederateInfo &fi) | |
Source (std::string_view name, CoreApp &core, const FederateInfo &fi) | |
Source (std::string_view 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 (std::string_view key, std::string_view generator, DataType type, Time period, std::string_view units=std::string_view()) |
void | addPublication (std::string_view key, DataType type, Time period, std::string_view units=std::string_view()) |
int | addSignalGenerator (std::string_view name, std::string_view type) |
void | setStartTime (std::string_view key, Time startTime) |
void | setPeriod (std::string_view key, Time period) |
void | linkPublicationToGenerator (std::string_view key, std::string_view generator) |
void | linkPublicationToGenerator (std::string_view key, int genIndex) |
std::shared_ptr< SignalGenerator > | getGenerator (int index) |
Public Member Functions inherited from helics::apps::App | |
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 | 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, bool enableFederateInterfaceRegistration) |
virtual void | loadTextFile (const std::string &textFile) |
void | loadInputFiles () |
void | loadConfigOptions (AppTextParser &aparser) |
Protected Attributes inherited from helics::apps::App | |
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 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 | ( | std::string_view | 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 |
helics::apps::Source::Source | ( | std::string_view | 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 |
helics::apps::Source::Source | ( | std::string_view | 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 |
helics::apps::Source::Source | ( | std::string_view | 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 |
|
default |
move construction
|
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 |
void helics::apps::Source::addPublication | ( | std::string_view | key, |
std::string_view | generator, | ||
DataType | type, | ||
Time | period, | ||
std::string_view | units = std::string_view() |
||
) |
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 |
int helics::apps::Source::addSignalGenerator | ( | std::string_view | name, |
std::string_view | 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 | ( | std::string_view | key, |
int | genIndex | ||
) |
tie a publication to a signal generator
void helics::apps::Source::linkPublicationToGenerator | ( | std::string_view | key, |
std::string_view | generator | ||
) |
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 | ( | std::string_view | key, |
Time | period | ||
) |
set the start time for a publication
void helics::apps::Source::setStartTime | ( | std::string_view | key, |
Time | startTime | ||
) |
set the start time for a publication