10 #include <Eigen/Dense> 27 size,
std::numeric_limits<
28 typename
Eigen::NumTraits<T>::Real>::quiet_NaN())) {}
31 if (value.rows() != values_.rows()) {
32 throw std::out_of_range(
33 "Cannot set a BasicVector of size " +
std::to_string(values_.rows()) +
39 int size()
const override {
return static_cast<int>(values_.rows()); }
41 Eigen::VectorBlock<const VectorX<T>>
get_value()
const override {
42 return values_.head(values_.rows());
46 return values_.head(values_.rows());
53 std::unique_ptr<VectorInterface<T>>
Clone() const final {
54 return std::unique_ptr<VectorInterface<T>>(DoClone());
63 clone->values_ = values_;
VectorInterface is a pure abstract interface that real-valued signals between Systems must satisfy...
Definition: vector_interface.h:25
void set_value(const Eigen::Ref< const VectorX< T >> &value) override
Sets the vector to the given value.
Definition: basic_vector.h:30
Definition: constants.h:3
Eigen::VectorBlock< VectorX< T > > get_mutable_value() override
Returns a reference that allows mutation of the values in this vector, but does not allow resizing th...
Definition: basic_vector.h:45
BasicVector(int size)
Definition: basic_vector.h:25
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorX
A column vector of any size, templated on scalar type.
Definition: eigen_types.h:36
std::unique_ptr< VectorInterface< T > > Clone() const final
Copies the entire state to a new BasicVector.
Definition: basic_vector.h:53
std::string to_string(const Eigen::MatrixBase< Derived > &a)
Definition: testUtil.h:29
BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorInterface.
Definition: basic_vector.h:23
Eigen::VectorBlock< const VectorX< T > > get_value() const override
Returns a column vector containing the entire value of the signal.
Definition: basic_vector.h:41
int size() const override
Returns the size of the vector, which must be equal to the number of rows in get_value().
Definition: basic_vector.h:39