![]() |
helics
2.8.1
|
#include <ValueFederateManager.hpp>
Public Member Functions | |
| ValueFederateManager (Core *coreOb, ValueFederate *vfed, local_federate_id id) | |
| Publication & | registerPublication (const std::string &key, std::string type, const std::string &units) |
| Input & | registerInput (const std::string &key, std::string type, const std::string &units) |
| void | addAlias (const Input &inp, const std::string &shortcutName) |
| void | addAlias (const Publication &pub, const std::string &shortcutName) |
| void | addTarget (const Publication &pub, const std::string &target) |
| void | addTarget (const Input &inp, const std::string &target) |
| void | removeTarget (const Publication &pub, const std::string &target) |
| void | removeTarget (const Input &inp, const std::string &target) |
| void | setDefaultValue (const Input &inp, const data_view &block) |
| data_view | getValue (const Input &inp) |
| void | publish (const Publication &pub, const data_view &block) |
| void | updateTime (Time newTime, Time oldTime) |
| void | startupToInitializeStateTransition () |
| void | initializeToExecuteStateTransition (iteration_result result) |
| std::string | localQuery (const std::string &queryStr) const |
| std::vector< int > | queryUpdates () |
| const std::string & | getTarget (const Input &inp) const |
| Input & | getInput (const std::string &key) |
| const Input & | getInput (const std::string &key) const |
| Input & | getInput (int index) |
| const Input & | getInput (int index) const |
| const Input & | getSubscription (const std::string &key) const |
| Input & | getSubscription (const std::string &key) |
| Publication & | getPublication (const std::string &key) |
| const Publication & | getPublication (const std::string &key) const |
| Publication & | getPublication (int index) |
| const Publication & | getPublication (int index) const |
| void | setInputNotificationCallback (std::function< void(Input &, Time)> callback) |
| void | disconnect () |
| int | getPublicationCount () const |
| int | getInputCount () const |
| void | clearUpdates () |
Static Public Member Functions | |
| static bool | hasUpdate (const Input &inp) |
| static Time | getLastUpdateTime (const Input &inp) |
| static void | setInputNotificationCallback (const Input &inp, std::function< void(Input &, Time)> callback) |
| static void | clearUpdate (const Input &inp) |
Public Attributes | |
| bool | useJsonSerialization {false} |
| all outgoing data should be serialized as JSON | |
class handling the implementation details of a value Federate
| void helics::ValueFederateManager::addAlias | ( | const Input & | inp, |
| const std::string & | shortcutName | ||
| ) |
add a shortcut for locating a subscription
primarily for use in looking up an id from a different location creates a local shortcut for referring to a subscription which may have a long actual name
| inp | the subscription identifier |
| shortcutName | the name of the shortcut |
References helics::Input::handle, and helics::Input::isValid().
| void helics::ValueFederateManager::addAlias | ( | const Publication & | pub, |
| const std::string & | shortcutName | ||
| ) |
add a alias/shortcut for locating a publication
primarily for use in looking up an id from a different location creates a local shortcut for referring to a subscription which may have a long actual name
| pub | the subscription identifier |
| shortcutName | the name of the shortcut |
References helics::Publication::handle, and helics::Publication::isValid().
| void helics::ValueFederateManager::addTarget | ( | const Input & | inp, |
| const std::string & | target | ||
| ) |
add a source target to an input/subscription
| inp | the identifier of the publication |
| target | the name of the input to send the data to |
References fed, and helics::Input::handle.
| void helics::ValueFederateManager::addTarget | ( | const Publication & | pub, |
| const std::string & | target | ||
| ) |
add a destination target to a publication
| pub | the identifier of the input |
| target | the name of the input to send the data to |
References helics::Publication::handle.
|
static |
clear an input value as updated without actually retrieving it
| inp | the identifier for the subscription |
References helics::input_info::hasUpdate.
| void helics::ValueFederateManager::clearUpdates | ( | ) |
clear all the updates
after this call isUpdated on all the internal objects will return false
| void helics::ValueFederateManager::disconnect | ( | ) |
disconnect from the coreObject
| Input & helics::ValueFederateManager::getInput | ( | const std::string & | key | ) |
get an Input from Its Name
| key | the identifier or shortcut of the input |
| Input & helics::ValueFederateManager::getInput | ( | int | index | ) |
get an input by index
References helics::isValidIndex().
| int helics::ValueFederateManager::getInputCount | ( | ) | const |
get a count of the number subscriptions registered
get a count of the number inputs registered
get the time of the last update
References helics::input_info::lastUpdate.
| Publication & helics::ValueFederateManager::getPublication | ( | const std::string & | key | ) |
get a publication based on its key
| key | the publication id |
| int helics::ValueFederateManager::getPublicationCount | ( | ) | const |
get a count of the number publications registered
| const Input & helics::ValueFederateManager::getSubscription | ( | const std::string & | key | ) | const |
get the id of a subscription
| key | the target of a subscription |
| const std::string & helics::ValueFederateManager::getTarget | ( | const Input & | inp | ) | const |
get the target of a input
References helics::Input::handle.
get a value as raw data block from the system
| inp | the identifier for the subscription |
References helics::input_info::lastQuery.
|
static |
check if a given subscription has and update
References helics::input_info::hasUpdate.
| void helics::ValueFederateManager::initializeToExecuteStateTransition | ( | iteration_result | result | ) |
transition from initialize to execution State
References helics::initializationTime, and helics::timeZero.
| std::string helics::ValueFederateManager::localQuery | ( | const std::string & | queryStr | ) | const |
generate results for a local query
References helics::JsonBuilder::addElement(), and helics::JsonBuilder::generate().
| void helics::ValueFederateManager::publish | ( | const Publication & | pub, |
| const data_view & | block | ||
| ) |
publish a value
References helics::data_view::data(), helics::Publication::handle, and helics::data_view::size().
| std::vector< int > helics::ValueFederateManager::queryUpdates | ( | ) |
get a list of all the values that have been updated since the last call
| Input & helics::ValueFederateManager::registerInput | ( | const std::string & | key, |
| std::string | type, | ||
| const std::string & | units | ||
| ) |
| void helics::ValueFederateManager::removeTarget | ( | const Input & | inp, |
| const std::string & | target | ||
| ) |
remove a source target from an input/subscription
| inp | the identifier of the publication |
| target | the name of the publication to remove |
References helics::Input::handle.
| void helics::ValueFederateManager::removeTarget | ( | const Publication & | pub, |
| const std::string & | target | ||
| ) |
remove a destination target from a publication
| pub | the identifier of the input |
| target | the name of the input to remove |
References helics::Publication::handle.
set the default value for a subscription
this is the value returned prior to any publications
| inp | the subscription identifier |
| block | the data block representing the default value |
copy the data first since we are not entirely sure of the lifetime of the data_view
References helics::data_view::data(), helics::Input::isValid(), helics::input_info::lastData, and helics::data_view::size().
|
static |
register a callback function to call when the specified subscription is updated
| inp | the id to register the callback for |
| callback | the function to call |
References helics::input_info::callback.
| void helics::ValueFederateManager::setInputNotificationCallback | ( | std::function< void(Input &, Time)> | callback | ) |
register a callback function to call when any subscribed value is updated
there can only be one generic callback
| callback | the function to call |
| void helics::ValueFederateManager::startupToInitializeStateTransition | ( | ) |
transition from Startup To the Initialize State
update the time from oldTime to newTime
| newTime | the newTime of the federate |
| oldTime | the oldTime of the federate |
find the id
References data, and helics::input_info::lastUpdate.
1.8.17