Adds helper routines to the STL Deque for holding messages with headers. More...
#include <sorted_deque.h>
Public Member Functions | |
void | add (const M &msg) |
Add a new element to the deque, correctly sorted by timestamp. More... | |
bool | getClosestElem (const ros::Time &time, M &out) |
Get the elem that occurs closest to the specified time. More... | |
bool | getElemAfterTime (const ros::Time &time, M &out) const |
Grab the oldest element that occurs right after the specified time. More... | |
bool | getElemBeforeTime (const ros::Time &time, M &out) const |
Grab the oldest element that occurs right before the specified time. More... | |
std::vector< M > | getInterval (const ros::Time &start, const ros::Time &end) |
Extract all the elements that occur in the interval between the start and end times. More... | |
std::vector< M > | getSurroundingInterval (const ros::Time &start, const ros::Time &end) |
void | removeAllBeforeTime (const ros::Time &time) |
Removes all elements that occur before the specified time. More... | |
void | setMaxSize (unsigned int max_size) |
Set the maximum # of elements this deque can hold. Older elems are popped once the length is exeeded. More... | |
SortedDeque (std::string logger="deque") | |
Assumes that '.header.stamp' can be used to get the stamp used for sorting. More... | |
SortedDeque (boost::function< const ros::Time &(const M &)> getStampFunc, std::string logger="deque") | |
Advanced constructor, allowing user to specific the timestamp getter method. More... | |
Static Public Member Functions | |
static const ros::Time & | getHeaderStamp (const M &m) |
static const ros::Time & | getPtrStamp (const M &m) |
static const ros::Time & | getStructStamp (const M &m) |
Private Member Functions | |
void | DEQUE_DEBUG_STATS (const std::string &prefix) |
Private Attributes | |
boost::function< const ros::Time &(const M &)> | getStamp |
std::string | logger_ |
unsigned int | max_size_ |
Adds helper routines to the STL Deque for holding messages with headers.
Provides functionality to store a deque of messages that are sorted by timestamp. Users can then extract specific intervals of messages. Old messages fall off the back of the deque
Definition at line 58 of file sorted_deque.h.
|
inline |
Assumes that '.header.stamp' can be used to get the stamp used for sorting.
logger | name of rosconsole logger to display debugging output from this deque |
Definition at line 78 of file sorted_deque.h.
|
inline |
Advanced constructor, allowing user to specific the timestamp getter method.
getStampFunc | Function pointer specific how to get timestamp from the contained datatype |
logger | name of rosconsole logger to display debugging output from this deque |
Definition at line 89 of file sorted_deque.h.
|
inline |
Add a new element to the deque, correctly sorted by timestamp.
msg | the element to add |
Definition at line 109 of file sorted_deque.h.
|
inlineprivate |
Definition at line 329 of file sorted_deque.h.
|
inline |
Get the elem that occurs closest to the specified time.
time | The time that we want to closest elem to |
out | Output: Stores the extracted elem |
Definition at line 258 of file sorted_deque.h.
|
inline |
Grab the oldest element that occurs right after the specified time.
time | The time that must occur before the elem |
out | Output: Stores the extracted elem |
Definition at line 232 of file sorted_deque.h.
|
inline |
Grab the oldest element that occurs right before the specified time.
time | The time that must occur after the elem |
out | Output: Stores the extracted elem |
Definition at line 206 of file sorted_deque.h.
|
inlinestatic |
Definition at line 313 of file sorted_deque.h.
|
inline |
Extract all the elements that occur in the interval between the start and end times.
start | The start of the interval |
end | The end of the interval |
Definition at line 141 of file sorted_deque.h.
|
inlinestatic |
Definition at line 303 of file sorted_deque.h.
|
inlinestatic |
Definition at line 308 of file sorted_deque.h.
|
inline |
Retrieve the smallest interval of messages that surrounds an interval from start to end. If the messages in the cache do not surround (start,end), then this will return the interval that gets closest to surrounding (start,end)
Definition at line 174 of file sorted_deque.h.
|
inline |
Removes all elements that occur before the specified time.
time | All elems that occur before this are removed from the deque |
Definition at line 287 of file sorted_deque.h.
|
inline |
Set the maximum # of elements this deque can hold. Older elems are popped once the length is exeeded.
max_size | The maximum # of elems to hold. Passing in 0 implies that the queue can grow indefinitely (which is a recipe for a memory leak) |
Definition at line 100 of file sorted_deque.h.
|
private |
Definition at line 327 of file sorted_deque.h.
|
private |
Definition at line 319 of file sorted_deque.h.
|
private |
Definition at line 318 of file sorted_deque.h.