Skip to content
Snippets Groups Projects

Resolve "Add time_tolerance field in Frame and remove PackKeyFrame"

3 files
+ 9
9
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -159,7 +159,7 @@ public:
* Check if the time distance between two time stamps is smaller than
* the time tolerance.
*/
static bool simpleCheckTimeTolerance(const TimeStamp& _time_stamp1, const TimeStamp& _time_stamp2, const double& _time_tolerance);
static bool checkTimeTolerance(const TimeStamp& _time_stamp1, const TimeStamp& _time_stamp2, const double& _time_tolerance);
/**\brief Check time tolerance
*
@@ -449,13 +449,13 @@ typename Buffer<T>::Iterator Buffer<T>::selectIterator(const TimeStamp& _time_st
bool prev_exists = (post != container_.begin());
bool post_exists = (post != container_.end());
bool post_ok = post_exists && simpleCheckTimeTolerance(post->first, _time_stamp, _time_tolerance);
bool post_ok = post_exists && checkTimeTolerance(post->first, _time_stamp, _time_tolerance);
if (prev_exists)
{
Buffer<T>::Iterator prev = std::prev(post);
bool prev_ok = simpleCheckTimeTolerance(prev->first, _time_stamp, _time_tolerance);
bool prev_ok = checkTimeTolerance(prev->first, _time_stamp, _time_tolerance);
if (prev_ok && !post_ok)
return prev;
@@ -507,7 +507,7 @@ T Buffer<T>::selectFirstBefore(const TimeStamp& _time_stamp, const double& _time
return container_.begin()->second;
// Return first element if despite being newer, it is within the time tolerance
if (simpleCheckTimeTolerance(container_.begin()->first, _time_stamp, _time_tolerance))
if (checkTimeTolerance(container_.begin()->first, _time_stamp, _time_tolerance))
return container_.begin()->second;
// otherwise return nullptr (no element before the provided ts or within the tolerance was found)
@@ -528,7 +528,7 @@ T Buffer<T>::selectLastAfter(const TimeStamp& _time_stamp, const double& _time_t
return container_.rbegin()->second;
// Return last element if despite being older, it is within the time tolerance
if (simpleCheckTimeTolerance(container_.rbegin()->first, _time_stamp, _time_tolerance))
if (checkTimeTolerance(container_.rbegin()->first, _time_stamp, _time_tolerance))
return container_.rbegin()->second;
// otherwise return nullptr (no element after the provided ts or within the tolerance was found)
@@ -614,7 +614,7 @@ inline bool Buffer<T>::doubleCheckTimeTolerance(const TimeStamp& _time_stamp1,
}
template <typename T>
inline bool Buffer<T>::simpleCheckTimeTolerance(const TimeStamp& _time_stamp1,
inline bool Buffer<T>::checkTimeTolerance(const TimeStamp& _time_stamp1,
const TimeStamp& _time_stamp2,
const double& _time_tolerance)
{
Loading