template<unsigned int VecSize>
iDynTree::VectorFixSize class

Class providing a simple vector of N elements.

The size of the vector is known at compile time, and it enables to avoid using dynamic memory allocation.

Derived classes

class ClassicalAcc
Class representing a classical 6D acceleration, i.e.

Constructors, destructors, conversion operators

VectorFixSize()
Default constructor.
VectorFixSize(const double* in_data, const std::size_t in_size)
Constructor from a C-style array.
VectorFixSize(iDynTree::Span<const double> vec)
Constructor from an iDynTree::Span.

Public functions

auto operator=(iDynTree::Span<const double> vec) -> VectorFixSize&
Copy assignment operator for spans.
auto data() const -> const double*
Raw data accessor.
auto data() -> double*
Raw data accessor.
void zero()
Assign all element of the vector to 0.
void fillBuffer(double* buf) const
Assume that buf is pointing to a buffer of size() doubles, and fill it with the content of this vector.

Protected variables

double m_data
Storage for the VectorDynSize.

Vector interface methods.

Methods exposing a vector-like interface to VectorFixSize.

auto operator()(const std::size_t index) const -> double
auto operator()(const std::size_t index) -> double&
auto operator[](const std::size_t index) const -> double
auto operator[](const std::size_t index) -> double&
auto getVal(const std::size_t index) const -> double
auto setVal(const std::size_t index, const double new_el) -> bool
auto begin() const -> const double* noexcept
Returns a const iterator to the beginning of the vector.
auto end() const -> const double* noexcept
Returns a const iterator to the beginning of the vector.
auto cbegin() const -> const double* noexcept
Returns a const iterator to the beginning of the vector.
auto cend() const -> const double* noexcept
Returns a const iterator to the beginning of the vector.
auto begin() -> double* noexcept
Returns a iterator to the beginning of the vector.
auto end() -> double* noexcept
Returns a iterator to the beginning of the vector.
auto size() const -> std::size_t

Output helpers.

Output helpers.

auto toString() const -> std::string
auto reservedToString() const -> std::string

Function documentation

template<unsigned int VecSize>
iDynTree::VectorFixSize<VecSize>::VectorFixSize()

Default constructor.

The data is not reset to 0 for perfomance reason. Please initialize the data in the vector before any use.

template<unsigned int VecSize>
iDynTree::VectorFixSize<VecSize>::VectorFixSize(const double* in_data, const std::size_t in_size)

Constructor from a C-style array.

Print an error an build a vector full of zeros if in_size is not size().

template<unsigned int VecSize>
iDynTree::VectorFixSize<VecSize>::VectorFixSize(iDynTree::Span<const double> vec)

Constructor from an iDynTree::Span.

Print an error an build a vector full of zeros if in_size is not size().

template<unsigned int VecSize>
VectorFixSize& iDynTree::VectorFixSize<VecSize>::operator=(iDynTree::Span<const double> vec)

Copy assignment operator for spans.

Checks that dimensions are matching through an assert.

template<unsigned int VecSize>
const double* iDynTree::VectorFixSize<VecSize>::data() const

Raw data accessor.

Returns a const pointer to a vector of size() doubles

template<unsigned int VecSize>
double* iDynTree::VectorFixSize<VecSize>::data()

Raw data accessor.

Returns a pointer to a vector of size() doubles

template<unsigned int VecSize>
void iDynTree::VectorFixSize<VecSize>::fillBuffer(double* buf) const

Assume that buf is pointing to a buffer of size() doubles, and fill it with the content of this vector.

Parameters
buf pointer to the buffer to fill

template<unsigned int VecSize>
const double* iDynTree::VectorFixSize<VecSize>::begin() const noexcept

Returns a const iterator to the beginning of the vector.

template<unsigned int VecSize>
const double* iDynTree::VectorFixSize<VecSize>::end() const noexcept

Returns a const iterator to the beginning of the vector.

template<unsigned int VecSize>
const double* iDynTree::VectorFixSize<VecSize>::cbegin() const noexcept

Returns a const iterator to the beginning of the vector.

template<unsigned int VecSize>
const double* iDynTree::VectorFixSize<VecSize>::cend() const noexcept

Returns a const iterator to the beginning of the vector.

template<unsigned int VecSize>
double* iDynTree::VectorFixSize<VecSize>::begin() noexcept

Returns a iterator to the beginning of the vector.

template<unsigned int VecSize>
double* iDynTree::VectorFixSize<VecSize>::end() noexcept

Returns a iterator to the beginning of the vector.

Variable documentation

template<unsigned int VecSize>
double iDynTree::VectorFixSize<VecSize>::m_data protected

Storage for the VectorDynSize.

Array of VecSize doubles.