Trying to make everything compile for a smooth transition

release/4.3a0
Paul Furgale 2014-12-12 20:13:35 +01:00
parent 02ceb1366b
commit d383b44cc6
3 changed files with 20 additions and 5 deletions

View File

@ -18,7 +18,7 @@
namespace gtsam {
template <typename T> struct traits_x {};
/**
* @name Algebraic Structure Tags
@ -35,6 +35,19 @@ struct vector_space_tag: public lie_group_tag {};
struct multiplicative_group_tag {};
struct additive_group_tag {};
// TODO: Remove
namespace traits {
template<typename T>
struct dimension;
}
template <typename T> struct traits_x {
// todo: remove anything in here ASAP.
// This is just here during development to avoid compilation
// errors while implmenting traits for everything.
enum { dimension = traits::dimension<T>::value };
typedef manifold_tag structure_category;
};
namespace internal {

View File

@ -28,6 +28,7 @@
#pragma GCC diagnostic pop
#endif
#include <gtsam/base/concepts.h>
#include <gtsam/base/Matrix.h>
#include <gtsam/base/Manifold.h>
#include <gtsam/linear/VectorValues.h>
@ -110,12 +111,12 @@ Matrix numericalDerivative11(boost::function<Y(const X&)> h, const X& x,
double delta = 1e-5) {
using namespace traits;
BOOST_STATIC_ASSERT_MSG(traits::is_manifold<Y>::value,
BOOST_STATIC_ASSERT_MSG( (typename boost::is_same< typename traits_x<X>::structure_category, gtsam::manifold_tag>::value),
"Template argument Y must be a manifold type.");
typedef DefaultChart<Y> ChartY;
typedef typename ChartY::vector TangentY;
BOOST_STATIC_ASSERT_MSG(traits::is_manifold<X>::value,
BOOST_STATIC_ASSERT_MSG( (typename boost::is_same<traits_x<X>::structure_category, gtsam::manifold_tag>::value),
"Template argument X must be a manifold type.");
static const int N = traits::dimension<X>::value;
BOOST_STATIC_ASSERT_MSG(N>0, "Template argument X must be fixed-size type.");

View File

@ -21,6 +21,7 @@
#include <gtsam_unstable/nonlinear/CallRecord.h>
#include <gtsam/nonlinear/Values.h>
#include <gtsam/base/concepts.h>
#include <gtsam/base/Testable.h>
#include <gtsam/base/Manifold.h>
#include <gtsam/base/OptionalJacobian.h>
@ -143,7 +144,7 @@ void handleLeafCase(const Eigen::MatrixBase<Derived>& dTdA,
*/
template<class T>
class ExecutionTrace {
static const int Dim = traits::dimension<T>::value;
static const int Dim = traits_x<T>::dimension;
enum {
Constant, Leaf, Function
} kind;
@ -624,7 +625,7 @@ struct FunctionalNode {
/// Provide convenience access to Record storage and implement
/// the virtual function based interface of CallRecord using the CallRecordImplementor
struct Record: public internal::CallRecordImplementor<Record,
traits::dimension<T>::value>, public Base::Record {
traits_x<T>::dimension>, public Base::Record {
using Base::Record::print;
using Base::Record::startReverseAD4;
using Base::Record::reverseAD4;