bipedal locomotion framework
A suite of libraries for achieving bipedal locomotion on humanoid robots
BipedalLocomotion::GenericContainer::Vector< T >::Ref Class Reference

The class ref is used a substitution to a classical reference to a Vector. More...

#include <GenericContainer/include/BipedalLocomotion/GenericContainer/Vector.h>

Public Member Functions

 Ref ()=delete
 A reference cannot exist on its own.
 
 Ref (BipedalLocomotion::GenericContainer::Vector< T >::Ref &other)
 Copy constructor. More...
 
 Ref (BipedalLocomotion::GenericContainer::Vector< T >::Ref &&other)
 Move constructor. More...
 
 Ref (BipedalLocomotion::GenericContainer::Vector< T > &other)
 Constructor from a GenericContainer::Vector<T>&. More...
 
 Ref (BipedalLocomotion::GenericContainer::Vector< T > &&other)
 Constructor from a GenericContainer::Vector<T>&. More...
 
template<class Vector , typename = typename std::enable_if<!GenericContainer::is_vector<Vector>::value && !std::is_same<Vector, std::string>::value && GenericContainer::is_vector_ref_constructible<T,Vector>::value && !std::is_const_v<T> && !is_container_const<Vector>::value>::type>
 Ref (Vector &input)
 Constructor from another container. More...
 
template<class Vector , typename = typename std::enable_if<!GenericContainer::is_vector<Vector>::value && !std::is_same<Vector, std::string>::value && GenericContainer::is_vector_ref_constructible<T,Vector>::value && std::is_const_v<T>>::type>
 Ref (const Vector &input)
 Constructor from another container. More...
 
 ~Ref ()=default
 Default constructor.
 
Ref operator= (const Ref &other)
 Copy operator. More...
 
Ref operator= (Ref &&other)
 Copy operator. More...
 
- Public Member Functions inherited from BipedalLocomotion::GenericContainer::Vector< T >
 Vector (iDynTree::Span< T > span, resize_function_type resizeLambda)
 Constructor. More...
 
 Vector (iDynTree::Span< T > span)
 Constructor. More...
 
 ~Vector ()=default
 Destructor.
 
 Vector (const Vector< T > &other)=delete
 Copy constructor. More...
 
 Vector (Vector< T > &&other)
 Move constructor. More...
 
bool clone (const Vector< T > &other)
 Copies the content of the vector. More...
 
bool clone (iDynTree::Span< T > other)
 Copies the content of the vector. More...
 
Vector< T > & operator= (const Vector< T > &other)
 operator = Copies the content More...
 
Vector< T > & operator= (iDynTree::Span< T > other)
 operator = Copies the content More...
 
Vector< T > & operator= (Vector< T > &&other)
 Move operator = Copies the content. More...
 
bool resizeVector (index_type newSize)
 resizeVector It resize the original vector (if possible) More...
 
void resize (index_type newSize)
 resize It resize the original vector (if possible) More...
 
index_type size () const
 size Get the size of the Vector More...
 
bool empty () const
 empty Checks if the container is empty (zero size) More...
 
const_reference operator[] (index_type idx) const
 operator [] Accessor More...
 
reference operator[] (index_type idx)
 operator [] Accessor More...
 
vector_element_type getVal (index_type idx) const
 getVal Accessor More...
 
bool setVal (index_type idx, vector_element_type val)
 setVal Setter More...
 
const_reference at (index_type idx) const
 at Accessor More...
 
reference at (index_type idx)
 at Accessor More...
 
const_reference operator() (index_type idx) const
 operator () Accessor More...
 
reference operator() (index_type idx)
 operator () Accessor More...
 
pointer data () const
 data Raw pointer to the data More...
 
iterator begin ()
 begin Iterator More...
 
iterator end ()
 end Iterator More...
 
const_iterator begin () const
 begin Iterator More...
 
const_iterator end () const
 end Iterator More...
 
const_iterator cbegin () const
 cbegin Iterator More...
 
const_iterator cend () const
 cend Iterator More...
 
reverse_iterator rbegin ()
 rbegin Iterator to the first element of the reversed vector More...
 
reverse_iterator rend ()
 rend Iterator to the element following the last element of the reversed vector. More...
 
const_reverse_iterator rbegin () const
 rbegin Iterator to the first element of the reversed vector More...
 
const_reverse_iterator rend () const
 rend Iterator to the element following the last element of the reversed vector. More...
 
const_reverse_iterator crbegin () const
 crbegin Iterator to the first element of the reversed vector More...
 
const_reverse_iterator crend () const
 crend Iterator to the element following the last element of the reversed vector. More...
 
