2 #ifndef SYDEVS_TIME_CACHE_H_
3 #define SYDEVS_TIME_CACHE_H_
63 return event_ids_.empty();
69 return event_ids_.size();
A data type which represents the general concept of scale as a dimensionless power of 1000.
Definition: scale.h:71
A data structure which provides durations elapsed since past events.
Definition: time_cache.h:28
int64 size() const
Returns the number of events in the time cache.
Definition: time_cache.h:67
bool empty() const
Returns true if the time cache is empty.
Definition: time_cache.h:61
time_cache & operator=(const time_cache &)=default
Copy assignment.
duration duration_since(int64 event_id) const
Returns the duration since the specified event, or an infinite duration.
Definition: time_cache.cpp:50
time_cache & operator=(time_cache &&)=default
Move assignment.
bool release_event(int64 event_id)
Erases the record of the event with id event_id, returning true if successful.
Definition: time_cache.cpp:68
const time_point & advance_time(duration dt)
Advances the current time by dt.
Definition: time_cache.cpp:27
time_cache()
Constructs an empty time cache with a current time of zero.
Definition: time_cache.cpp:6
void retain_event(int64 event_id, scale precision)
Retains a record of the event with id event_id at the specified precision.
Definition: time_cache.cpp:61
~time_cache()=default
Destructor.
time_cache(time_cache &&)=default
Move constructor.
const time_point & current_time() const
Returns the current time.
Definition: time_cache.h:73
const time_queue::event_id_set & event_ids() const
Return the set of ids of all retained events.
Definition: time_cache.h:79
time_cache(const time_cache &)=default
Copy constructor.
A data structure which represents a point in time as an arbitrary-precision multiple of its shortest ...
Definition: time_point.h:85
A data structure which supports the scheduling of future events.
Definition: time_queue.h:35
const time_point & current_time() const
Returns the current time.
Definition: time_queue.h:112
std::set< int64 > event_id_set
The container used to store ids of events occurring at the same time.
Definition: time_queue.h:37
int64_t int64
Definition: number_types.h:15