gtsam  4.0.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/assume_abstract.hpp>
25 #include <memory>
26 
27 namespace gtsam {
28 
83  class GTSAM_EXPORT Value {
84  public:
85 
87  virtual Value* clone_() const = 0;
88 
90  virtual void deallocate_() const = 0;
91 
93  virtual boost::shared_ptr<Value> clone() const = 0;
94 
96  virtual bool equals_(const Value& other, double tol = 1e-9) const = 0;
97 
99  virtual void print(const std::string& str = "") const = 0;
100 
106  virtual size_t dim() const = 0;
107 
114  virtual Value* retract_(const Vector& delta) const = 0;
115 
122  virtual Vector localCoordinates_(const Value& value) const = 0;
123 
125  virtual Value& operator=(const Value& /*rhs*/) {
126  //needs a empty definition so recursion in implicit derived assignment operators work
127  return *this;
128  }
129 
131  template<typename ValueType>
132  const ValueType& cast() const;
133 
135  virtual ~Value() {}
136 
137  private:
168  friend class boost::serialization::access;
169  template<class ARCHIVE>
170  void serialize(ARCHIVE & /*ar*/, const unsigned int /*version*/) {
171  }
172 
173  };
174 
175 } /* namespace gtsam */
176 
177 BOOST_SERIALIZATION_ASSUME_ABSTRACT(gtsam::Value)
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:140
typedef and functions to augment Eigen&#39;s VectorXd
virtual Value & operator=(const Value &)
Assignment operator.
Definition: Value.h:125
virtual ~Value()
Virutal destructor.
Definition: Value.h:135
This is the interface class for any value that may be used as a variable assignment in a factor graph...
Definition: Value.h:83
Global functions in a separate testing namespace.
Definition: chartTesting.h:28