19 #ifndef NODES_VALUES_H_
20 #define NODES_VALUES_H_
24 #include <gtsam/base/serialization.h>
25 #include <gtsam/nonlinear/Values.h>
27 #include <boost/optional.hpp>
35 explicit Values(std::shared_ptr<gtsam::Values> values = std::make_shared<gtsam::Values>());
37 template <
typename ValueType>
38 boost::optional<ValueType>
Value(
const gtsam::Key& key)
const;
41 template <
typename ValueType>
42 gtsam::Key
Add(
const ValueType& value);
44 bool Remove(
const gtsam::Key& key);
47 bool Remove(
const gtsam::KeyVector& keys);
49 bool Contains(
const gtsam::Key& key)
const;
59 template <
class ARCHIVE>
60 void serialize(ARCHIVE& ar,
const unsigned int );
62 std::shared_ptr<gtsam::Values> values_;
63 gtsam::Key latest_key_;
67 template <
typename ValueType>
70 return values_->at<ValueType>(key);
76 template <
typename ValueType>
80 values_->insert(++latest_key_, value);
84 template <
class ARCHIVE>
85 void Values::serialize(ARCHIVE& ar,
const unsigned int ) {
86 ar& BOOST_SERIALIZATION_NVP(values_);
87 ar& BOOST_SERIALIZATION_NVP(latest_key_);
91 #endif // NODES_VALUES_H_