| helics 3.6.1

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
helics::BaseTimeCoordinator Class Referenceabstract

`#include <BaseTimeCoordinator.hpp>`

Inheritance diagram for helics::BaseTimeCoordinator:

## 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
Time | getLastGrant (GlobalFederateId fedId) 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
virtual TimeProcessingResult | 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)
virtual void | resetDependency (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 (nlohmann::json &base) const
bool | hasActiveTimeDependencies () const
int | dependencyCount () const
GlobalFederateId | getMinDependency () const
nlohmann::json | 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}

## Detailed Description

a virtual class defining a time coordinator. The base class implements some common data and operations that are common to all the time coordinators

## Member Function Documentation

## ◆ addDependency()

bool helics::BaseTimeCoordinator::addDependency | ( | GlobalFederateId | fedID | ) |
| virtual

add a federate dependency

Returns
  true if it was actually added, false if the federate was already present

Reimplemented in helics::TimeCoordinator.

Referenced by helics::TimeCoordinator::addDependency().

## ◆ addDependent()

bool helics::BaseTimeCoordinator::addDependent | ( | GlobalFederateId | fedID | ) |
| virtual

add a dependent federate

Returns
  true if it was actually added, false if the federate was already present

Reimplemented in helics::TimeCoordinator.

Referenced by helics::TimeCoordinator::addDependent().

## ◆ checkExecEntry()

virtual MessageProcessingResult helics::BaseTimeCoordinator::checkExecEntry | ( | GlobalFederateId | triggerFed = `GlobalFederateId{}` | ) |
| pure virtual

check if entry to the executing state can be granted

Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.

## ◆ dependencyCount()

int helics::BaseTimeCoordinator::dependencyCount | ( |  | ) | const

get a count of the active dependencies

## ◆ disconnect()

void helics::BaseTimeCoordinator::disconnect | ( |  | ) |

disconnect

References helics::appendMessage(), helics::ActionMessage::dest_id, and helics::ActionMessage::source_id.

Referenced by helics::TimeCoordinator::checkTimeGrant().

## ◆ empty()

bool helics::BaseTimeCoordinator::empty | ( |  | ) | const
| inline

check whether a timeCoordinator has any dependencies or dependents

References dependencies, and helics::TimeDependencies::empty().

## ◆ enteringExecMode()

void helics::BaseTimeCoordinator::enteringExecMode | ( | IterationRequest | mode = `IterationRequest::NO_ITERATIONS` | ) |
| virtual

function to enter the exec Mode

Parameters

  mode | the mode of iteration_request (NO_ITERATIONS, FORCE_ITERATION, ITERATE_IF_NEEDED)

Reimplemented in helics::TimeCoordinator.

References helics::parent_broker_id.

## ◆ generateDebuggingTimeInfo()

void helics::BaseTimeCoordinator::generateDebuggingTimeInfo | ( | nlohmann::json & | base | ) | const
| virtual

generate debugging time information

Reimplemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.

Referenced by helics::AsyncTimeCoordinator::generateDebuggingTimeInfo(), helics::ForwardingTimeCoordinator::generateDebuggingTimeInfo(), helics::GlobalTimeCoordinator::generateDebuggingTimeInfo(), and helics::TimeCoordinator::generateDebuggingTimeInfo().

## ◆ generateTimeRequest()

ActionMessage helics::BaseTimeCoordinator::generateTimeRequest | ( | const TimeData & | dep,
|  | GlobalFederateId | fed,
|  | std::int32_t | responseCode
| ) |  | const
| 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, FORCE_ITERATION, helics::TimeData::interrupted, helics::interrupted_flag, ITERATE_IF_NEEDED, helics::TimeData::minDe, helics::TimeData::minFed, helics::TimeData::next, helics::TimeData::responseSequenceCounter, helics::ActionMessage::setAction(), helics::setActionFlag(), helics::ActionMessage::setExtraData(), helics::ActionMessage::setExtraDestData(), helics::setIterationFlags(), helics::ActionMessage::source_id, helics::ActionMessage::Tdemin, helics::ActionMessage::Te, and helics::TimeData::Te.

## ◆ getDependencies()

std::vector< GlobalFederateId > helics::BaseTimeCoordinator::getDependencies | ( |  | ) | const

get a list of actual dependencies

## ◆ getDependencyInfo()

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

## ◆ getDependents()

std::vector< GlobalFederateId > helics::BaseTimeCoordinator::getDependents | ( |  | ) | const

get a reference to the dependents vector

## ◆ getLastGrant()

Time helics::BaseTimeCoordinator::getLastGrant | ( | GlobalFederateId | fedId | ) | const

get the last time grant from a federate

References helics::timeZero.

## ◆ getMinDependency()

GlobalFederateId helics::BaseTimeCoordinator::getMinDependency | ( |  | ) | const

get a count of the active dependencies

## ◆ getNextTime()

virtual Time helics::BaseTimeCoordinator::getNextTime | ( |  | ) | const
| pure virtual

get the current next time

Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.

## ◆ grantTimeoutCheck()

nlohmann::json helics::BaseTimeCoordinator::grantTimeoutCheck | ( | const ActionMessage & | cmd | ) |

grant timeout check

Returns
  a json Object with debugging info if empty nothing is logged

References helics::ActionMessage::counter, and helics::ActionMessage::source_id.

