25 #include <boost/make_shared.hpp> 26 #include <boost/pool/pool_alloc.hpp> 74 const GenericValue& genericValue2 = static_cast<const GenericValue&>(p);
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::allocate_shared<GenericValue>(Eigen::aligned_allocator<GenericValue>(), *
this);
122 void* resultAsValuePlace =
123 boost::singleton_pool<PoolTag,
sizeof(
GenericValue)>::malloc();
127 return resultAsValue;
151 virtual size_t dim()
const {
158 const GenericValue& derivedRhs = static_cast<const GenericValue&>(rhs);
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_);
194 enum { NeedsToAlign = (
sizeof(T) % 16) == 0 };
196 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
200 #define GTSAM_VALUE_EXPORT(Type) BOOST_CLASS_EXPORT(gtsam::GenericValue<Type>) 203 template <
typename ValueType>
205 :
public Testable<GenericValue<ValueType> > {};
208 template<
typename ValueType>
The base class for any variable that can be optimized or used in a factor.
virtual Value * clone_() const
Create a duplicate object returned as a pointer to the generic Value interface.
Definition: GenericValue.h:95
Base class and basic functions for Manifold types.
Vector localCoordinates(const GenericValue &value2) const
Non-virtual version of localCoordinates.
Definition: GenericValue.h:146
virtual void print(const std::string &str) const
Virtual print function, uses traits.
Definition: GenericValue.h:85
This is the base class for any type to be stored in Values.
Definition: Value.h:36
bool equals(const GenericValue &other, double tol=1e-9) const
non virtual equals function, uses traits
Definition: GenericValue.h:80
const T & value() const
Return a constant value.
Definition: GenericValue.h:58
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
const ValueType & cast() const
Cast to known ValueType.
Definition: GenericValue.h:209
virtual void deallocate_() const
Destroy and deallocate this object, only if it was originally allocated using clone_().
Definition: GenericValue.h:104
GenericValue retract(const Vector &delta) const
Non-virtual version of retract.
Definition: GenericValue.h:141
Wraps any type T so it can play as a Value.
Definition: GenericValue.h:38
virtual size_t dim() const
Return run-time dimensionality.
Definition: GenericValue.h:151
virtual Value & operator=(const Value &)
Assignment operator.
Definition: Value.h:78
virtual ~GenericValue()
Destructor.
Definition: GenericValue.h:68
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
T value_
The wrapped value.
Definition: GenericValue.h:46
friend class boost::serialization::access
Serialization function.
Definition: GenericValue.h:184
GenericValue(const T &value)
Construct from value.
Definition: GenericValue.h:53
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
virtual bool equals_(const Value &p, double tol=1e-9) const
equals implementing generic Value interface
Definition: GenericValue.h:72
virtual Value * retract_(const Vector &delta) const
Generic Value interface version of retract.
Definition: GenericValue.h:117
GenericValue< T > & operator=(const GenericValue< T > &rhs)
Assignment operator, protected because only the Value or DERIVED assignment operators should be used.
Definition: GenericValue.h:169
virtual Vector localCoordinates_(const Value &value2) const
Generic Value interface version of localCoordinates.
Definition: GenericValue.h:131
virtual Value & operator=(const Value &rhs)
Assignment operator.
Definition: GenericValue.h:156
virtual boost::shared_ptr< Value > clone() const
Clone this value (normal clone on the heap, delete with 'delete' operator)
Definition: GenericValue.h:112