3 #include <boost/foreach.hpp> 9 , _isVariableUpToDate(false)
15 BOOST_FOREACH(map_t::value_type& element, _varToMapping)
16 delete element.second.second;
24 map_t::iterator it = _varToMapping.find(var);
25 if(it == _varToMapping.end())
26 _varToMapping[var] = std::make_pair(1,
new VariableMapping(*var, _base));
33 map_t::iterator it = _varToMapping.find(var);
34 ocra_assert(it != _varToMapping.end() &&
"Precondition violation: nesting class should ensure this never happens");
35 ocra_assert(it->second.first > 0 &&
"Invariant violation: there should always be at least one variable attached to a mapping");
41 if(it->second.first == 0)
43 delete it->second.second;
44 _varToMapping.erase(it);
50 if (!_isVariableUpToDate)
53 map_t::const_iterator it = _varToMapping.find(var);
54 return it != _varToMapping.end() ? it->second.second : 0x0;
59 if (!_isVariableUpToDate)
69 if (!_isVariableUpToDate)
79 BOOST_FOREACH(
const map_t::value_type& mapping, _varToMapping)
82 _isVariableUpToDate =
true;
85 void MergedVariable::invalidateVariable()
87 _isVariableUpToDate =
false;
90 void MergedVariable::invalidateVariable(
int timestamp)
97 return _isVariableUpToDate;
MergedVariable(const std::string &name)
void insert(Variable *var)
void setValue(const VectorXd &value)
void setValue(const VectorXd &val) const
bool isVariableUpToDate() const
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
void remove(Variable *var)
This class represents a variable in a mathematical sense.
void recomputeVariable() const
A class to manage the relative mapping of a variable with respect to another one. ...
CompositeVariable & addByMerge(Variable &v)
VariableMapping * find(Variable *var) const
A concatenation of base variables and other composite variables.
CompositeVariable & getVariable()
#define ocra_assert(ocra_expression)
void disconnect(Derived &object, void(Base::*callbackToErase)(int)) const
Disconnect non-static method.
void connect(Derived &object, void(Base::*newCallback)(int)) const
Call this method to register a non-static method as a callback.
Declaration file of the VariableMapping class.