From d4b4e99172df216fdc3e7c9149a7a5dd9cc395a2 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 11 Jul 2015 16:11:23 -0700 Subject: [PATCH] Clean up loose ends --- gtsam/sam/BearingFactor.h | 44 +++++++++++++-------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/gtsam/sam/BearingFactor.h b/gtsam/sam/BearingFactor.h index 87effa981..e34d956a4 100644 --- a/gtsam/sam/BearingFactor.h +++ b/gtsam/sam/BearingFactor.h @@ -16,20 +16,10 @@ #pragma once -#include +#include #include #include -namespace boost { -namespace serialization { - -template -void serialize(Archive& ar, gtsam::NonlinearFactor& factor, - const unsigned int version) {} - -} // namespace serialization -} // namespace boost - namespace gtsam { /** @@ -39,39 +29,35 @@ namespace gtsam { template class BearingFactor : public SerializableExpressionFactor { private: - typedef BearingFactor This; - typedef SerializableExpressionFactor Base; - - /** concept check by type */ GTSAM_CONCEPT_TESTABLE_TYPE(Measured) GTSAM_CONCEPT_POSE_TYPE(Pose) + // Return measurement expression + virtual Expression expression() const { + return Expression(Expression(this->keys_[0]), &Pose::bearing, + Expression(this->keys_[1])); + } + public: - /// Default constructor + /// default constructor BearingFactor() {} /// primary constructor - BearingFactor(Key poseKey, Key pointKey, const Measured& measured, const SharedNoiseModel& model) - : Base(model, measured) { + BearingFactor(Key poseKey, Key pointKey, const Measured& measured, + const SharedNoiseModel& model) + : SerializableExpressionFactor(model, measured) { this->keys_.push_back(poseKey); this->keys_.push_back(pointKey); this->initialize(expression()); } + /// desructor virtual ~BearingFactor() {} - /** print contents */ - void print(const std::string& s = "", - const KeyFormatter& keyFormatter = DefaultKeyFormatter) const { + /// print + void print(const std::string& s = "", const KeyFormatter& kf = DefaultKeyFormatter) const { std::cout << s << "BearingFactor" << std::endl; - Base::print(s, keyFormatter); - } - - private: - // Return an expression - virtual Expression expression() const { - return Expression(Expression(this->keys_[0]), &Pose::bearing, - Expression(this->keys_[1])); + SerializableExpressionFactor::print(s, kf); } }; // BearingFactor