SpECTRE  v2023.10.11
domain::FunctionsOfTime::FunctionOfTimeHelpers::ThreadsafeList< T > Class Template Reference

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)
 
ThreadsafeListoperator= (ThreadsafeList &&other)
 
ThreadsafeListoperator= (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).
 

Detailed Description

template<typename T>
class domain::FunctionsOfTime::FunctionOfTimeHelpers::ThreadsafeList< T >

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.

Member Function Documentation

◆ insert()

template<typename T >
void domain::FunctionsOfTime::FunctionOfTimeHelpers::ThreadsafeList< T >::insert ( double  update_time,
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.

◆ operator()()

template<typename T >
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.


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