gaschler 2018-01-16 16:21:22 +01:00 committed by Wally B. Feed
parent 53c2a6b58f
commit f64eef876a
3 changed files with 8 additions and 6 deletions

View File

@ -47,8 +47,8 @@ void Collator::AddSensorData(const int trajectory_id,
void Collator::Flush() { queue_.Flush(); }
int Collator::GetBlockingTrajectoryId() const {
return queue_.GetBlocker().trajectory_id;
common::optional<int> Collator::GetBlockingTrajectoryId() const {
return common::optional<int>(queue_.GetBlocker().trajectory_id);
}
} // namespace sensor

View File

@ -47,7 +47,7 @@ class Collator : public CollatorInterface {
void Flush() override;
int GetBlockingTrajectoryId() const override;
common::optional<int> GetBlockingTrajectoryId() const override;
private:
// Queue keys are a pair of trajectory ID and sensor identifier.

View File

@ -22,6 +22,7 @@
#include <unordered_set>
#include <vector>
#include "cartographer/common/optional.h"
#include "cartographer/sensor/data.h"
namespace cartographer {
@ -57,9 +58,10 @@ class CollatorInterface {
virtual void Flush() = 0;
// Must only be called if at least one unfinished trajectory exists. Returns
// the ID of the trajectory that needs more data before the Collator is
// unblocked.
virtual int GetBlockingTrajectoryId() const = 0;
// the ID of the trajectory that needs more data before CollatorInterface is
// unblocked. Returns 'nullopt' for implementations that do not wait for a
// particular trajectory.
virtual common::optional<int> GetBlockingTrajectoryId() const = 0;
};
} // namespace sensor