ocra-recipes
Doxygen documentation for the ocra-recipes repository
|
Implements a basic variable. More...
#include <Variable.h>
Public Member Functions | |
BaseVariable (const std::string &name, size_t size) | |
Builds a leaf variable, i.e. a variable that is not composed of other variables. More... | |
bool | isBaseVariable () const |
void | resize (size_t newSize) |
BaseVariable & | getTimeDerivative () |
Get the time derivative/primitive of the variable. More... | |
BaseVariable & | getTimePrimitive () |
int | isAncestorOf (const Variable &var) const |
Returns the number of levels that separate the component from a potential child. More... | |
void | printSubTree (int depth, std::ostream &os) const |
Overload in ComponentDerived and CompositeDerived to simply call printTree_impl(). More... | |
Public Member Functions inherited from ocra::Variable | |
Variable (const std::string &name="") | |
virtual | ~Variable ()=0 |
The variable is automatically detached from parents and children at destruction. More... | |
virtual const std::string & | getName () const |
int | getSize () const |
operator const VectorXd & () const | |
Implicit conversion to an Eigen vector. More... | |
const VectorXd & | getValue () const |
void | setValue (const VectorXd &value) |
bool | hasTimeDerivative () const |
bool | hasTimePrimitive () const |
void | getRelativeMappingOf (const Variable &subVariable, std::vector< int > &mapping) const |
Returns the indexes of a subvariable in the variable. More... | |
size_t | getNumberOfChildren () const |
Returns 0 in BaseVariable and the number of childhoods otherwise. More... | |
void | printNode (int depth, std::ostream &os) const |
Prints the name of the variables; preprends 3*depth blank spaces. More... | |
double | operator[] (size_t i) const |
double | at (size_t i) const |
void | createTimeDerivative (const std::string &name) |
Creates a time derivative/primitive with a given name. More... | |
void | createTimePrimitive (const std::string &name) |
Public Member Functions inherited from ocra::Component< Variable, CompositeVariable, VariableParenthood > | |
bool | isChildOf (const CompositeVariable &node) |
void | printTree (std::ostream &os) |
size_t | getNumParenthoods () const |
Basic access to the parents. More... | |
const parenthood_t & | getParenthood (size_t i) const |
const_iterator | parents_begin () const |
Iterator range on the set of parents. More... | |
iterator | parents_begin () |
const_iterator | parents_end () const |
iterator | parents_end () |
int | isDescendantOf (const CompositeVariable &node) const |
Returns the number of levels that separates the component from a potential parent. More... | |
int | isDescendantOf (const Variable &node) const |
Public Member Functions inherited from ocra::ObserverSubject | |
ObserverSubject () | |
virtual | ~ObserverSubject () |
Public Member Functions inherited from ocra::Observer | |
virtual | ~Observer () |
template<int EVT> | |
void | bind (SubjectBase< EVT > &subject) |
Call this method to automatically propagate observed events to observers connected to the subject given in argument. More... | |
template<int EVT> | |
void | stopPropagation () |
Public Member Functions inherited from ocra::ObserverBase< EVT_RESIZE > | |
void | bind (subject_type &subject) |
Call this method to automatically propagate observed events to observers connected to the subject given in argument. More... | |
Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES > | |
void | bind (subject_type &subject) |
Call this method to automatically propagate observed events to observers connected to the subject given in argument. More... | |
Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE > | |
void | bind (subject_type &subject) |
Call this method to automatically propagate observed events to observers connected to the subject given in argument. More... | |
Public Member Functions inherited from ocra::Subject | |
virtual | ~Subject () |
template<int EVT, class Derived , class Base > | |
void | connect (Derived &object, void(Base::*newCallback)(int)) const |
Call this method to register a non-static method as a callback. More... | |
template<int EVT> | |
void | connect (void(*newCallback)(int)) const |
Call this method to register a free function as a callback. More... | |
template<int EVT, class Derived , class Base > | |
void | disconnect (Derived &object, void(Base::*callbackToErase)(int)) const |
Disconnect non-static method. More... | |
template<int EVT> | |
void | disconnect (void(*callbackToErase)(int)) const |
Disconnect free function. More... | |
template<int EVT> | |
void | propagate () const |
template<int EVT> | |
void | propagate (int timestamp) const |
Public Member Functions inherited from ocra::SubjectBase< EVT_RESIZE > | |
void | connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const |
Call this method to register a non-static method as a callback. More... | |
void | connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const |
Call this method to register a free function as a callback. More... | |
void | disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const |
Disconnect non-static method. More... | |
void | disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const |
Disconnect free function. More... | |
void | propagate (int timestamp) const |
void | propagate () const |
Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES > | |
void | connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const |
Call this method to register a non-static method as a callback. More... | |
void | connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const |
Call this method to register a free function as a callback. More... | |
void | disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const |
Disconnect non-static method. More... | |
void | disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const |
Disconnect free function. More... | |
void | propagate (int timestamp) const |
void | propagate () const |
Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE > | |
void | connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const |
Call this method to register a non-static method as a callback. More... | |
void | connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const |
Call this method to register a free function as a callback. More... | |
void | disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const |
Disconnect non-static method. More... | |
void | disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const |
Disconnect free function. More... | |
void | propagate (int timestamp) const |
void | propagate () const |
Protected Member Functions | |
void | do_setValue (const VectorXd &value) |
This method will attempt to assign a given value to the memory map. More... | |
size_t | do_getNumberOfChildren () const |
Always return 0. More... | |
Variable * | do_createTimeDerivative (const std::string &name) |
Variable * | do_createTimePrimitive (const std::string &name) |
Protected Member Functions inherited from ocra::Leaf< BaseVariable > | |
Leaf () | |
~Leaf () | |
void | printTree_impl (int depth, std::ostream &os) const |
Protected Member Functions inherited from ocra::Variable | |
void | onAttachedParent (const parenthood_t &parent) |
void | onDetachedParent (const parenthood_t &parent) |
Protected Member Functions inherited from ocra::Component< Variable, CompositeVariable, VariableParenthood > | |
virtual void | onAttachedParent (const parenthood_t &parent) |
Default implementation of the callbacks, to overload in class ComponentDerived. More... | |
virtual void | onDetachedParent (const parenthood_t &parent) |
Component () | |
~Component () | |
Protected Member Functions inherited from ocra::ObserverBase< EVT_RESIZE > | |
void | stopPropagation () |
Call this method from your callbacks to avoid propagation to the bound subject (if any). More... | |
ObserverBase () | |
~ObserverBase () | |
Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES > | |
void | stopPropagation () |
Call this method from your callbacks to avoid propagation to the bound subject (if any). More... | |
ObserverBase () | |
~ObserverBase () | |
Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE > | |
void | stopPropagation () |
Call this method from your callbacks to avoid propagation to the bound subject (if any). More... | |
ObserverBase () | |
~ObserverBase () | |
Protected Member Functions inherited from ocra::SubjectBase< EVT_RESIZE > | |
SubjectBase () | |
~SubjectBase () | |
Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES > | |
SubjectBase () | |
~SubjectBase () | |
Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE > | |
SubjectBase () | |
~SubjectBase () | |
Additional Inherited Members | |
Public Types inherited from ocra::Leaf< BaseVariable > | |
typedef BaseVariable | leaf_t |
Public Types inherited from ocra::Variable | |
typedef Component< Variable, CompositeVariable, VariableParenthood >::parenthood_t | parenthood_t |
Public Types inherited from ocra::Component< Variable, CompositeVariable, VariableParenthood > | |
typedef Variable | component_t |
Inherited typedefs. More... | |
typedef CompositeVariable | parent_t |
typedef Parenthood< Variable, CompositeVariable, VariableParenthood > | parenthood_t |
typedef std::vector< parenthood_t * >::const_iterator | const_iterator |
typedef std::vector< parenthood_t * >::iterator | iterator |
Protected Types inherited from ocra::ObserverBase< EVT_RESIZE > | |
typedef SubjectBase< EVT > | subject_type |
typedef InvokerBase< EVT > | invoker_type |
Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES > | |
typedef SubjectBase< EVT > | subject_type |
typedef InvokerBase< EVT > | invoker_type |
Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_VALUE > | |
typedef SubjectBase< EVT > | subject_type |
typedef InvokerBase< EVT > | invoker_type |
Static Protected Member Functions inherited from ocra::Variable | |
static void | callInsertInMemoryMap (Variable &obj, const parenthood_t &child, size_t whereInChild, std::vector< const double * >::const_iterator start, std::vector< const double * >::const_iterator end) |
Proxy to the implementation of memory maps update. More... | |
static void | callRemoveFromMemoryMap (Variable &obj, const parenthood_t &child, size_t whereInChild, size_t numElements) |
static std::vector< const double * > & | getMemoryMap (Variable &obj) |
Implements a basic variable.
Definition at line 304 of file Variable.h.
ocra::BaseVariable::BaseVariable | ( | const std::string & | name, |
size_t | size | ||
) |
Builds a leaf variable, i.e. a variable that is not composed of other variables.
Definition at line 331 of file Variable.cpp.
|
protectedvirtual |
Implements ocra::Variable.
Definition at line 390 of file Variable.cpp.
|
protectedvirtual |
Implements ocra::Variable.
Definition at line 395 of file Variable.cpp.
|
protectedvirtual |
|
protectedvirtual |
This method will attempt to assign a given value to the memory map.
Implements ocra::Variable.
Definition at line 361 of file Variable.cpp.
|
virtual |
Get the time derivative/primitive of the variable.
If the derivative/primitive doesn't exist, it will be created automatically at the first call to this method.
Reimplemented from ocra::Variable.
Definition at line 370 of file Variable.cpp.
|
virtual |
Reimplemented from ocra::Variable.
Definition at line 375 of file Variable.cpp.
|
virtual |
Returns the number of levels that separate the component from a potential child.
Implements ocra::Component< Variable, CompositeVariable, VariableParenthood >.
Definition at line 380 of file Variable.cpp.
|
virtual |
Return true if this variable is a base variable, false otherwise.
Reimplemented from ocra::Variable.
Definition at line 339 of file Variable.cpp.
|
virtual |
Overload in ComponentDerived and CompositeDerived to simply call printTree_impl().
You can also choose to reimplement the while function rather than calling the proposed printTree_impl method.
depth | is the current depth of the node. |
Implements ocra::Component< Variable, CompositeVariable, VariableParenthood >.
Definition at line 385 of file Variable.cpp.
void ocra::BaseVariable::resize | ( | size_t | newSize | ) |
Definition at line 344 of file Variable.cpp.