ocra-recipes
Doxygen documentation for the ocra-recipes repository
MergedVariable.h
Go to the documentation of this file.
1 #ifndef _OCRA_MERGED_VARIABLE_H_
2 #define _OCRA_MERGED_VARIABLE_H_
3 
4 #include "ocra/optim/Variable.h"
5 
6 #include <string>
7 #include <map>
8 
9 namespace ocra
10 {
11  class VariableMapping;
12 }
13 
14 namespace ocra
15 {
31  : public ObserverSubject
32  {
33  public:
34  MergedVariable(const std::string& name);
36 
37  void insert(Variable* var);
38  void remove(Variable* var);
39  VariableMapping* find(Variable* var) const;
40 
42  void setValue(const VectorXd& val) const;
43  void recomputeVariable() const;
44  bool isVariableUpToDate() const;
45 
46  private:
47  void invalidateVariable();
48  void invalidateVariable(int timestamp);
49 
50  private:
51  typedef std::map<Variable*, std::pair<int, VariableMapping*> > map_t;
52 
53  map_t _varToMapping;
54  mutable CompositeVariable _base;
55  mutable bool _isVariableUpToDate;
56  };
57 }
58 
59 #endif
60 
61 // cmake:sourcegroup=Variable
MergedVariable(const std::string &name)
void insert(Variable *var)
void setValue(const VectorXd &val) const
bool isVariableUpToDate() const
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
This class represents a variable in a mathematical sense.
Definition: Variable.h:105
void recomputeVariable() const
A class to manage the relative mapping of a variable with respect to another one. ...
VariableMapping * find(Variable *var) const
A concatenation of base variables and other composite variables.
Definition: Variable.h:357
CompositeVariable & getVariable()
Declaration file of the Variable class.