| helics 3.6.1

Public Types | Public Member Functions | List of all members
helics::MessageTimer Class Reference

`#include <MessageTimer.hpp>`

Inheritance diagram for helics::MessageTimer:

## Public Types
using | time_type = decltype(std::chrono::steady_clock::now())

## Public Member Functions
| MessageTimer (std::function< void(ActionMessage &&)> sFunction)
int32_t | addTimerFromNow (std::chrono::nanoseconds time, ActionMessage mess)
int32_t | addTimer (time_type expirationTime, ActionMessage mess)
void | cancelTimer (int32_t index)
void | cancelAll ()
void | updateTimer (int32_t timerIndex, time_type expirationTime, ActionMessage mess)
void | updateTimerFromNow (int32_t timerIndex, std::chrono::nanoseconds time, ActionMessage mess)
bool | updateTimer (int32_t timerIndex, time_type expirationTime)
bool | addTimeToTimer (int32_t timerIndex, std::chrono::nanoseconds time)
void | updateMessage (int32_t timerIndex, ActionMessage mess)
void | sendMessage (int32_t timerIndex)

## Detailed Description

class containing a message timer for sending messages at particular points in time

## Member Function Documentation

## ◆ addTimer()

int32_t helics::MessageTimer::addTimer | ( | time_type | expirationTime,
|  | ActionMessage | mess
| ) |  |

add a timer and message to the queue

Returns
  an index for referencing the timer in the future

## ◆ addTimerFromNow()

int32_t helics::MessageTimer::addTimerFromNow | ( | std::chrono::nanoseconds | time,
|  | ActionMessage | mess
| ) |  |

add a timer and message to the queue

Returns
  an index for referencing the timer in the future

## ◆ addTimeToTimer()

bool helics::MessageTimer::addTimeToTimer | ( | int32_t | timerIndex,
|  | std::chrono::nanoseconds | time
| ) |  |

update the message time of a timer keeping its message the same the function will add time to the timer

Returns
  true if the update was successful and false if not

## ◆ cancelAll()

void helics::MessageTimer::cancelAll | ( |  | ) |

cancel all timers

## ◆ cancelTimer()

void helics::MessageTimer::cancelTimer | ( | int32_t | index | ) |

cancel a timer by index

## ◆ sendMessage()

void helics::MessageTimer::sendMessage | ( | int32_t | timerIndex | ) |

execute the send function associated with a message

## ◆ updateMessage()

void helics::MessageTimer::updateMessage | ( | int32_t | timerIndex,
|  | ActionMessage | mess
| ) |  |

update the message associated with a timer

## ◆ updateTimer() [1/2]

bool helics::MessageTimer::updateTimer | ( | int32_t | timerIndex,
|  | time_type | expirationTime
| ) |  |

update the message time of a timer keeping its message the same if the message has been sent already the message stored is invalid

Returns
  true if the update was successful and false if not

## ◆ updateTimer() [2/2]

void helics::MessageTimer::updateTimer | ( | int32_t | timerIndex,
|  | time_type | expirationTime,
|  | ActionMessage | mess
| ) |  |

update the message time of a timer and its message

## ◆ updateTimerFromNow()

void helics::MessageTimer::updateTimerFromNow | ( | int32_t | timerIndex,
|  | std::chrono::nanoseconds | time,
|  | ActionMessage | mess
| ) |  |

update the message time of a timer and its message

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

- MessageTimer.hpp
- MessageTimer.cpp