25 #include <boost/make_shared.hpp> 26 #include <boost/pool/pool_alloc.hpp> 85 virtual void print(
const std::string& str)
const {
86 std::cout <<
"(" <<
typeid(T).name() <<
") ";
96 void *place = boost::singleton_pool<PoolTag, sizeof(GenericValue)>::malloc();
106 boost::singleton_pool<PoolTag, sizeof(GenericValue)>::free((
void*)
this);
112 virtual boost::shared_ptr<Value>
clone()
const {
113 return boost::make_shared<GenericValue>(*this);
122 void* resultAsValuePlace =
123 boost::singleton_pool<PoolTag, sizeof(GenericValue)>::malloc();
127 return resultAsValue;
151 virtual size_t dim()
const {
184 friend class boost::serialization::access;
185 template<
class ARCHIVE>
186 void serialize(ARCHIVE & ar,
const unsigned int ) {
187 ar & boost::serialization::make_nvp(
"GenericValue",
188 boost::serialization::base_object<Value>(*
this));
189 ar & boost::serialization::make_nvp(
"value", value_);
193 #define GTSAM_VALUE_EXPORT(Type) BOOST_CLASS_EXPORT(GenericValue<Type>) 198 template <
typename ValueType>
200 :
public Testable<GenericValue<ValueType> > {};
203 template<
typename ValueType>
virtual Value * retract_(const Vector &delta) const
Generic Value interface version of retract.
Definition: GenericValue.h:117
virtual Vector localCoordinates_(const Value &value2) const
Generic Value interface version of localCoordinates.
Definition: GenericValue.h:131
const ValueType & cast() const
Cast to known ValueType.
Definition: GenericValue.h:204
Vector localCoordinates(const GenericValue &value2) const
Non-virtual version of localCoordinates.
Definition: GenericValue.h:146
virtual size_t dim() const
Return run-time dimensionality.
Definition: GenericValue.h:151
const T & value() const
Return a constant value.
Definition: GenericValue.h:58
bool equals(const GenericValue &other, double tol=1e-9) const
non virtual equals function, uses traits
Definition: GenericValue.h:80
virtual Value * clone_() const
Create a duplicate object returned as a pointer to the generic Value interface.
Definition: GenericValue.h:95
Wraps any type T so it can play as a Value.
Definition: GenericValue.h:38
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
T value_
The wrapped value.
Definition: GenericValue.h:46
virtual Value & operator=(const Value &rhs)
Assignment operator.
Definition: GenericValue.h:156
Base class and basic functions for Manifold types.
GenericValue(const T &value)
Construct from value.
Definition: GenericValue.h:53
T & value()
Return the value.
Definition: GenericValue.h:63
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
GenericValue retract(const Vector &delta) const
Non-virtual version of retract.
Definition: GenericValue.h:141
virtual boost::shared_ptr< Value > clone() const
Clone this value (normal clone on the heap, delete with 'delete' operator)
Definition: GenericValue.h:112
virtual ~GenericValue()
Destructor.
Definition: GenericValue.h:68
virtual bool equals_(const Value &p, double tol=1e-9) const
equals implementing generic Value interface
Definition: GenericValue.h:72
virtual void print(const std::string &str) const
Virtual print function, uses traits.
Definition: GenericValue.h:85
virtual void deallocate_() const
Destroy and deallocate this object, only if it was originally allocated using clone_().
Definition: GenericValue.h:104
The interface class for any variable that can be optimized or used in a factor.
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