GLIM
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
glim::InterpolationHelper< Value > Class Template Reference

A helper class to find the values that cover a given timestamp from a data stream. More...

#include <interpolation_helper.hpp>

Public Types

using StampedValue = std::pair< double, Value >
 

Public Member Functions

 InterpolationHelper (InterpolationHelperSearchMode search_mode=InterpolationHelperSearchMode::LINEAR)
 Constructor.
 
bool empty () const
 Check if it's emptry.
 
int size () const
 Number of queued values.
 
double leftmost_time () const
 Oldest timestamp in the queue.
 
double rightmost_time () const
 Newest timestamp in the queue.
 
void add (double stamp, const Value &value)
 Add a new value.
 
void add (const std::pair< double, Value > &stamped_value)
 Add a new value.
 
InterpolationHelperResult find (const double stamp, StampedValue *left_ptr, StampedValue *right_ptr, int *remove_cursor_ptr) const
 Find the values that cover the target timestamp.
 
void erase (int remove_cursor)
 Erase values older than the given cursor.
 

Detailed Description

template<typename Value>
class glim::InterpolationHelper< Value >

A helper class to find the values that cover a given timestamp from a data stream.

Constructor & Destructor Documentation

◆ InterpolationHelper()

template<typename Value >
glim::InterpolationHelper< Value >::InterpolationHelper ( InterpolationHelperSearchMode  search_mode = InterpolationHelperSearchMode::LINEAR)
inline

Constructor.

Parameters
search_modeSearch mode

Member Function Documentation

◆ add()

template<typename Value >
void glim::InterpolationHelper< Value >::add ( double  stamp,
const Value &  value 
)
inline

Add a new value.

Parameters
stampTimestamp
valueValue

◆ erase()

template<typename Value >
void glim::InterpolationHelper< Value >::erase ( int  remove_cursor)
inline

Erase values older than the given cursor.

Parameters
remove_cursorCursor index

◆ find()

template<typename Value >
InterpolationHelperResult glim::InterpolationHelper< Value >::find ( const double  stamp,
StampedValue *  left_ptr,
StampedValue *  right_ptr,
int *  remove_cursor_ptr 
) const
inline

Find the values that cover the target timestamp.

Parameters
stampTarget timestamp
left_ptr[out] The closest value that is older than the target timestamp (nullptr if not needed)
right_ptr[out] The closest value that is newer than the target timestamp (nullptr if not needed)
remove_cursor_ptr[out] The index of the value that is older than the left_ptr (nullptr if not needed)
Returns
Seach result status

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