eigen_map_type toEigen ()
 Get an Eigen map corresponding to the current generic vector (see https://eigen.tuxfamily.org/dox/classEigen_1_1Map.html).
 
eigen_map_const_type toEigen () const
 Get an Eigen const map corresponding to the current generic vector (see https://eigen.tuxfamily.org/dox/classEigen_1_1Map.html).
 

Additional Inherited Members

- Public Types inherited from BipedalLocomotion::GenericContainer::Vector< T >
using vector_element_type = typename iDynTree::Span< T >::element_type
 Utility aliases depending on the type T. More...
 
using value_type = typename iDynTree::Span< T >::value_type
 
using index_type = typename iDynTree::Span< T >::index_type
 
using pointer = typename iDynTree::Span< T >::pointer
 
using reference = typename iDynTree::Span< T >::reference
 
using const_reference = const value_type &
 
using size_type = typename iDynTree::Span< T >::size_type
 
using iterator = typename iDynTree::Span< T >::iterator
 Utility aliases to define iterators.
 
using const_iterator = typename iDynTree::Span< T >::const_iterator
 
using reverse_iterator = typename iDynTree::Span< T >::reverse_iterator
 
using const_reverse_iterator = typename iDynTree::Span< T >::const_reverse_iterator
 
using resize_function_type = std::function< iDynTree::Span< T >(index_type)>
 Alias for the type of lambda used to resize the original vector. More...
 
using eigen_map_type = typename Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, 1 > >
 Alias to determine the output type of toEigen()
 
using eigen_map_const_type = typename Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > >
 
- Protected Member Functions inherited from BipedalLocomotion::GenericContainer::Vector< T >
 Vector ()=default
 The default constructor is private. More...
 
- Protected Attributes inherited from BipedalLocomotion::GenericContainer::Vector< T >
iDynTree::Span< T > m_span
 Span of the pointed vector. More...
 
resize_function_type m_resizeLambda
 User specified lambda to resize the existing container.
 

Detailed Description

template<typename T>
class BipedalLocomotion::GenericContainer::Vector< T >::Ref

The class ref is used a substitution to a classical reference to a Vector.

The advantage of using this, is that custom vectors (all those supported by GenericContainer::Vector) can be implicitly casted to Ref. Ref does not allocate any memory in construction, hence can be used as a parameter to be passed by copy. The = operator clones the content. Ref inherits Vector<T>, hence it can be used as it was a Vector<T>.

Constructor & Destructor Documentation

◆ Ref() [1/6]

Copy constructor.

Parameters
otherThe ref from which to copy the context.

◆ Ref() [2/6]

Move constructor.

Parameters
otherThe ref from which to get the context.

◆ Ref() [3/6]

Constructor from a GenericContainer::Vector<T>&.

Parameters
otherThe input vector from which the context is copied

◆ Ref() [4/6]

Constructor from a GenericContainer::Vector<T>&.

Parameters
otherThe input vector from which the context is taken In principle, Ref should be the reference of a Vector<T> which should remain alive while Ref is alive. On the other hand, Vector<T> is only a pointer to some data which does not own. Hence, Ref can remain alive even if the Vector<T> is deleted, provided that the original container stays alive.

◆ Ref() [5/6]

template<typename T >
template<class Vector , typename = typename std::enable_if<!GenericContainer::is_vector<Vector>::value && !std::is_same<Vector, std::string>::value && GenericContainer::is_vector_ref_constructible<T,Vector>::value && !std::is_const_v<T> && !is_container_const<Vector>::value>::type>
BipedalLocomotion::GenericContainer::Vector< T >::Ref::Ref ( Vector input)
inline

Constructor from another container.

This is used if:

  • the input container is not a GenericContainer::Vector, to avoid ambiguities with other constructors
  • the input container is not a string. This allows using Ref and string with overloaded methods.
  • a GenericContainer::Vector<T>::Ref can be constructed from the Container
  • T is not const
  • the input container is not const.

◆ Ref() [6/6]

template<typename T >
template<class Vector , typename = typename std::enable_if<!GenericContainer::is_vector<Vector>::value && !std::is_same<Vector, std::string>::value && GenericContainer::is_vector_ref_constructible<T,Vector>::value && std::is_const_v<T>>::type>
BipedalLocomotion::GenericContainer::Vector< T >::Ref::Ref ( const Vector input)
inline

Constructor from another container.

This is used if:

  • the input container is not a GenericContainer::Vector, to avoid ambiguities with other constructors
  • the input container is not a string. This allows using Ref and string with overloaded methods.
  • a GenericContainer::Vector<T>::Ref can be constructed from the Container
  • T is const.

Member Function Documentation

◆ operator=() [1/2]

template<typename T >
Ref BipedalLocomotion::GenericContainer::Vector< T >::Ref::operator= ( const Ref other)
inline

Copy operator.

Parameters
otherThe other Ref, from which the data is copied
Returns
A reference to the vector resulting from the copy.

◆ operator=() [2/2]

template<typename T >
Ref BipedalLocomotion::GenericContainer::Vector< T >::Ref::operator= ( Ref &&  other)
inline

Copy operator.

Parameters
otherThe other Ref, from which the data is copied
Returns
A reference to the vector resulting from the copy.

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