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(); }
|
||||
|
||||
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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue