Skip to content

Commit

Permalink
Small enhancements to Measurement struct (#486)
Browse files Browse the repository at this point in the history
These changes are to support the PIC approximation.
  • Loading branch information
peddie authored Jun 21, 2024
1 parent 544b2de commit 92f3a99
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/albatross/src/covariance_functions/measurement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ template <typename X> struct Measurement {
X value;
};

template <typename X>
std::ostream &operator<<(std::ostream &os, const Measurement<X> &m) {
return os << "Meas[" << m.value << "]";
}

// A simple helper function which aids the compiler with type deduction.
template <typename FeatureType>
Measurement<FeatureType> as_measurement(const FeatureType &f) {
Expand Down Expand Up @@ -110,6 +115,16 @@ MeasurementOnly<SubCovariance> measurement_only(const SubCovariance &cov) {
return MeasurementOnly<SubCovariance>(cov);
}

template <typename T> T without_measurement(Measurement<T> &&m) {
return m.value;
}
template <typename T> const T &without_measurement(const Measurement<T> &m) {
return m.value;
}

template <typename T> T without_measurement(T &&t) { return t; }
template <typename T> const T &without_measurement(const T &t) { return t; }

} // namespace albatross

#endif /* INCLUDE_ALBATROSS_SRC_COVARIANCE_FUNCTIONS_MEASUREMENT_HPP_ */

0 comments on commit 92f3a99

Please sign in to comment.