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. | |
bool | getClosestElem (const ros::Time &time, M &out) |
Get the elem that occurs closest to the specified time. | |
bool | getElemAfterTime (const ros::Time &time, M &out) const |
Grab the oldest element that occurs right after the specified time. | |
bool | getElemBeforeTime (const ros::Time &time, M &out) const |
Grab the oldest element that occurs right before the specified time. | |
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. | |
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. | |
void | setMaxSize (unsigned int max_size) |
Set the maximum # of elements this deque can hold. Older elems are popped once the length is exeeded. | |
SortedDeque (std::string logger="deque") | |
Assumes that '.header.stamp' can be used to get the stamp used for sorting. | |
SortedDeque (boost::function< const ros::Time &(const M &)> getStampFunc, std::string logger="deque") | |
Advanced constructor, allowing user to specific the timestamp getter method. | |
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.
settlerlib::SortedDeque< M >::SortedDeque | ( | std::string | logger = "deque" | ) | [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.
settlerlib::SortedDeque< M >::SortedDeque | ( | boost::function< const ros::Time &(const M &)> | getStampFunc, |
std::string | logger = "deque" |
||
) | [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.
void settlerlib::SortedDeque< M >::add | ( | const M & | msg | ) | [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.
void settlerlib::SortedDeque< M >::DEQUE_DEBUG_STATS | ( | const std::string & | prefix | ) | [inline, private] |
Definition at line 329 of file sorted_deque.h.
bool settlerlib::SortedDeque< M >::getClosestElem | ( | const ros::Time & | time, |
M & | out | ||
) | [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.
bool settlerlib::SortedDeque< M >::getElemAfterTime | ( | const ros::Time & | time, |
M & | out | ||
) | const [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.
bool settlerlib::SortedDeque< M >::getElemBeforeTime | ( | const ros::Time & | time, |
M & | out | ||
) | const [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.
static const ros::Time& settlerlib::SortedDeque< M >::getHeaderStamp | ( | const M & | m | ) | [inline, static] |
Definition at line 313 of file sorted_deque.h.
std::vector<M> settlerlib::SortedDeque< M >::getInterval | ( | const ros::Time & | start, |
const ros::Time & | end | ||
) | [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.
static const ros::Time& settlerlib::SortedDeque< M >::getPtrStamp | ( | const M & | m | ) | [inline, static] |
Definition at line 303 of file sorted_deque.h.
static const ros::Time& settlerlib::SortedDeque< M >::getStructStamp | ( | const M & | m | ) | [inline, static] |
Definition at line 308 of file sorted_deque.h.
std::vector<M> settlerlib::SortedDeque< M >::getSurroundingInterval | ( | const ros::Time & | start, |
const ros::Time & | end | ||
) | [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.
void settlerlib::SortedDeque< M >::removeAllBeforeTime | ( | const ros::Time & | time | ) | [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.
void settlerlib::SortedDeque< M >::setMaxSize | ( | unsigned int | max_size | ) | [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.
boost::function<const ros::Time&(const M&)> settlerlib::SortedDeque< M >::getStamp [private] |
Definition at line 327 of file sorted_deque.h.
std::string settlerlib::SortedDeque< M >::logger_ [private] |
Definition at line 319 of file sorted_deque.h.
unsigned int settlerlib::SortedDeque< M >::max_size_ [private] |
Definition at line 318 of file sorted_deque.h.