helics  3.3.0
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
 
void setSourceId (GlobalFederateId sourceId)
 
GlobalFederateId sourceId () const
 
virtual bool updateTimeFactors ()=0
 
const DependencyInfogetDependencyInfo (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}
 

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.

References helics::TimeDependencies::addDependency(), dependencies, helics::TimeDependencies::getDependencyInfo(), and mSourceId.

Referenced by helics::TimeCoordinator::addDependency(), and processDependencyUpdateMessage().

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

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

Referenced by helics::TimeCoordinator::addDependent(), and processDependencyUpdateMessage().

◆ 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::AsyncTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::GlobalTimeCoordinator.

◆ dependencyCount()

int helics::BaseTimeCoordinator::dependencyCount ( ) const

get a count of the active dependencies

References helics::TimeDependencies::activeDependencyCount(), and 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

◆ 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

References 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

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

◆ getDependents()

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

get a reference to the dependents vector

References dependencies.

◆ getMinDependency()

GlobalFederateId helics::BaseTimeCoordinator::getMinDependency ( ) const

get a count of the active dependencies

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

◆ 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 dependencies, and generateDebuggingTimeInfo().

◆ hasActiveTimeDependencies()

bool helics::BaseTimeCoordinator::hasActiveTimeDependencies ( ) const

check if there are any active Time dependencies

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

Referenced by helics::FilterFederate::hasActiveTimeDependencies().

◆ isDependency()

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

check whether a federate is a dependency

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

◆ printTimeStatus()

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

◆ processDependencyUpdateMessage()

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

◆ processTimeMessage()

bool helics::BaseTimeCoordinator::processTimeMessage ( const ActionMessage cmd)

process a message related to time

Returns
a message_process_result if it did anything

References dependencies, removeDependent(), and helics::TimeDependencies::updateTime().

Referenced by disconnect().

◆ removeDependency()

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

remove a dependency

Parameters
fedIDthe identifier of the federate to remove

Reimplemented in helics::TimeCoordinator.

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

Referenced by processDependencyUpdateMessage().

◆ removeDependent()

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

remove a dependent

Parameters
fedIDthe identifier of the federate to remove

Reimplemented in helics::TimeCoordinator.

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

Referenced by processDependencyUpdateMessage(), and processTimeMessage().

◆ 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

References sendMessageFunction.

◆ updateTimeFactors()

virtual bool helics::BaseTimeCoordinator::updateTimeFactors ( )
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().

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(), and sendTimingInfo().


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