Merge pull request #934 from borglab/feature/deprecation_macro

Add deprecations
release/4.3a0
Fan Jiang 2021-11-22 19:22:59 -05:00 committed by GitHub
commit 58d4c05ff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 16 deletions

View File

@ -85,7 +85,7 @@ bool assert_equal(const V& expected, const boost::optional<const V&>& actual, do
* \deprecated: use container equals instead * \deprecated: use container equals instead
*/ */
template<class V> template<class V>
bool assert_equal(const std::vector<V>& expected, const std::vector<V>& actual, double tol = 1e-9) { bool GTSAM_DEPRECATED assert_equal(const std::vector<V>& expected, const std::vector<V>& actual, double tol = 1e-9) {
bool match = true; bool match = true;
if (expected.size() != actual.size()) if (expected.size() != actual.size())
match = false; match = false;

View File

@ -207,14 +207,14 @@ inline double inner_prod(const V1 &a, const V2& b) {
* BLAS Level 1 scal: x <- alpha*x * BLAS Level 1 scal: x <- alpha*x
* \deprecated: use operators instead * \deprecated: use operators instead
*/ */
inline void scal(double alpha, Vector& x) { x *= alpha; } inline void GTSAM_DEPRECATED scal(double alpha, Vector& x) { x *= alpha; }
/** /**
* BLAS Level 1 axpy: y <- alpha*x + y * BLAS Level 1 axpy: y <- alpha*x + y
* \deprecated: use operators instead * \deprecated: use operators instead
*/ */
template<class V1, class V2> template<class V1, class V2>
inline void axpy(double alpha, const V1& x, V2& y) { inline void GTSAM_DEPRECATED axpy(double alpha, const V1& x, V2& y) {
assert (y.size()==x.size()); assert (y.size()==x.size());
y += alpha * x; y += alpha * x;
} }

View File

@ -34,6 +34,14 @@
#include <tbb/scalable_allocator.h> #include <tbb/scalable_allocator.h>
#endif #endif
#if defined(__GNUC__) || defined(__clang__)
#define GTSAM_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define GTSAM_DEPRECATED __declspec(deprecated)
#else
#define GTSAM_DEPRECATED
#endif
#ifdef GTSAM_USE_EIGEN_MKL_OPENMP #ifdef GTSAM_USE_EIGEN_MKL_OPENMP
#include <omp.h> #include <omp.h>
#endif #endif

View File

@ -35,7 +35,7 @@ using namespace std;
namespace gtsam { namespace gtsam {
// Instantiate base class // Instantiate base class
template class Conditional<DecisionTreeFactor, DiscreteConditional> ; template class GTSAM_EXPORT Conditional<DecisionTreeFactor, DiscreteConditional> ;
/* ******************************************************************************** */ /* ******************************************************************************** */
DiscreteConditional::DiscreteConditional(const size_t nrFrontals, DiscreteConditional::DiscreteConditional(const size_t nrFrontals,

View File

@ -290,7 +290,7 @@ namespace gtsam {
public: public:
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41
/** \deprecated ordering and orderingType shouldn't both be specified */ /** \deprecated ordering and orderingType shouldn't both be specified */
boost::shared_ptr<BayesNetType> eliminateSequential( boost::shared_ptr<BayesNetType> GTSAM_DEPRECATED eliminateSequential(
const Ordering& ordering, const Ordering& ordering,
const Eliminate& function, const Eliminate& function,
OptionalVariableIndex variableIndex, OptionalVariableIndex variableIndex,
@ -299,7 +299,7 @@ namespace gtsam {
} }
/** \deprecated orderingType specified first for consistency */ /** \deprecated orderingType specified first for consistency */
boost::shared_ptr<BayesNetType> eliminateSequential( boost::shared_ptr<BayesNetType> GTSAM_DEPRECATED eliminateSequential(
const Eliminate& function, const Eliminate& function,
OptionalVariableIndex variableIndex = boost::none, OptionalVariableIndex variableIndex = boost::none,
OptionalOrderingType orderingType = boost::none) const { OptionalOrderingType orderingType = boost::none) const {
@ -307,7 +307,7 @@ namespace gtsam {
} }
/** \deprecated ordering and orderingType shouldn't both be specified */ /** \deprecated ordering and orderingType shouldn't both be specified */
boost::shared_ptr<BayesTreeType> eliminateMultifrontal( boost::shared_ptr<BayesTreeType> GTSAM_DEPRECATED eliminateMultifrontal(
const Ordering& ordering, const Ordering& ordering,
const Eliminate& function, const Eliminate& function,
OptionalVariableIndex variableIndex, OptionalVariableIndex variableIndex,
@ -316,7 +316,7 @@ namespace gtsam {
} }
/** \deprecated orderingType specified first for consistency */ /** \deprecated orderingType specified first for consistency */
boost::shared_ptr<BayesTreeType> eliminateMultifrontal( boost::shared_ptr<BayesTreeType> GTSAM_DEPRECATED eliminateMultifrontal(
const Eliminate& function, const Eliminate& function,
OptionalVariableIndex variableIndex = boost::none, OptionalVariableIndex variableIndex = boost::none,
OptionalOrderingType orderingType = boost::none) const { OptionalOrderingType orderingType = boost::none) const {
@ -324,7 +324,7 @@ namespace gtsam {
} }
/** \deprecated */ /** \deprecated */
boost::shared_ptr<BayesNetType> marginalMultifrontalBayesNet( boost::shared_ptr<BayesNetType> GTSAM_DEPRECATED marginalMultifrontalBayesNet(
boost::variant<const Ordering&, const KeyVector&> variables, boost::variant<const Ordering&, const KeyVector&> variables,
boost::none_t, boost::none_t,
const Eliminate& function = EliminationTraitsType::DefaultEliminate, const Eliminate& function = EliminationTraitsType::DefaultEliminate,
@ -333,7 +333,7 @@ namespace gtsam {
} }
/** \deprecated */ /** \deprecated */
boost::shared_ptr<BayesTreeType> marginalMultifrontalBayesTree( boost::shared_ptr<BayesTreeType> GTSAM_DEPRECATED marginalMultifrontalBayesTree(
boost::variant<const Ordering&, const KeyVector&> variables, boost::variant<const Ordering&, const KeyVector&> variables,
boost::none_t, boost::none_t,
const Eliminate& function = EliminationTraitsType::DefaultEliminate, const Eliminate& function = EliminationTraitsType::DefaultEliminate,

View File

@ -305,7 +305,7 @@ struct traits<ExpressionFactorN<T, Args...>>
* \deprecated Prefer the more general ExpressionFactorN<>. * \deprecated Prefer the more general ExpressionFactorN<>.
*/ */
template <typename T, typename A1, typename A2> template <typename T, typename A1, typename A2>
class ExpressionFactor2 : public ExpressionFactorN<T, A1, A2> { class GTSAM_DEPRECATED ExpressionFactor2 : public ExpressionFactorN<T, A1, A2> {
public: public:
/// Destructor /// Destructor
~ExpressionFactor2() override {} ~ExpressionFactor2() override {}

View File

@ -133,15 +133,15 @@ protected:
public: public:
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41
/** \deprecated argument order changed due to removing boost::optional<Ordering> */ /** \deprecated argument order changed due to removing boost::optional<Ordering> */
Marginals(const NonlinearFactorGraph& graph, const Values& solution, Factorization factorization, GTSAM_DEPRECATED Marginals(const NonlinearFactorGraph& graph, const Values& solution, Factorization factorization,
const Ordering& ordering) : Marginals(graph, solution, ordering, factorization) {} const Ordering& ordering) : Marginals(graph, solution, ordering, factorization) {}
/** \deprecated argument order changed due to removing boost::optional<Ordering> */ /** \deprecated argument order changed due to removing boost::optional<Ordering> */
Marginals(const GaussianFactorGraph& graph, const Values& solution, Factorization factorization, GTSAM_DEPRECATED Marginals(const GaussianFactorGraph& graph, const Values& solution, Factorization factorization,
const Ordering& ordering) : Marginals(graph, solution, ordering, factorization) {} const Ordering& ordering) : Marginals(graph, solution, ordering, factorization) {}
/** \deprecated argument order changed due to removing boost::optional<Ordering> */ /** \deprecated argument order changed due to removing boost::optional<Ordering> */
Marginals(const GaussianFactorGraph& graph, const VectorValues& solution, Factorization factorization, GTSAM_DEPRECATED Marginals(const GaussianFactorGraph& graph, const VectorValues& solution, Factorization factorization,
const Ordering& ordering) : Marginals(graph, solution, ordering, factorization) {} const Ordering& ordering) : Marginals(graph, solution, ordering, factorization) {}
#endif #endif

View File

@ -267,12 +267,12 @@ namespace gtsam {
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41
/** \deprecated */ /** \deprecated */
boost::shared_ptr<HessianFactor> linearizeToHessianFactor( boost::shared_ptr<HessianFactor> GTSAM_DEPRECATED linearizeToHessianFactor(
const Values& values, boost::none_t, const Dampen& dampen = nullptr) const const Values& values, boost::none_t, const Dampen& dampen = nullptr) const
{return linearizeToHessianFactor(values, dampen);} {return linearizeToHessianFactor(values, dampen);}
/** \deprecated */ /** \deprecated */
Values updateCholesky(const Values& values, boost::none_t, Values GTSAM_DEPRECATED updateCholesky(const Values& values, boost::none_t,
const Dampen& dampen = nullptr) const const Dampen& dampen = nullptr) const
{return updateCholesky(values, dampen);} {return updateCholesky(values, dampen);}
#endif #endif