Drake
|
StateVector is an abstract base class template for vector quantities within the state of a System. More...
#include <drake/systems/framework/state_vector.h>
Public Member Functions | |
virtual | ~StateVector () |
virtual int | size () const =0 |
Returns the number of elements in the vector. More... | |
virtual const T | GetAtIndex (int index) const =0 |
Returns the element at the given index in the vector. More... | |
virtual void | SetAtIndex (int index, const T &value)=0 |
Replaces the state at the given index with the value. More... | |
virtual void | SetFromVector (const Eigen::Ref< const VectorX< T >> &value)=0 |
Replaces the entire state with the contents of value. More... | |
virtual VectorX< T > | CopyToVector () const =0 |
Copies the entire state to a vector with no semantics. More... | |
virtual void | ScaleAndAddToVector (const T &scale, Eigen::Ref< VectorX< T >> vec) const |
Adds a scaled version of this state vector to Eigen vector vec , which must be the same size. More... | |
virtual StateVector & | PlusEqScaled (const T &scale, const StateVector< T > &rhs) |
Add in scaled state vector rhs to this state vector. More... | |
StateVector & | operator+= (const StateVector< T > &rhs) |
Add in state vector rhs to this state vector. More... | |
StateVector & | operator-= (const StateVector< T > &rhs) |
Subtract in state vector rhs to this state vector. More... | |
Protected Member Functions | |
StateVector () | |
StateVector is an abstract base class template for vector quantities within the state of a System.
Both composite Systems (Diagrams) and leaf Systems have state that satisfies StateVector.
T | A mathematical type compatible with Eigen's Scalar. |
|
inlinevirtual |
|
inlineprotected |
|
pure virtual |
Copies the entire state to a vector with no semantics.
Implementations should ensure this operation is O(N) in the size of the value and allocates only the O(N) memory that it returns.
Implemented in StateSubvector< T >, and BasicStateVector< T >.
|
pure virtual |
Returns the element at the given index in the vector.
Throws std::out_of_range if the index is >= size().
Implementations should ensure this operation is O(1) and allocates no memory.
Implemented in StateSubvector< T >, and BasicStateVector< T >.
|
inline |
Add in state vector rhs
to this state vector.
|
inline |
Subtract in state vector rhs
to this state vector.
|
inlinevirtual |
Add in scaled state vector rhs
to this state vector.
Both vectors must be the same size.
Implementations may override this default implementation with a more efficient approach, for instance if this vector is contiguous. Implementations should ensure this operation remains O(N) in the size of the value and allocates no memory.
Reimplemented in BasicStateVector< T >.
|
inlinevirtual |
Adds a scaled version of this state vector to Eigen vector vec
, which must be the same size.
Implementations may override this default implementation with a more efficient approach, for instance if this vector is contiguous. Implementations should ensure this operation remains O(N) in the size of the value and allocates no memory.
Reimplemented in BasicStateVector< T >.
|
pure virtual |
Replaces the state at the given index with the value.
Throws std::out_of_range if the index is >= size().
Implementations should ensure this operation is O(1) and allocates no memory.
Implemented in StateSubvector< T >, and BasicStateVector< T >.
|
pure virtual |
Replaces the entire state with the contents of value.
Throws std::out_of_range if value is not a column vector with size() rows.
Implementations should ensure this operation is O(N) in the size of the value and allocates no memory.
Implemented in StateSubvector< T >, and BasicStateVector< T >.
|
pure virtual |
Returns the number of elements in the vector.
Implementations should ensure this operation is O(1) and allocates no memory.
Implemented in StateSubvector< T >, and BasicStateVector< T >.