Drake
|
LeafStateVector is an abstract class template that implements StateVector for leaf Systems, i.e. More...
#include <drake/systems/framework/leaf_state_vector.h>
Public Member Functions | |
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 () |
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 | |
LeafStateVector () | |
virtual LeafStateVector< T > * | DoClone () const =0 |
Returns a new LeafStateVector containing a copy of the entire state. More... | |
Protected Member Functions inherited from StateVector< T > | |
StateVector () | |
LeafStateVector is an abstract class template that implements StateVector for leaf Systems, i.e.
Systems that are not Diagrams.
It introduces the additional Non-Virtual Interface method Clone(), with corresponding virtual implementation DoClone(). Children of LeafStateVector should override DoClone to return their concrete type.
|
inlineprotected |
|
inline |
Copies the entire state to a new LeafStateVector.
Uses the Non-Virtual Interface idiom because smart pointers do not have type covariance.
|
protectedpure virtual |
Returns a new LeafStateVector containing a copy of the entire state.
Caller must take ownership.
Implementations should ensure this operation is O(N) in the size of the value and allocates only the O(N) memory that it returns.