Drake
StateVector< T > Class Template Referenceabstract

StateVector is an abstract base class template for vector quantities within the state of a System. More...

#include <drake/systems/framework/state_vector.h>

Inheritance diagram for StateVector< T >:

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 StateVectorPlusEqScaled (const T &scale, const StateVector< T > &rhs)
 Add in scaled state vector rhs to this state vector. More...
 
StateVectoroperator+= (const StateVector< T > &rhs)
 Add in state vector rhs to this state vector. More...
 
StateVectoroperator-= (const StateVector< T > &rhs)
 Subtract in state vector rhs to this state vector. More...
 

Protected Member Functions

 StateVector ()
 

Detailed Description

template<typename T>
class drake::systems::StateVector< T >

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.

Template Parameters
TA mathematical type compatible with Eigen's Scalar.

Constructor & Destructor Documentation

virtual ~StateVector ( )
inlinevirtual
StateVector ( )
inlineprotected

Here is the caller graph for this function:

Member Function Documentation

virtual VectorX<T> CopyToVector ( ) const
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 >.

Here is the caller graph for this function:

virtual const T GetAtIndex ( int  index) const
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 >.

Here is the caller graph for this function:

StateVector& operator+= ( const StateVector< T > &  rhs)
inline

Add in state vector rhs to this state vector.

StateVector& operator-= ( const StateVector< T > &  rhs)
inline

Subtract in state vector rhs to this state vector.

virtual StateVector& PlusEqScaled ( const T &  scale,
const StateVector< T > &  rhs 
)
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 >.

Here is the caller graph for this function:

virtual void ScaleAndAddToVector ( const T &  scale,
Eigen::Ref< VectorX< T >>  vec 
) const
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 >.

Here is the caller graph for this function:

virtual void SetAtIndex ( int  index,
const T &  value 
)
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 >.

Here is the caller graph for this function:

virtual void SetFromVector ( const Eigen::Ref< const VectorX< T >> &  value)
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 >.

Here is the caller graph for this function:

virtual int size ( ) const
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 >.

Here is the caller graph for this function:


The documentation for this class was generated from the following file: