21 #include <boost/make_shared.hpp>
25 #include <boost/pool/singleton_pool.hpp>
43 template<
class DERIVED>
59 void *place = boost::singleton_pool<PoolTag,
sizeof(DERIVED)>::malloc();
60 DERIVED* ptr =
new(place) DERIVED(
static_cast<const DERIVED&
>(*
this));
69 boost::singleton_pool<PoolTag,
sizeof(DERIVED)>::free((
void*)
this);
75 #if GTSAM_VERSION_NUMERIC >= 40300
76 virtual std::shared_ptr<gtsam::Value>
clone()
const {
77 return std::make_shared<DERIVED>(
static_cast<const DERIVED&
>(*
this));
81 return boost::make_shared<DERIVED>(
static_cast<const DERIVED&
>(*
this));
88 const DERIVED& derivedValue2 =
dynamic_cast<const DERIVED&
>(
p);
91 return (
static_cast<const DERIVED*
>(
this))->equals(derivedValue2,
tol);
97 const DERIVED retractResult = (
static_cast<const DERIVED*
>(
this))->retract(
delta);
100 void* resultAsValuePlace = boost::singleton_pool<PoolTag,
sizeof(DERIVED)>::malloc();
101 gtsam::Value* resultAsValue =
new(resultAsValuePlace) DERIVED(retractResult);
104 return resultAsValue;
110 const DERIVED& derivedValue2 =
dynamic_cast<const DERIVED&
>(value2);
113 return (
static_cast<const DERIVED*
>(
this))->localCoordinates(derivedValue2);
119 const DERIVED& derivedRhs =
dynamic_cast<const DERIVED&
>(rhs);
122 return (
static_cast<DERIVED*
>(
this))->
operator=(derivedRhs);
126 operator const DERIVED& ()
const {
127 return static_cast<const DERIVED&
>(*this);
131 operator DERIVED& () {
132 return static_cast<DERIVED&
>(*this);