Drake
StateSubvector< T > Class Template Reference

StateSubvector is a concrete class template that implements StateVector by providing a sliced view of a StateVector. More...

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

Inheritance diagram for StateSubvector< T >:
Collaboration diagram for StateSubvector< T >:

Public Member Functions

 StateSubvector (StateVector< T > *vector, int first_element, int num_elements)
 Constructs a subvector of vector that consists of num_elements starting at first_element. More...
 
 StateSubvector (StateVector< T > *vector)
 Constructs an empty subvector. 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...
 
- Public Member Functions inherited from StateVector< T >
virtual ~StateVector ()
 
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...
 

Additional Inherited Members

- Protected Member Functions inherited from StateVector< T >
 StateVector ()
 

Detailed Description

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

StateSubvector is a concrete class template that implements StateVector by providing a sliced view of a StateVector.

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

Constructor & Destructor Documentation

StateSubvector ( StateVector< T > *  vector,
int  first_element,
int  num_elements 
)
inline

Constructs a subvector of vector that consists of num_elements starting at first_element.

Parameters
vectorThe vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object.

Here is the caller graph for this function:

StateSubvector ( StateVector< T > *  vector)
inlineexplicit

Constructs an empty subvector.

Parameters
vectorThe vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object.

Member Function Documentation

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

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

int size ( ) const
inlineoverridevirtual

Returns the number of elements in the vector.

Implementations should ensure this operation is O(1) and allocates no memory.

Implements StateVector< T >.

Here is the caller graph for this function:


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