## ◆ hasActiveTimeDependencies()

bool helics::BaseTimeCoordinator::hasActiveTimeDependencies | ( |  | ) | const

check if there are any active Time dependencies

## ◆ isDependency()

bool helics::BaseTimeCoordinator::isDependency | ( | GlobalFederateId | ofed | ) | const

check whether a federate is a dependency

## ◆ printTimeStatus()

virtual std::string helics::BaseTimeCoordinator::printTimeStatus | ( |  | ) | const
| pure virtual

generate a string with the current time status

Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.

## ◆ processDependencyUpdateMessage()

void helics::BaseTimeCoordinator::processDependencyUpdateMessage | ( | const ActionMessage & | cmd | ) |

process a dependency update message

References helics::ActionMessage::action(), helics::checkActionFlag(), helics::child_flag, helics::ActionMessage::counter, helics::parent_flag, and helics::ActionMessage::source_id.

## ◆ processTimeMessage()

TimeProcessingResult helics::BaseTimeCoordinator::processTimeMessage | ( | const ActionMessage & | cmd | ) |
| virtual

process a message related to time

Returns
  a TimeProcessingResult if it did anything

Reimplemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, and helics::ForwardingTimeCoordinator.

References helics::ActionMessage::action(), helics::parent_broker_id, and helics::ActionMessage::source_id.

Referenced by helics::ForwardingTimeCoordinator::processTimeMessage(), and helics::GlobalTimeCoordinator::processTimeMessage().

## ◆ removeDependency()

void helics::BaseTimeCoordinator::removeDependency | ( | GlobalFederateId | fedID | ) |
| virtual

remove a dependency

Parameters

  fedID | the identifier of the federate to remove

Reimplemented in helics::TimeCoordinator.

## ◆ removeDependent()

void helics::BaseTimeCoordinator::removeDependent | ( | GlobalFederateId | fedID | ) |
| virtual

remove a dependent

Parameters

  fedID | the identifier of the federate to remove

Reimplemented in helics::TimeCoordinator.

## ◆ resetDependency()

void helics::BaseTimeCoordinator::resetDependency | ( | GlobalFederateId | fedID | ) |
| virtual

reset a dependency that has been reintroduced

Parameters

  fedID | the identifier of the federate to reset

## ◆ sendTimingInfo()

void helics::BaseTimeCoordinator::sendTimingInfo | ( |  | ) |
| protected

send the timing info to dependents

References helics::delayed_timing_flag, helics::ActionMessage::dest_id, helics::non_granting_flag, helics::setActionFlag(), helics::ActionMessage::setExtraData(), and helics::ActionMessage::source_id.

Referenced by helics::TimeCoordinator::enteringExecMode().

## ◆ setMessageSender()

void helics::BaseTimeCoordinator::setMessageSender | ( | std::function< void(const ActionMessage &)> | userSendMessageFunction | ) |

set the callback function used for the sending messages

## ◆ setSourceId()

void helics::BaseTimeCoordinator::setSourceId | ( | GlobalFederateId | sourceId | ) |
| inline

set the source id for the time coordinator

References mSourceId.

## ◆ updateTimeFactors()

virtual bool helics::BaseTimeCoordinator::updateTimeFactors | ( |  | ) |
| pure virtual

compute updates to time values and send an update if needed

Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.

## Member Data Documentation

## ◆ dependencies

TimeDependencies helics::BaseTimeCoordinator::dependencies
| protected

federates which this Federate is temporally dependent on

Referenced by helics::ForwardingTimeCoordinator::checkExecEntry(), helics::GlobalTimeCoordinator::checkExecEntry(), helics::TimeCoordinator::checkExecEntry(), helics::TimeCoordinator::checkTimeGrant(), empty(), helics::TimeCoordinator::enteringExecMode(), helics::TimeCoordinator::enterInitialization(), helics::TimeCoordinator::getMinGrantedDependency(), helics::TimeCoordinator::localError(), helics::TimeCoordinator::removeDependency(), helics::TimeCoordinator::removeDependent(), helics::TimeCoordinator::requestTimeCheck(), helics::TimeCoordinator::sendUpdatedExecRequest(), helics::TimeCoordinator::timeRequest(), helics::AsyncTimeCoordinator::updateTimeFactors(), helics::ForwardingTimeCoordinator::updateTimeFactors(), helics::GlobalTimeCoordinator::updateTimeFactors(), and helics::TimeCoordinator::updateTimeFactors().

## ◆ executionMode

bool helics::BaseTimeCoordinator::executionMode {false}
| protected

flag that the coordinator has entered the execution Mode

Referenced by helics::AsyncTimeCoordinator::checkExecEntry(), helics::TimeCoordinator::enteringExecMode(), helics::GlobalTimeCoordinator::generateDebuggingTimeInfo(), helics::TimeCoordinator::updateMessageTime(), and helics::TimeCoordinator::updateValueTime().

## ◆ nonGranting

bool helics::BaseTimeCoordinator::nonGranting {false}
| protected

specify that the timeCoordinator should not grant times and instead operate in a continuous manner until completion

Referenced by helics::TimeCoordinator::checkTimeGrant().

The documentation for this class was generated from the following files:

- BaseTimeCoordinator.hpp
- BaseTimeCoordinator.cpp