31 virtual int size()
const = 0;
40 virtual Eigen::VectorBlock<const VectorX<T>>
get_value()
const = 0;
48 virtual std::unique_ptr<VectorInterface<T>>
Clone()
const = 0;
77 : vector_(
std::move(vector)) {}
88 : vector_(
std::move(source.vector_)) {}
100 vector_ = std::move(source.vector_);
110 throw std::logic_error(
"VectorObject::get_vector(): object is empty.");
120 throw std::logic_error(
121 "VectorObject::get_mutable_vector(): object is empty.");
123 return vector_.get();
129 bool empty() const noexcept {
return !vector_; }
132 std::unique_ptr<VectorInterface<T>> vector_;
136 template <
typename T>
144 template <
typename T>
VectorInterface is a pure abstract interface that real-valued signals between Systems must satisfy...
Definition: vector_interface.h:25
virtual void set_value(const Eigen::Ref< const VectorX< T >> &value)=0
Sets the vector to the given value.
This file contains abbreviated definitions for certain specializations of Eigen::Matrix that are comm...
Definition: constants.h:3
VectorInterface< T > * to_mutable_vector_interface(AbstractValue *value)
Strip off the VectorObject so we can see the VectorInterface.
Definition: vector_interface.h:145
VectorInterface()
Definition: vector_interface.h:51
VectorObject(const VectorObject &source)
Copy constructor uses the source object's Clone() method to make a deep copy which is then owned by t...
Definition: vector_interface.h:81
VectorObject & operator=(VectorObject &&source) noexcept
Move assignment leaves source empty.
Definition: vector_interface.h:99
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorX
A column vector of any size, templated on scalar type.
Definition: eigen_types.h:36
virtual Eigen::VectorBlock< VectorX< T > > get_mutable_value()=0
Returns a reference that allows mutation of the values in this vector, but does not allow resizing th...
virtual std::unique_ptr< VectorInterface< T > > Clone() const =0
Copies the entire vector to a new VectorInterface, with the same concrete implementation type...
VectorObject(std::unique_ptr< VectorInterface< T >> vector) noexcept
Takes over ownership of the provided VectorInterface object.
Definition: vector_interface.h:76
virtual Eigen::VectorBlock< const VectorX< T > > get_value() const =0
Returns a column vector containing the entire value of the signal.
bool empty() const noexcept
Returns true if this VectorObject does not own a VectorInterface object.
Definition: vector_interface.h:129
const T & GetValue() const
Returns the value wrapped in this AbstractValue, which must be of exactly type T. ...
Definition: value.h:35
virtual ~VectorInterface()
Definition: vector_interface.h:27
VectorObject & operator=(const VectorObject &source)
Copy assignment replaces the current contents of this VectorObject with a clone of the source object...
Definition: vector_interface.h:92
T * GetMutableValue()
Returns the value wrapped in this AbstractValue, which must be of exactly type T. ...
Definition: value.h:46
This concrete class provides object semantics to an abstract VectorInterface by implementing a copy c...
Definition: vector_interface.h:70
A fully type-erased container class.
Definition: value.h:22
const VectorInterface< T > & get_vector() const
Returns a const reference to the VectorInterface object owned by this VectorObject, if any.
Definition: vector_interface.h:108
VectorInterface< T > * get_mutable_vector()
Returns a mutable pointer to the VectorInterface object owned by this VectorObject, if any.
Definition: vector_interface.h:118
VectorObject(VectorObject &&source) noexcept
Move construction leaves source empty.
Definition: vector_interface.h:87
virtual int size() const =0
Returns the size of the vector, which must be equal to the number of rows in get_value().
VectorObject() noexcept
Constructs an empty VectorObject.
Definition: vector_interface.h:73
const VectorInterface< T > & to_vector_interface(const AbstractValue &value)
Strip off the VectorObject so we can see the VectorInterface.
Definition: vector_interface.h:137