Put header-implemented unit test functions in anonymous namespaces to avoid duplicate symbols in SINGLE_TEST_EXE mode

release/4.3a0
Richard Roberts 2013-06-20 16:05:24 +00:00
parent 5ae4f21517
commit 14a71aeedc
2 changed files with 32 additions and 33 deletions

View File

@ -83,42 +83,43 @@ namespace simulated2D {
}
};
namespace {
/// Prior on a single pose
inline Point2 prior(const Point2& x) {
return x;
}
/// Prior on a single pose
inline Point2 prior(const Point2& x) {
return x;
}
/// Prior on a single pose, optionally returns derivative
Point2 prior(const Point2& x, boost::optional<Matrix&> H = boost::none) {
if (H) *H = gtsam::eye(2);
return x;
}
/// Prior on a single pose, optionally returns derivative
Point2 prior(const Point2& x, boost::optional<Matrix&> H = boost::none) {
if (H) *H = gtsam::eye(2);
return x;
}
/// odometry between two poses
inline Point2 odo(const Point2& x1, const Point2& x2) {
return x2 - x1;
}
/// odometry between two poses
inline Point2 odo(const Point2& x1, const Point2& x2) {
return x2 - x1;
}
/// odometry between two poses, optionally returns derivative
Point2 odo(const Point2& x1, const Point2& x2, boost::optional<Matrix&> H1 =
/// odometry between two poses, optionally returns derivative
Point2 odo(const Point2& x1, const Point2& x2, boost::optional<Matrix&> H1 =
boost::none, boost::optional<Matrix&> H2 = boost::none) {
if (H1) *H1 = -gtsam::eye(2);
if (H2) *H2 = gtsam::eye(2);
return x2 - x1;
}
if (H1) *H1 = -gtsam::eye(2);
if (H2) *H2 = gtsam::eye(2);
return x2 - x1;
}
/// measurement between landmark and pose
inline Point2 mea(const Point2& x, const Point2& l) {
return l - x;
}
/// measurement between landmark and pose
inline Point2 mea(const Point2& x, const Point2& l) {
return l - x;
}
/// measurement between landmark and pose, optionally returns derivative
Point2 mea(const Point2& x, const Point2& l, boost::optional<Matrix&> H1 =
/// measurement between landmark and pose, optionally returns derivative
Point2 mea(const Point2& x, const Point2& l, boost::optional<Matrix&> H1 =
boost::none, boost::optional<Matrix&> H2 = boost::none) {
if (H1) *H1 = -gtsam::eye(2);
if (H2) *H2 = gtsam::eye(2);
return l - x;
if (H1) *H1 = -gtsam::eye(2);
if (H2) *H2 = gtsam::eye(2);
return l - x;
}
}
/**

View File

@ -28,6 +28,7 @@
namespace gtsam {
namespace example {
namespace {
typedef NonlinearFactorGraph Graph;
@ -150,13 +151,9 @@ Ordering planarOrdering(size_t N);
std::pair<GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(
size_t N, const GaussianFactorGraph& original);
} // example
} // gtsam
// Implementations
namespace gtsam {
namespace example {
// using namespace gtsam::noiseModel;
@ -649,5 +646,6 @@ std::pair<GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(size_t N
/* ************************************************************************* */
} // anonymous namespace
} // \namespace example
} // \namespace gtsam