35 template<
class ValueType>
44 template<
class ValueType>
61 template<
class ValueType,
class CastedKeyValuePairType,
class KeyValuePairType>
63 static CastedKeyValuePairType cast(KeyValuePairType key_value) {
65 return CastedKeyValuePairType(key_value.key,
67 ValueType>&>(key_value.value)).
value());
71 template<
class CastedKeyValuePairType,
class KeyValuePairType>
73 static CastedKeyValuePairType cast(KeyValuePairType key_value) {
77 return CastedKeyValuePairType(key_value.key, key_value.value);
81 template<
class CastedKeyValuePairType,
class KeyValuePairType>
83 static CastedKeyValuePairType cast(KeyValuePairType key_value) {
87 return CastedKeyValuePairType(key_value.key, key_value.value);
92 template<
class ValueType>
101 boost::transform_iterator<
103 boost::filter_iterator<
108 typedef iterator const_iterator;
111 boost::transform_iterator<
113 boost::filter_iterator<
116 const_const_iterator;
118 iterator begin() {
return begin_; }
120 const_iterator begin()
const {
return begin_; }
121 const_iterator end()
const {
return end_; }
122 const_const_iterator beginConst()
const {
return constBegin_; }
123 const_const_iterator endConst()
const {
return constEnd_; }
128 for (const_const_iterator it = beginConst(); it != endConst(); ++it)
138 boost::make_transform_iterator(
139 boost::make_filter_iterator(
filter, values.begin(), values.end()),
141 boost::make_transform_iterator(
142 boost::make_filter_iterator(
filter, values.end(), values.end()),
144 boost::make_transform_iterator(
145 boost::make_filter_iterator(
filter,
146 ((const
Values&) values).begin(),
147 ((const
Values&) values).end()),
150 boost::make_transform_iterator(
151 boost::make_filter_iterator(
filter,
152 ((const
Values&) values).end(),
153 ((const
Values&) values).end()),
161 const_const_iterator constBegin_;
162 const_const_iterator constEnd_;
166 template<
class ValueType>
173 typedef typename Filtered<ValueType>::const_const_iterator iterator;
174 typedef typename Filtered<ValueType>::const_const_iterator const_iterator;
178 begin_(rhs.beginConst()),
179 end_(rhs.endConst()) {}
182 iterator end() {
return end_; }
183 const_iterator begin()
const {
return begin_; }
184 const_iterator end()
const {
return end_; }
189 for (const_iterator it = begin(); it != end(); ++it)
197 result.push_back(it->key);
203 const_iterator begin_;
210 const Filtered<ValueType> filtered(
filter, const_cast<Values&>(values));
211 begin_ = filtered.beginConst();
212 end_ = filtered.endConst();
218 template<
class ValueType>
221 Key key = key_value.key;
222 insert(key, static_cast<const ValueType&>(key_value.value));
227 template<
class ValueType>
230 Key key = key_value.key;
231 insert(key, static_cast<const ValueType&>(key_value.value));
238 return filter<Value>(filterFcn);
242 template<
class ValueType>
251 return filter<Value>(filterFcn);
255 template<
class ValueType>
263 inline bool Values::filterHelper<Value>(
const boost::function<
bool(
Key)> filter,
264 const ConstKeyValuePair& key_value) {
266 return filter(key_value.key);
275 template <
typename ValueType>
277 ValueType operator()(
Key j,
const Value*
const pointer) {
281 }
catch (std::bad_cast&) {
287 template <
typename MatrixType,
bool isDynamic>
291 template <
int M,
int N>
293 Eigen::Matrix<double, M, N> operator()(
Key j,
const Value*
const pointer) {
297 }
catch (std::bad_cast&) {
305 template <
int M,
int N>
307 Eigen::Matrix<double, M, N> operator()(
Key j,
const Value*
const pointer) {
311 }
catch (std::bad_cast&) {
321 if (A.rows() != M || A.cols() != N)
330 template <
int M,
int N>
331 struct handle<Eigen::Matrix<double, M, N>> {
332 Eigen::Matrix<double, M, N> operator()(
Key j,
const Value*
const pointer) {
334 (M == Eigen::Dynamic || N == Eigen::Dynamic)>()(j, pointer);
341 template<
typename ValueType>
344 KeyValueMap::const_iterator item = values_.find(j);
347 if(item == values_.end())
355 template<
typename ValueType>
358 KeyValueMap::const_iterator item = values_.find(j);
360 if(item != values_.end()) {
362 const Value& value = *item->second;
365 }
catch (std::bad_cast &) {
367 const Value* value = item->second;
378 template<
typename ValueType>
384 template <
typename ValueType>
void insert(Key j, const Value &val)
Add a variable with the given j, throws KeyAlreadyExists<J> if j is already present.
Definition: Values.cpp:133
ConstFiltered(const Filtered< ValueType > &rhs)
Conversion from Filtered to ConstFiltered.
Definition: Values-inl.h:177
size_t size() const
Returns the number of values in this view.
Definition: Values-inl.h:187
Definition: Values-inl.h:36
Filtered< Value > filter(const boost::function< bool(Key)> &filterFcn)
Return a filtered view of this Values class, without copying any data.
Definition: Values-inl.h:237
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
boost::transform_iterator< boost::function1< ConstKeyValuePair, const ConstKeyValuePtrPair & >, KeyValueMap::const_iterator > const_iterator
Const forward iterator, with value type ConstKeyValuePair.
Definition: Values.h:123
Values()
Default constructor creates an empty Values class.
Definition: Values.h:144
ValueType at(Key j) const
Retrieve a variable by key j.
Definition: Values-inl.h:342
This is the base class for any type to be stored in Values.
Definition: Value.h:36
A filtered view of a Values, returned from Values::filter.
Definition: Values-inl.h:93
const T & value() const
Return a constant value.
Definition: GenericValue.h:58
Definition: Values-inl.h:62
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Definition: Values-inl.h:276
size_t size() const
Returns the number of values in this view.
Definition: Values-inl.h:126
Definition: Values-inl.h:45
void update(Key j, const Value &val)
single element change of existing element
Definition: Values.cpp:154
A key-value pair, which you get by dereferencing iterators.
Definition: Values.h:109
Wraps any type T so it can play as a Value.
Definition: GenericValue.h:38
bool exists(Key j) const
Check if a value exists with key j.
Definition: Values.cpp:97
boost::transform_iterator< boost::function1< KeyValuePair, const KeyValuePtrPair & >, KeyValueMap::iterator > iterator
Mutable forward iterator, with value type KeyValuePair.
Definition: Values.h:119
Definition: FastList.h:38
A filtered view of a const Values, returned from Values::filter.
Definition: Values-inl.h:167
const Key key
The key.
Definition: Values-inl.h:37
const ValueType & value
The value.
Definition: Values-inl.h:47
A key-value pair, which you get by dereferencing iterators.
Definition: Values.h:101
ValueType & value
The value.
Definition: Values-inl.h:38
_ValuesConstKeyValuePair< ValueType > KeyValuePair
A const key-value pair, with the value a specific derived Value type.
Definition: Values-inl.h:170
A non-templated config holding any types of Manifold-group elements.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
const Key key
The key.
Definition: Values-inl.h:46
Definition: Values-inl.h:288
_ValuesKeyValuePair< ValueType > KeyValuePair
A key-value pair, with the value a specific derived Value type.
Definition: Values-inl.h:96