![]() |
helics
3.3.0
|
#include <BaseTimeCoordinator.hpp>
Public Member Functions | |
BaseTimeCoordinator (std::function< void(const ActionMessage &)> userSendMessageFunction) | |
void | setMessageSender (std::function< void(const ActionMessage &)> userSendMessageFunction) |
void | setRestrictivePolicy (bool policy) |
std::vector< GlobalFederateId > | getDependencies () const |
std::vector< GlobalFederateId > | getDependents () const |
void | setSourceId (GlobalFederateId sourceId) |
GlobalFederateId | sourceId () const |
virtual bool | updateTimeFactors ()=0 |
const DependencyInfo * | getDependencyInfo (GlobalFederateId ofed) const |
bool | isDependency (GlobalFederateId ofed) const |
bool | empty () const |
bool | processTimeMessage (const ActionMessage &cmd) |
void | processDependencyUpdateMessage (const ActionMessage &cmd) |
virtual bool | addDependency (GlobalFederateId fedID) |
virtual bool | addDependent (GlobalFederateId fedID) |
virtual void | removeDependency (GlobalFederateId fedID) |
virtual void | removeDependent (GlobalFederateId fedID) |
void | setAsChild (GlobalFederateId fedID) |
void | setAsParent (GlobalFederateId fedID) |
void | setVersion (GlobalFederateId fedID, std::int8_t version) |
GlobalFederateId | getParent () const |
void | disconnect () |
virtual MessageProcessingResult | checkExecEntry (GlobalFederateId triggerFed=GlobalFederateId{})=0 |
virtual void | enteringExecMode (IterationRequest mode=IterationRequest::NO_ITERATIONS) |
virtual std::string | printTimeStatus () const =0 |
virtual void | generateDebuggingTimeInfo (Json::Value &base) const |
bool | hasActiveTimeDependencies () const |
int | dependencyCount () const |
GlobalFederateId | getMinDependency () const |
Json::Value | grantTimeoutCheck (const ActionMessage &cmd) |
virtual Time | getNextTime () const =0 |
Static Public Attributes | |
static constexpr std::int32_t | TIME_COORDINATOR_VERSION {1} |
Protected Member Functions | |
ActionMessage | generateTimeRequest (const TimeData &dep, GlobalFederateId fed, std::int32_t responseCode) const |
void | sendTimingInfo () |
Protected Attributes | |
TimeDependencies | dependencies |
std::function< void(const ActionMessage &)> | sendMessageFunction |
callback used to send the messages | |
GlobalFederateId | mSourceId {0} |
the identifier for inserting into the source id field of any generated messages; | |
std::int32_t | sequenceCounter {0} |
storage for sequence counter | |
bool | noParent {true} |
indicator that the coordinator does not have parents | |
bool | federatesOnly {false} |
indicator that the forwarder only operates with federates | |
bool | checkingExec {false} |
bool | executionMode {false} |
bool | restrictive_time_policy {false} |
flag indicating that a restrictive time policy should be used | |
bool | nonGranting {false} |
bool | delayedTiming {false} |
bool | disconnected {false} |
a virtual class defining a time coordinator. The base class implements some common data and operations that are common to all the time coordinators
|
virtual |
add a federate dependency
Reimplemented in helics::TimeCoordinator.
References helics::TimeDependencies::addDependency(), dependencies, helics::TimeDependencies::getDependencyInfo(), and mSourceId.
Referenced by helics::TimeCoordinator::addDependency(), and processDependencyUpdateMessage().
|
virtual |
add a dependent federate
Reimplemented in helics::TimeCoordinator.
References helics::TimeDependencies::addDependent(), and dependencies.
Referenced by helics::TimeCoordinator::addDependent(), and processDependencyUpdateMessage().
|
pure virtual |
check if entry to the executing state can be granted
Implemented in helics::TimeCoordinator, helics::AsyncTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::GlobalTimeCoordinator.
int helics::BaseTimeCoordinator::dependencyCount | ( | ) | const |
get a count of the active dependencies
References helics::TimeDependencies::activeDependencyCount(), and dependencies.
void helics::BaseTimeCoordinator::disconnect | ( | ) |
disconnect
References helics::appendMessage(), helics::TimeDependencies::begin(), dependencies, helics::ActionMessage::dest_id, helics::TimeDependencies::empty(), mSourceId, processTimeMessage(), sendMessageFunction, helics::TimeDependencies::size(), and helics::ActionMessage::source_id.
Referenced by helics::TimeCoordinator::checkTimeGrant().
|
inline |
check whether a timeCoordinator has any dependencies or dependents
References dependencies, and helics::TimeDependencies::empty().
|
virtual |
function to enter the exec Mode
mode | the mode of iteration_request (NO_ITERATIONS, FORCE_ITERATION, ITERATE_IF_NEEDED) |
Reimplemented in helics::TimeCoordinator.
References helics::TimeDependencies::checkForIssues(), dependencies, helics::ActionMessage::dest_id, helics::TimeDependencies::empty(), executionMode, helics::ActionMessage::messageID, mSourceId, noParent, helics::parent_broker_id, helics::ActionMessage::payload, sendMessageFunction, helics::ActionMessage::source_id, and updateTimeFactors().
|
virtual |
generate debugging time information
Reimplemented in helics::TimeCoordinator, helics::AsyncTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::GlobalTimeCoordinator.
References helics::GlobalFederateId::baseValue(), dependencies, federatesOnly, mSourceId, and sequenceCounter.
Referenced by helics::ForwardingTimeCoordinator::generateDebuggingTimeInfo(), helics::GlobalTimeCoordinator::generateDebuggingTimeInfo(), helics::AsyncTimeCoordinator::generateDebuggingTimeInfo(), helics::TimeCoordinator::generateDebuggingTimeInfo(), and grantTimeoutCheck().
|
protected |
generate a timeRequest message based on the dependency info data
References helics::ActionMessage::actionTime, helics::GlobalFederateId::baseValue(), helics::ActionMessage::counter, helics::ActionMessage::dest_id, helics::TimeData::interrupted, helics::interrupted_flag, helics::TimeData::minDe, helics::TimeData::minFed, mSourceId, helics::TimeData::next, sequenceCounter, helics::ActionMessage::setAction(), helics::setActionFlag(), helics::ActionMessage::setExtraData(), helics::ActionMessage::setExtraDestData(), helics::ActionMessage::source_id, helics::ActionMessage::Tdemin, helics::ActionMessage::Te, and helics::TimeData::Te.
std::vector< GlobalFederateId > helics::BaseTimeCoordinator::getDependencies | ( | ) | const |
get a list of actual dependencies
References dependencies.
const DependencyInfo * helics::BaseTimeCoordinator::getDependencyInfo | ( | GlobalFederateId | ofed | ) | const |
take a global id and get a pointer to the dependencyInfo for the other fed will be nullptr if it doesn't exist
References dependencies, and helics::TimeDependencies::getDependencyInfo().
std::vector< GlobalFederateId > helics::BaseTimeCoordinator::getDependents | ( | ) | const |
get a reference to the dependents vector
References dependencies.
GlobalFederateId helics::BaseTimeCoordinator::getMinDependency | ( | ) | const |
get a count of the active dependencies
References dependencies, and helics::TimeDependencies::getMinDependency().
|
pure virtual |
get the current next time
Implemented in helics::TimeCoordinator, helics::AsyncTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::GlobalTimeCoordinator.
Json::Value helics::BaseTimeCoordinator::grantTimeoutCheck | ( | const ActionMessage & | cmd | ) |
grant timeout check
References dependencies, and generateDebuggingTimeInfo().
bool helics::BaseTimeCoordinator::hasActiveTimeDependencies | ( | ) | const |
check if there are any active Time dependencies
References dependencies, and helics::TimeDependencies::hasActiveTimeDependencies().
Referenced by helics::FilterFederate::hasActiveTimeDependencies().
bool helics::BaseTimeCoordinator::isDependency | ( | GlobalFederateId | ofed | ) | const |
check whether a federate is a dependency
References dependencies, and helics::TimeDependencies::isDependency().
|
pure virtual |
generate a string with the current time status
Implemented in helics::TimeCoordinator, helics::AsyncTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::GlobalTimeCoordinator.
void helics::BaseTimeCoordinator::processDependencyUpdateMessage | ( | const ActionMessage & | cmd | ) |
process a dependency update message
References addDependency(), addDependent(), helics::checkActionFlag(), helics::child_flag, dependencies, helics::parent_flag, removeDependency(), removeDependent(), and helics::TimeDependencies::updateTime().
bool helics::BaseTimeCoordinator::processTimeMessage | ( | const ActionMessage & | cmd | ) |
process a message related to time
References dependencies, removeDependent(), and helics::TimeDependencies::updateTime().
Referenced by disconnect().
|
virtual |
remove a dependency
fedID | the identifier of the federate to remove |
Reimplemented in helics::TimeCoordinator.
References dependencies, and helics::TimeDependencies::removeDependency().
Referenced by processDependencyUpdateMessage().
|
virtual |
remove a dependent
fedID | the identifier of the federate to remove |
Reimplemented in helics::TimeCoordinator.
References dependencies, and helics::TimeDependencies::removeDependent().
Referenced by processDependencyUpdateMessage(), and processTimeMessage().
|
protected |
send the timing info to dependents
References helics::delayed_timing_flag, dependencies, helics::ActionMessage::dest_id, mSourceId, helics::non_granting_flag, nonGranting, sendMessageFunction, helics::setActionFlag(), helics::ActionMessage::setExtraData(), and helics::ActionMessage::source_id.
Referenced by helics::TimeCoordinator::enteringExecMode().
void helics::BaseTimeCoordinator::setMessageSender | ( | std::function< void(const ActionMessage &)> | userSendMessageFunction | ) |
set the callback function used for the sending messages
References sendMessageFunction.
|
pure virtual |
compute updates to time values and send an update if needed
Implemented in helics::TimeCoordinator, helics::AsyncTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::GlobalTimeCoordinator.
Referenced by enteringExecMode().
|
protected |
federates which this Federate is temporally dependent on
Referenced by addDependency(), addDependent(), helics::ForwardingTimeCoordinator::checkExecEntry(), helics::GlobalTimeCoordinator::checkExecEntry(), helics::TimeCoordinator::checkExecEntry(), helics::TimeCoordinator::checkTimeGrant(), dependencyCount(), disconnect(), empty(), enteringExecMode(), helics::TimeCoordinator::enteringExecMode(), helics::TimeCoordinator::enterInitialization(), generateDebuggingTimeInfo(), getDependencies(), getDependencyInfo(), getDependents(), getMinDependency(), helics::TimeCoordinator::getMinGrantedDependency(), grantTimeoutCheck(), hasActiveTimeDependencies(), isDependency(), helics::TimeCoordinator::localError(), processDependencyUpdateMessage(), processTimeMessage(), removeDependency(), helics::TimeCoordinator::removeDependency(), removeDependent(), helics::TimeCoordinator::removeDependent(), helics::TimeCoordinator::requestTimeCheck(), sendTimingInfo(), helics::TimeCoordinator::sendUpdatedExecRequest(), helics::TimeCoordinator::timeRequest(), helics::GlobalTimeCoordinator::updateTimeFactors(), helics::ForwardingTimeCoordinator::updateTimeFactors(), helics::AsyncTimeCoordinator::updateTimeFactors(), and helics::TimeCoordinator::updateTimeFactors().
|
protected |
flag that the coordinator has entered the execution Mode
Referenced by helics::AsyncTimeCoordinator::checkExecEntry(), enteringExecMode(), helics::TimeCoordinator::enteringExecMode(), helics::GlobalTimeCoordinator::generateDebuggingTimeInfo(), helics::TimeCoordinator::updateMessageTime(), and helics::TimeCoordinator::updateValueTime().
|
protected |
specify that the timeCoordinator should not grant times and instead operate in a continuous manner until completion
Referenced by helics::TimeCoordinator::checkTimeGrant(), and sendTimingInfo().