29 #pragma GCC diagnostic push 30 #pragma GCC diagnostic ignored "-Wunused-variable" 32 #include <boost/bind.hpp> 34 #pragma GCC diagnostic pop 36 #include <boost/iterator/transform_iterator.hpp> 57 for (
const auto &kv : init)
66 if (it != delta.
end()) {
68 Value* retractedValue(key_value->value.retract_(v));
69 values_.insert(key, retractedValue);
71 values_.insert(key, key_value->value.clone_());
78 cout << str << (str.empty() ?
"" :
"\n");
79 cout <<
"Values with " <<
size() <<
" values:\n";
81 cout <<
"Value " << keyFormatter(key_value->key) <<
": ";
82 key_value->value.print(
"");
92 it1 != this->
end(); ++it1, ++it2) {
93 const Value& value1 = it1->value;
94 const Value& value2 = it2->value;
95 if (
typeid(value1) !=
typeid(value2) || it1->key != it2->key
96 || !value1.
equals_(value2, tol)) {
110 return Values(*
this, delta);
119 if(it1->key != it2->key)
123 result.
insert(it1->key, it1->value.localCoordinates_(it2->value));
131 KeyValueMap::const_iterator item =
values_.find(j);
136 return *item->second;
141 std::pair<iterator,bool> insertResult =
tryInsert(j, val);
142 if(!insertResult.second)
150 insert(key, key_value->value);
157 return std::make_pair(boost::make_transform_iterator(result.first, &
make_deref_pair), result.second);
163 KeyValueMap::iterator item =
values_.find(j);
168 const Value& old_value = *item->second;
169 if (
typeid(old_value) !=
typeid(val))
178 this->
update(key_value->key, key_value->value);
184 KeyValueMap::iterator item =
values_.find(j);
193 result.reserve(
size());
195 result.push_back(key_value->key);
209 for(
const auto key_value: *
this) {
210 result += key_value.value.dim();
218 for(
const auto key_value: *
this)
219 result.
insert(key_value.key, Vector::Zero(key_value.value.dim()));
227 "Attempting to add a key-value pair with key \"" +
DefaultKeyFormatter(key_) +
"\", key already exists.";
228 return message_.c_str();
235 "Attempting to " + std::string(operation_) +
" the key \"" +
237 return message_.c_str();
242 if(message_.empty()) {
243 std::string storedTypeName =
demangle(storedTypeId_.name());
244 std::string requestedTypeName =
demangle(requestedTypeId_.name());
246 if (storedTypeName == requestedTypeName) {
247 message_ =
"WARNING: Detected types with same name but different `typeid`. \ 248 This is usually caused by incorrect linking/inlining settings when compiling libraries using GTSAM. \ 249 If you are a user, please report to the author of the library using GTSAM. \ 250 If you are a package maintainer, please consult `cmake/GtsamPybindWrap.cmake`, line 74 for details.";
253 "Attempting to retrieve value with key \"" +
DefaultKeyFormatter(key_) +
"\", type stored in Values is " +
254 storedTypeName +
" but requested type was " + requestedTypeName;
257 return message_.c_str();
262 if(message_.empty()) {
265 <<
"Attempting to retrieve fixed-size matrix with dimensions " 267 <<
", but found dynamic Matrix with mismatched dimensions " 268 << M2_ <<
"x" << N2_;
269 message_ = oss.str();
271 return message_.c_str();
virtual bool equals_(const Value &other, double tol=1e-9) const =0
A non-templated config holding any types of Manifold-group elements.
VectorValues zeroVectors() const
void insert(Key j, const Value &val)
GTSAM_EXPORT const char * what() const noexceptoverride
The message to be displayed to the user.
virtual Value * clone_() const =0
iterator end()
Iterator over variables.
Values retract(const VectorValues &delta) const
static const KeyFormatter DefaultKeyFormatter
bool equals(const Values &other, double tol=1e-9) const
detail::enable_if_t<!detail::move_never< T >::value, T > move(object &&obj)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
GTSAM_EXPORT const char * what() const noexceptoverride
const ValueType at(Key j) const
std::string demangle(const char *name)
Pretty print Value type name.
const_iterator end() const
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
boost::transform_iterator< boost::function1< ConstKeyValuePair, const ConstKeyValuePtrPair & >, KeyValueMap::const_iterator > const_iterator
Const forward iterator, with value type ConstKeyValuePair.
Values::const_iterator const_iterator
Const iterator over vector values.
const_iterator begin() const
GTSAM_EXPORT const char * what() const noexceptoverride
The message to be displayed to the user.
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
std::vector< float > Values
GTSAM_EXPORT const char * what() const noexceptoverride
The message to be displayed to the user.
Values & operator=(const Values &rhs)
VectorValues localCoordinates(const Values &cp) const
void update(Key j, const Value &val)
std::pair< iterator, bool > tryInsert(Key j, const Value &value)
static KeyValuePair make_deref_pair(const KeyValueMap::iterator::value_type &key_value)
iterator insert(const std::pair< Key, Vector > &key_value)
std::uint64_t Key
Integer nonlinear key type.