Drake
|
BasicStateVector is a concrete class template that implements StateVector in a convenient manner for leaf Systems, by owning and wrapping a VectorInterface<T>. More...
#include <drake/systems/framework/basic_state_vector.h>
Public Member Functions | |
BasicStateVector (int size) | |
Constructs a BasicStateVector that owns a generic BasicVector of the specified size . More... | |
BasicStateVector (std::unique_ptr< VectorInterface< T >> vector) | |
Constructs a BasicStateVector that owns an arbitrary vector , which must not be nullptr. More... | |
int | size () const override |
Returns the number of elements in the vector. More... | |
const T | GetAtIndex (int index) const override |
Returns the element at the given index in the vector. More... | |
void | SetAtIndex (int index, const T &value) override |
Replaces the state at the given index with the value. More... | |
void | SetFromVector (const Eigen::Ref< const VectorX< T >> &value) override |
Replaces the entire state with the contents of value. More... | |
VectorX< T > | CopyToVector () const override |
Copies the entire state to a vector with no semantics. More... | |
void | ScaleAndAddToVector (const T &scale, Eigen::Ref< VectorX< T >> vec) const override |
Adds a scaled version of this state vector to Eigen vector vec , which must be the same size. More... | |
BasicStateVector & | PlusEqScaled (const T &scale, const StateVector< T > &rhs) override |
Add in scaled state vector rhs to this state vector. More... | |
Public Member Functions inherited from LeafStateVector< T > | |
std::unique_ptr< LeafStateVector< T > > | Clone () const |
Copies the entire state to a new LeafStateVector. More... | |
Public Member Functions inherited from StateVector< T > | |
virtual | ~StateVector () |
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 | |
BasicStateVector (const BasicStateVector &other) | |
Protected Member Functions inherited from LeafStateVector< T > | |
LeafStateVector () | |
Protected Member Functions inherited from StateVector< T > | |
StateVector () | |
BasicStateVector is a concrete class template that implements StateVector in a convenient manner for leaf Systems, by owning and wrapping a VectorInterface<T>.
It will often be convenient to inherit from BasicStateVector, and add additional semantics specific to the leaf System. Such child classes must override DoClone with an implementation that returns their concrete type.
T | A mathematical type compatible with Eigen's Scalar. |
|
inlineexplicit |
Constructs a BasicStateVector that owns a generic BasicVector of the specified size
.
|
inlineexplicit |
Constructs a BasicStateVector that owns an arbitrary vector
, which must not be nullptr.
|
inlineprotected |
|
inlineoverridevirtual |
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.
Implements StateVector< T >.
|
inlineoverridevirtual |
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.
Implements StateVector< T >.
|
inlineoverridevirtual |
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 from StateVector< T >.
|
inlineoverridevirtual |
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 from StateVector< T >.
|
inlineoverridevirtual |
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.
Implements StateVector< T >.
|
inlineoverridevirtual |
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.
Implements StateVector< T >.
|
inlineoverridevirtual |
Returns the number of elements in the vector.
Implementations should ensure this operation is O(1) and allocates no memory.
Implements StateVector< T >.