Optional GetBlockingTrajectoryId (#820)
[RFC=0008](https://github.com/googlecartographer/rfcs/blob/master/text/0008-collator-interface.md)master
parent
53c2a6b58f
commit
f64eef876a
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue