MIRA
|
Implements a queue where Stamped data can be added. More...
#include <utils/StampedDataQueue.h>
Public Types | |
typedef std::list< Stamped< T >, Eigen::aligned_allocator< T > > | Container |
The type of the underlying container. More... | |
typedef Stamped< T > | value_type |
some typedefs for STL compliance More... | |
typedef Container::const_iterator | const_iterator |
some typedefs for STL compliance More... | |
typedef Container::size_type | size_type |
some typedefs for STL compliance More... | |
Public Member Functions | |
StampedDataQueue (size_type maxCapacity=100, Duration maxStorageTime=Duration::seconds(10)) | |
Creates new StampedDataQueue with the specified maximum capacity (default 100) and maximum storage time (default 10 seconds). More... | |
void | setMaxStorageTime (Duration maxStorageTime) |
Sets the maximum storage time. More... | |
size_type | capacity () const |
Returns the maximum number of items that can be stored in the queue. More... | |
void | reserve (size_type n) |
Request a change in capacity. More... | |
size_type | size () const |
Returns the number of stored elements. More... | |
bool | empty () const |
Returns true, if no element is stored. More... | |
bool | insert (const Stamped< T > &data) |
Inserts new data to the queue. More... | |
void | clear () |
clears the whole queue and removes all elements More... | |
const Stamped< T > & | getData (const Time ×tamp) const |
Returns the data from the queue whose time stamp is closest to the specified timestamp. More... | |
std::pair< const_iterator, const_iterator > | getInterval (const Time ×tamp, std::size_t size, std::size_t before, std::size_t after) |
Returns two iterators that mark the begin and end of an interval of data. More... | |
Implements a queue where Stamped data can be added.
Afterwards the data can be obtained by specifying an arbitrary timestamp. The queue will then search within the stored data to return the data that corresponds to the requested timestamp.
In order to control the number of elements in the queue, a maximum number of items can be specified (the capacity). Additionally, a maximum storage time span can be specified. This ensures that data is removed from the queue if it is older than the timestamp of the latest entry plus the max. storage time.
typedef std::list<Stamped<T>, Eigen::aligned_allocator<T> > Container |
The type of the underlying container.
typedef Stamped<T> value_type |
some typedefs for STL compliance
typedef Container::const_iterator const_iterator |
some typedefs for STL compliance
typedef Container::size_type size_type |
some typedefs for STL compliance
|
inline |
Creates new StampedDataQueue with the specified maximum capacity (default 100) and maximum storage time (default 10 seconds).
|
inline |
Sets the maximum storage time.
|
inline |
Returns the maximum number of items that can be stored in the queue.
If more items are added, the oldest items will get lost.
|
inline |
Request a change in capacity.
Requests that the capacity of the queue for the elements of the vector container be at least enough to hold n elements.
|
inline |
Returns the number of stored elements.
|
inline |
Returns true, if no element is stored.
|
inline |
Inserts new data to the queue.
Returns true, if the data was inserted. Returns false, if the data is too old and was not inserted into the queue.
|
inline |
clears the whole queue and removes all elements
Returns the data from the queue whose time stamp is closest to the specified timestamp.
|
inline |
Returns two iterators that mark the begin and end of an interval of data.
The interval is specified by the four parameters, where 'size' specifies the desired length of the interval. The 'before' and 'after' parameter specify the desired number of data items before (=older than) and after (=newer than) the specified 'timestamp'. If 'before'+'after' is lower than 'size', the method will add additional items before and after the given time stamp in order to fulfill the 'size' constraint, if possible.
If there is a data item in the queue with exactly the requested timestamp, it counts on the after side.