From 32b3eebf074073a5cfc0ea2a33c1687f0733b6d5 Mon Sep 17 00:00:00 2001 From: Chris Beall Date: Wed, 8 May 2013 19:21:00 +0000 Subject: [PATCH] removed redundant shared_ptr typedefs in Cal3_S2 and Cal3_S2Stereo --- examples/CameraResectioning.cpp | 10 +++++----- gtsam/geometry/Cal3_S2.h | 6 +----- gtsam/geometry/Cal3_S2Stereo.h | 5 +---- gtsam/slam/StereoFactor.h | 10 +++++----- gtsam_unstable/slam/InvDepthFactor3.h | 2 +- matlab.h | 3 ++- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/examples/CameraResectioning.cpp b/examples/CameraResectioning.cpp index e024d832c..9ba415b7d 100644 --- a/examples/CameraResectioning.cpp +++ b/examples/CameraResectioning.cpp @@ -32,15 +32,15 @@ using symbol_shorthand::X; class ResectioningFactor: public NoiseModelFactor1 { typedef NoiseModelFactor1 Base; - shared_ptrK K_; // camera's intrinsic parameters - Point3 P_; // 3D point on the calibration rig - Point2 p_; // 2D measurement of the 3D point + Cal3_S2::shared_ptr K_; ///< camera's intrinsic parameters + Point3 P_; ///< 3D point on the calibration rig + Point2 p_; ///< 2D measurement of the 3D point public: /// Construct factor given known point P and its projection p ResectioningFactor(const SharedNoiseModel& model, const Key& key, - const shared_ptrK& calib, const Point2& p, const Point3& P) : + const Cal3_S2::shared_ptr& calib, const Point2& p, const Point3& P) : Base(model, key), K_(calib), P_(P), p_(p) { } @@ -63,7 +63,7 @@ public: *******************************************************************************/ int main(int argc, char* argv[]) { /* read camera intrinsic parameters */ - shared_ptrK calib(new Cal3_S2(1, 1, 0, 50, 50)); + Cal3_S2::shared_ptr calib(new Cal3_S2(1, 1, 0, 50, 50)); /* 1. create graph */ NonlinearFactorGraph graph; diff --git a/gtsam/geometry/Cal3_S2.h b/gtsam/geometry/Cal3_S2.h index 67e268526..660774180 100644 --- a/gtsam/geometry/Cal3_S2.h +++ b/gtsam/geometry/Cal3_S2.h @@ -187,8 +187,4 @@ namespace gtsam { }; - - - typedef boost::shared_ptr shared_ptrK; ///< shared pointer to calibration object - -} // gtsam +} // \ namespace gtsam diff --git a/gtsam/geometry/Cal3_S2Stereo.h b/gtsam/geometry/Cal3_S2Stereo.h index 9eb860435..58fa1cd2d 100644 --- a/gtsam/geometry/Cal3_S2Stereo.h +++ b/gtsam/geometry/Cal3_S2Stereo.h @@ -111,7 +111,4 @@ namespace gtsam { /// @} }; - - typedef boost::shared_ptr shared_ptrKStereo; ///< shared pointer to stereo calibration object - -} +} // \ namespace gtsam diff --git a/gtsam/slam/StereoFactor.h b/gtsam/slam/StereoFactor.h index 0d5d71602..b4a50ad14 100644 --- a/gtsam/slam/StereoFactor.h +++ b/gtsam/slam/StereoFactor.h @@ -33,16 +33,16 @@ private: // Keep a copy of measurement and calibration for I/O StereoPoint2 measured_; ///< the measurement - boost::shared_ptr K_; ///< shared pointer to calibration - boost::optional body_P_sensor_; ///< The pose of the sensor in the body frame + Cal3_S2Stereo::shared_ptr K_; ///< shared pointer to calibration + boost::optional body_P_sensor_; ///< The pose of the sensor in the body frame public: // shorthand for base class type - typedef NoiseModelFactor2 Base; ///< typedef for base class + typedef NoiseModelFactor2 Base; ///< typedef for base class typedef GenericStereoFactor This; ///< typedef for this class (with templates) typedef boost::shared_ptr shared_ptr; ///< typedef for shared pointer to this object - typedef POSE CamPose; ///< typedef for Pose Lie Value type + typedef POSE CamPose; ///< typedef for Pose Lie Value type /** * Default constructor @@ -58,7 +58,7 @@ public: * @param K the constant calibration */ GenericStereoFactor(const StereoPoint2& measured, const SharedNoiseModel& model, - Key poseKey, Key landmarkKey, const shared_ptrKStereo& K, + Key poseKey, Key landmarkKey, const Cal3_S2Stereo::shared_ptr& K, boost::optional body_P_sensor = boost::none) : Base(model, poseKey, landmarkKey), measured_(measured), K_(K), body_P_sensor_(body_P_sensor) { } diff --git a/gtsam_unstable/slam/InvDepthFactor3.h b/gtsam_unstable/slam/InvDepthFactor3.h index 4b28a84d5..3cd87b8d2 100644 --- a/gtsam_unstable/slam/InvDepthFactor3.h +++ b/gtsam_unstable/slam/InvDepthFactor3.h @@ -56,7 +56,7 @@ public: * @param K shared pointer to the constant calibration */ InvDepthFactor3(const gtsam::Point2& measured, const gtsam::SharedNoiseModel& model, - const gtsam::Key poseKey, gtsam::Key pointKey, gtsam::Key invDepthKey, const gtsam::shared_ptrK& K) : + const gtsam::Key poseKey, gtsam::Key pointKey, gtsam::Key invDepthKey, const Cal3_S2::shared_ptr& K) : Base(model, poseKey, pointKey, invDepthKey), measured_(measured), K_(K) {} /** Virtual destructor */ diff --git a/matlab.h b/matlab.h index c7017dc97..6c2b137d7 100644 --- a/matlab.h +++ b/matlab.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -114,7 +115,7 @@ namespace gtsam { /// insert multiple projection factors for a single pose key void insertProjectionFactors(NonlinearFactorGraph& graph, Key i, const Vector& J, const Matrix& Z, - const SharedNoiseModel& model, const shared_ptrK K, const Pose3& body_P_sensor = Pose3()) { + const SharedNoiseModel& model, const Cal3_S2::shared_ptr K, const Pose3& body_P_sensor = Pose3()) { if (Z.rows() != 2) throw std::invalid_argument("addMeasurements: Z must be 2*K"); if (Z.cols() != J.size()) throw std::invalid_argument( "addMeasurements: J and Z must have same number of entries");