A data structure which represents progress through a simulation, encapsulating both simulated time and a counter of events within a single point in simulated time.
More...
#include <discrete_event_time.h>
A data structure which represents progress through a simulation, encapsulating both simulated time and a counter of events within a single point in simulated time.
A discrete_event_time
object tracks both a simulated time point and the number of events or steps that have occurred within that time point. Whenever the simulated time point advances, the counter of past events is reset to zero.
Below is an example of how a discrete_event_time
object can be initialized and advanced.
auto start_t = time_point() + 100
_s;
auto end_t = time_point() + 400
_s;
event_time.advance(57
_s, end_t);
event_time.advance();
event_time.advance(240
_s, end_t);
event_time.advance();
event_time.advance();
discrete_event_time()
Constructs a discrete_event_time object starting at time zero and a counter value of zero.
Definition: discrete_event_time.h:77
constexpr auto _s
Definition: units.h:128
◆ discrete_event_time() [1/5]
sydevs::systems::discrete_event_time::discrete_event_time |
( |
| ) |
|
|
inline |
◆ discrete_event_time() [2/5]
sydevs::systems::discrete_event_time::discrete_event_time |
( |
const time_point & |
t | ) |
|
|
inline |
◆ discrete_event_time() [3/5]
sydevs::systems::discrete_event_time::discrete_event_time |
( |
const time_point & |
t, |
|
|
int64 |
c |
|
) |
| |
|
inline |
◆ discrete_event_time() [4/5]
◆ discrete_event_time() [5/5]
◆ ~discrete_event_time()
virtual sydevs::systems::discrete_event_time::~discrete_event_time |
( |
| ) |
|
|
virtualdefault |
◆ advance() [1/2]
void sydevs::systems::discrete_event_time::advance |
( |
| ) |
|
|
inline |
Advance the counter without changing simulated time point.
◆ advance() [2/2]
void sydevs::systems::discrete_event_time::advance |
( |
duration |
dt, |
|
|
const time_point & |
end_t |
|
) |
| |
|
inline |
Advance the simulated time point by dt
, but not beyond end_t
.
◆ c()
int64 sydevs::systems::discrete_event_time::c |
( |
| ) |
const |
|
inline |
Return the counter value of associated with the current point in simulated time.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ t()
const time_point & sydevs::systems::discrete_event_time::t |
( |
| ) |
const |
|
inline |
Return the current point in simulated time.
◆ t_index()
int64 sydevs::systems::discrete_event_time::t_index |
( |
| ) |
const |
|
inline |
Return the index associated with the current point in simulated time.
The documentation for this class was generated from the following file: