SpECTRE
v2023.10.11
|
A list of time intervals that allows safe access to existing elements even during modification. More...
#include <ThreadsafeList.hpp>
Classes | |
struct | IntervalInfo |
class | iterator |
Public Member Functions | |
ThreadsafeList () | |
No operations are valid on a default-initialized object except for assignment and deserialization. | |
ThreadsafeList (ThreadsafeList &&other) | |
ThreadsafeList (const ThreadsafeList &other) | |
ThreadsafeList & | operator= (ThreadsafeList &&other) |
ThreadsafeList & | operator= (const ThreadsafeList &other) |
ThreadsafeList (double initial_time) | |
void | insert (double update_time, T data, double expiration_time) |
Insert data valid over the interval from update_time to expiration_time . More... | |
IntervalInfo | operator() (double time) const |
Obtain the start time, data, and expiration time for the time interval containing time . More... | |
double | initial_time () const |
double | expiration_time () const |
The expiration time of the last data interval. | |
double | expiration_after (double time) const |
The first interval boundary after time . If time is an interval boundary, the one after it is returned. | |
void | pup (PUP::er &p) |
iterator | begin () const |
Iterate over all the intervals in the list, in reverse order (i.e., most recent first). | |
iterator | end () const |
Iterate over all the intervals in the list, in reverse order (i.e., most recent first). | |
A list of time intervals that allows safe access to existing elements even during modification.
Concurrent modification is not supported. All non-modifying operations except for serialization can be safely performed in parallel with each other and with insert
and will return a consistent state.
void domain::FunctionsOfTime::FunctionOfTimeHelpers::ThreadsafeList< T >::insert | ( | double | update_time, |
T | data, | ||
double | expiration_time | ||
) |
Insert data valid over the interval from update_time
to expiration_time
.
The update_time
must be the same as the old expiration time. It is passed as a check that the calling code is computing the other arguments with the correct value.
IntervalInfo domain::FunctionsOfTime::FunctionOfTimeHelpers::ThreadsafeList< T >::operator() | ( | double | time | ) | const |
Obtain the start time, data, and expiration time for the time interval containing time
.
If time
is at an interval boundary, the earlier interval is returned, except for the initial time, which returns the first interval.