fixed build with older gtsam versions

This commit is contained in:
matlabbe
2019-01-29 19:06:28 -05:00
parent 0c24786912
commit c85ff90477
3 changed files with 12 additions and 12 deletions

View File

@@ -38,10 +38,10 @@
//////////////////
namespace gtsam {
namespace rtabmap {
template<class DERIVED>
class DerivedValue : public Value {
class DerivedValue : public gtsam::Value {
protected:
DerivedValue() {}
@@ -55,7 +55,7 @@ public:
* For the sake of performance, this function use singleton pool allocator instead of the normal heap allocator.
* The result must be deleted with Value::deallocate_, not with the 'delete' operator.
*/
virtual Value* clone_() const {
virtual gtsam::Value* clone_() const {
void *place = boost::singleton_pool<PoolTag, sizeof(DERIVED)>::malloc();
DERIVED* ptr = new(place) DERIVED(static_cast<const DERIVED&>(*this));
return ptr;
@@ -72,12 +72,12 @@ public:
/**
* Clone this value (normal clone on the heap, delete with 'delete' operator)
*/
virtual boost::shared_ptr<Value> clone() const {
virtual boost::shared_ptr<gtsam::Value> clone() const {
return boost::make_shared<DERIVED>(static_cast<const DERIVED&>(*this));
}
/// equals implementing generic Value interface
virtual bool equals_(const Value& p, double tol = 1e-9) const {
virtual bool equals_(const gtsam::Value& p, double tol = 1e-9) const {
// Cast the base class Value pointer to a derived class pointer
const DERIVED& derivedValue2 = dynamic_cast<const DERIVED&>(p);
@@ -86,20 +86,20 @@ public:
}
/// Generic Value interface version of retract
virtual Value* retract_(const Vector& delta) const {
virtual gtsam::Value* retract_(const gtsam::Vector& delta) const {
// Call retract on the derived class
const DERIVED retractResult = (static_cast<const DERIVED*>(this))->retract(delta);
// Create a Value pointer copy of the result
void* resultAsValuePlace = boost::singleton_pool<PoolTag, sizeof(DERIVED)>::malloc();
Value* resultAsValue = new(resultAsValuePlace) DERIVED(retractResult);
gtsam::Value* resultAsValue = new(resultAsValuePlace) DERIVED(retractResult);
// Return the pointer to the Value base class
return resultAsValue;
}
/// Generic Value interface version of localCoordinates
virtual Vector localCoordinates_(const Value& value2) const {
virtual gtsam::Vector localCoordinates_(const gtsam::Value& value2) const {
// Cast the base class Value pointer to a derived class pointer
const DERIVED& derivedValue2 = dynamic_cast<const DERIVED&>(value2);
@@ -108,7 +108,7 @@ public:
}
/// Assignment operator
virtual Value& operator=(const Value& rhs) {
virtual gtsam::Value& operator=(const gtsam::Value& rhs) {
// Cast the base class Value pointer to a derived class pointer
const DERIVED& derivedRhs = dynamic_cast<const DERIVED&>(rhs);

View File

@@ -10,7 +10,7 @@
#pragma once
// DerivedValue.h removed from gtsam repo (Dec 2018): https://github.com/borglab/gtsam/commit/e550f4f2aec423cb3f2791b81cb5858b8826ebac
// DerivedValue2.h removed from gtsam repo (Dec 2018): https://github.com/borglab/gtsam/commit/e550f4f2aec423cb3f2791b81cb5858b8826ebac
#include "DerivedValue.h"
#include <gtsam/base/Lie.h>
@@ -19,7 +19,7 @@ namespace vertigo {
/**
* SwitchVariableLinear is a wrapper around double to allow it to be a Lie type
*/
struct SwitchVariableLinear : public gtsam::DerivedValue<SwitchVariableLinear> {
struct SwitchVariableLinear : public rtabmap::DerivedValue<SwitchVariableLinear> {
/** default constructor */
SwitchVariableLinear() : d_(0.0) {};

View File

@@ -19,7 +19,7 @@ namespace vertigo {
/**
* SwitchVariableSigmoid is a wrapper around double to allow it to be a Lie type
*/
struct SwitchVariableSigmoid : public gtsam::DerivedValue<SwitchVariableSigmoid> {
struct SwitchVariableSigmoid : public rtabmap::DerivedValue<SwitchVariableSigmoid> {
/** default constructor */
SwitchVariableSigmoid() : d_(10.0) {};