2 #ifndef SYDEVS_TIME_CACHE_H_
3 #define SYDEVS_TIME_CACHE_H_
63 return event_ids_.empty();
69 return event_ids_.size();
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
std::set< int64 > event_id_set
The container used to store ids of events occurring at the same time.
Definition: time_queue.h:37
const time_point & current_time() const
Returns the current time.
Definition: time_queue.h:112
bool empty() const
Returns true if the time cache is empty.
Definition: time_cache.h:61
A data structure which provides durations elapsed since past events.
Definition: time_cache.h:27
duration duration_since(int64 event_id) const
Returns the duration since the specified event, or an infinite duration.
Definition: time_cache.cpp:50
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 & operator=(const time_cache &)=default
Copy assignment.
A data type which represents the general concept of scale as a dimensionless power of 1000...
Definition: scale.h:70
~time_cache()=default
Destructor.
A data structure which represents a point in time as an arbitrary-precision multiple of its shortest ...
Definition: time_point.h:84
const time_point & current_time() const
Returns the current time.
Definition: time_cache.h:73
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
A data structure which supports the scheduling of future events.
Definition: time_queue.h:34
time_cache()
Constructs an empty time cache with a current time of zero.
Definition: time_cache.cpp:6
int64 size() const
Returns the number of events in the time cache.
Definition: time_cache.h:67
const time_point & advance_time(duration dt)
Advances the current time by dt.
Definition: time_cache.cpp:27