19 #ifndef FACTOR_ADDERS_SINGLE_MEASUREMENT_BASED_FACTOR_ADDER_H_
20 #define FACTOR_ADDERS_SINGLE_MEASUREMENT_BASED_FACTOR_ADDER_H_
25 template <
typename MeasurementType>
41 gtsam::NonlinearFactorGraph& factors)
final;
45 virtual int AddFactorsForSingleMeasurement(
const MeasurementType& measurement,
46 gtsam::NonlinearFactorGraph& factors) = 0;
49 virtual bool CanAddFactor(
const MeasurementType& measurement)
const = 0;
52 friend class boost::serialization::access;
53 template <
class Archive>
54 void serialize(Archive& ar,
const unsigned int file_version) {
60 template <
typename MeasurementType>
64 template <
typename MeasurementType>
67 gtsam::NonlinearFactorGraph& factors) {
68 int num_added_factors = 0;
69 this->ProcessMeasurements(
70 oldest_allowed_time, newest_allowed_time,
71 [
this, &num_added_factors](
const MeasurementType& measurement, gtsam::NonlinearFactorGraph& factors) {
72 if (!CanAddFactor(measurement))
return false;
73 num_added_factors += AddFactorsForSingleMeasurement(measurement, factors);
77 return num_added_factors;
81 #endif // FACTOR_ADDERS_SINGLE_MEASUREMENT_BASED_FACTOR_ADDER_H_