@@ -38,7 +38,7 @@ class Buffer
38
38
// / \brief Buffer default constructor
39
39
// / max buffer size is set to 400 by default
40
40
// /
41
- Buffer () = default ;
41
+ Buffer ();
42
42
43
43
// /
44
44
// / \brief Buffer constructor
@@ -79,7 +79,10 @@ class Buffer
79
79
// / \brief get_length
80
80
// / \return current number of elements stored in the buffer
81
81
// /
82
- int get_length () const ;
82
+ inline int get_length () const
83
+ {
84
+ return static_cast <int >(data_.size ());
85
+ }
83
86
84
87
// /
85
88
// / \brief PrintBufferEntries prints all buffer entries in a formatted way
@@ -199,7 +202,10 @@ class Buffer
199
202
// / \return Index of the added entry. The index is -1 if the entry was removed because the max_buffer_size was
200
203
// / reached.
201
204
// /
202
- int AddEntrySorted (const BufferEntryType& new_entry);
205
+ // / The method finds the closest timestamp based on the shortest 'time' distance between the new and existing buffer
206
+ // / elements. It then determines if the entry needs to be added before or after the closest entry.
207
+ // /
208
+ int AddEntrySorted (const BufferEntryType& new_entry, const bool & after = true );
203
209
204
210
// /
205
211
// / \brief FindClosestTimestamp Returns the index of the entry which is the closest to the specified 'timestamp' when
@@ -211,44 +217,25 @@ class Buffer
211
217
212
218
// /
213
219
// / \brief Deletes all states after, and including the given index
220
+ // / This also deletes all auto generated states
221
+ // /
214
222
// / \param idx Start index after which all states are deleted
215
223
// / \return true if function was performed correct, false otherwise
216
224
// /
217
- bool DeleteStatesStartingAtIdx (const int & idx);
225
+ bool ClearStatesStartingAtIdx (const int & idx);
218
226
219
227
// /
220
228
// / \brief Checks if all buffer entrys are correctly sorted by time
221
229
// / \return true if sorted, false otherwise
222
230
// /
223
231
bool IsSorted () const ;
224
232
225
- // /
226
- // / \brief Inserting new element before the element at the specified position
227
- // / \param new_entry ntry that is added to the buffer
228
- // /
229
- // / The method finds the closest timestamp based on the shortest 'time' distance between the new and existing buffer
230
- // / elements. It then determines if the entry needs to be added before or after the closest entry.
231
- // /
232
- int InsertDataAtTimestamp (const BufferEntryType& new_entry);
233
-
234
233
// /
235
234
// / \brief InsertDataAtIndex Adds 'entry' at buffer position 'index'
236
235
// / \param new_entry Entry buffer entry to be added
237
236
// / \param index position at which the entry is added
238
237
// /
239
- bool InsertDataAtIndex (const BufferEntryType& new_entry, const int & index);
240
-
241
- // /
242
- // / \brief InsertIntermediateData Insert data during the intermediate propagation step
243
- // /
244
- // / This function is intended for inserting a auto generated measurement and state before a current measurement entry.
245
- // / This is required for intermediate propagation information.
246
- // /
247
- // / \param measurement
248
- // / \param state
249
- // / \return
250
- // /
251
- bool InsertIntermediateData (const BufferEntryType& measurement, const BufferEntryType& state);
238
+ bool OverwriteDataAtIndex (const BufferEntryType& new_entry, const int & index);
252
239
253
240
// /
254
241
// / \brief get_latest_interm_entrie Get last state pair of imu prop and sensor update
@@ -261,14 +248,15 @@ class Buffer
261
248
// /
262
249
// / \return True if successfull, false of no pair was found
263
250
// /
264
- bool get_intermediate_entry_pair (const std::shared_ptr<SensorAbsClass>& sensor_handle, BufferEntryType* imu_state, BufferEntryType* sensor_state) const ;
251
+ bool get_intermediate_entry_pair (const std::shared_ptr<SensorAbsClass>& sensor_handle, BufferEntryType* imu_state,
252
+ BufferEntryType* sensor_state) const ;
265
253
266
254
// /
267
- // / \brief CheckForLastHandle Checks if the given sensor handle only exists once in the buffer
268
- // / \param sensor_handle
269
- // / \return true if current sensor handle is the last in the buffer, false otherwise
255
+ // / \brief CheckForLastSensorHandleWithState Checks if the given sensor handle only exists once in the buffer and if
256
+ // / it has a state \param sensor_handle \return true if current sensor handle is the last in the buffer, false
257
+ // / otherwise
270
258
// /
271
- bool CheckForLastSensorHandlePair (const std::shared_ptr<SensorAbsClass>& sensor_handle) const ;
259
+ bool CheckForLastSensorHandleWithState (const std::shared_ptr<SensorAbsClass>& sensor_handle) const ;
272
260
273
261
// /
274
262
// / \brief RemoveOverflowEntrys Removes the oldest entries if max buffer size is reached
0 commit comments