gtsam 4.2.0
gtsam
Value.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
19#pragma once
20
21#include <gtsam/config.h> // Configuration from CMake
22
23#include <gtsam/base/Vector.h>
24#include <boost/serialization/nvp.hpp>
25#include <boost/serialization/assume_abstract.hpp>
26#include <memory>
27
28namespace gtsam {
29
37 class GTSAM_EXPORT Value {
38 public:
39
41 virtual Value* clone_() const = 0;
42
44 virtual void deallocate_() const = 0;
45
47 virtual boost::shared_ptr<Value> clone() const = 0;
48
50 virtual bool equals_(const Value& other, double tol = 1e-9) const = 0;
51
53 virtual void print(const std::string& str = "") const = 0;
54
60 virtual size_t dim() const = 0;
61
68 virtual Value* retract_(const Vector& delta) const = 0;
69
76 virtual Vector localCoordinates_(const Value& value) const = 0;
77
79 virtual Value& operator=(const Value& /*rhs*/) {
80 //needs a empty definition so recursion in implicit derived assignment operators work
81 return *this;
82 }
83
85 template<typename ValueType>
86 const ValueType& cast() const;
87
89 virtual ~Value() {}
90
91 private:
122 friend class boost::serialization::access;
123 template<class ARCHIVE>
124 void serialize(ARCHIVE & /*ar*/, const unsigned int /*version*/) {
125 }
126
127 };
128
129} /* namespace gtsam */
130
131BOOST_SERIALIZATION_ASSUME_ABSTRACT(gtsam::Value)
typedef and functions to augment Eigen's VectorXd
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:113
This is the base class for any type to be stored in Values.
Definition: Value.h:37
virtual size_t dim() const =0
Return the dimensionality of the tangent space of this value.
virtual Value * retract_(const Vector &delta) const =0
Increment the value, by mapping from the vector delta in the tangent space of the current value back ...
virtual void deallocate_() const =0
Deallocate a raw pointer of this value.
virtual ~Value()
Virutal destructor.
Definition: Value.h:89
virtual bool equals_(const Value &other, double tol=1e-9) const =0
Compare this Value with another for equality.
virtual Vector localCoordinates_(const Value &value) const =0
Compute the coordinates in the tangent space of this value that retract() would map to value.
virtual Value & operator=(const Value &)
Assignment operator.
Definition: Value.h:79
virtual void print(const std::string &str="") const =0
Print this value, for debugging and unit tests.
virtual Value * clone_() const =0
Clone this value in a special memory pool, must be deleted with Value::deallocate_,...
virtual boost::shared_ptr< Value > clone() const =0
Clone this value (normal clone on the heap, delete with 'delete' operator)