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(); } void Collator::Flush() { queue_.Flush(); }
int Collator::GetBlockingTrajectoryId() const { common::optional<int> Collator::GetBlockingTrajectoryId() const {
return queue_.GetBlocker().trajectory_id; return common::optional<int>(queue_.GetBlocker().trajectory_id);
} }
} // namespace sensor } // namespace sensor

View File

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

View File

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