helics  3.5.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< GlobalFederateIdgetDependencies () const
 
std::vector< GlobalFederateIdgetDependents () const
 
Time getLastGrant (GlobalFederateId fedId) const
 
void setSourceId (GlobalFederateId sourceId)
 
GlobalFederateId sourceId () const
 
virtual bool updateTimeFactors ()=0
 
const DependencyInfogetDependencyInfo (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 (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}
 

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 ( )

◆ 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
modethe 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 ( Json::Value &  base) const
virtual

◆ generateTimeRequest()

ActionMessage helics::BaseTimeCoordinator::generateTimeRequest ( const TimeData dep,
GlobalFederateId  fed,
std::int32_t  responseCode 
) const
protected

◆ 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

◆ grantTimeoutCheck()

Json::Value 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

◆ processDependencyUpdateMessage()

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

◆ processTimeMessage()

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

◆ removeDependency()

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

remove a dependency

Parameters
fedIDthe identifier of the federate to remove

Reimplemented in helics::TimeCoordinator.

◆ removeDependent()

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

remove a dependent

Parameters
fedIDthe 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
fedIDthe identifier of the federate to reset

◆ sendTimingInfo()

void helics::BaseTimeCoordinator::sendTimingInfo ( )
protected

◆ 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

◆ executionMode

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

◆ 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: