BipedalLocomotion/Conversions/matioCppConversions.h file

Namespaces

namespace BipedalLocomotion
namespace BipedalLocomotion::Conversions

Functions

template<typename type>
auto toEigen(matioCpp::MultiDimensionalArray<type>& input) -> Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, Eigen::Dynamic>>
Conversion from a matioCpp::MultiDimensionalArray to an Eigen matrix.
template<typename type>
auto toEigen(const matioCpp::MultiDimensionalArray<type>& input) -> const Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, Eigen::Dynamic>>
Conversion from a const matioCpp::MultiDimensionalArray to an Eigen matrix.
template<typename type>
auto toEigen(matioCpp::Vector<type>& input) -> Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, 1>>
Conversion from a matioCpp::Vector to an Eigen vector.
template<typename type>
auto toEigen(const matioCpp::Vector<type>& input) -> const Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, 1>>
Conversion from a const matioCpp::Vector to an Eigen vector.
template<typename EigenDerived, typename = std::enable_if_t<Eigen::MatrixBase<EigenDerived>::RowsAtCompileTime != 1&& Eigen::MatrixBase<EigenDerived>::ColsAtCompileTime != 1>>
auto tomatioCpp(const Eigen::MatrixBase<EigenDerived>& input, const std::string& name) -> matioCpp::MultiDimensionalArray<typename EigenDerived::Scalar>
Conversion from an Eigen matrix to a matioCpp::MultiDimensionalArray.
auto tomatioCpp(const iDynTree::MatrixDynSize& input, const std::string& name) -> matioCpp::MultiDimensionalArray<double>
Conversion from an iDynTree::MatrixDynSize to a matioCpp::MultiDimensionalArray.
template<unsigned int nRows, unsigned int nCols>
auto tomatioCpp(const iDynTree::MatrixFixSize<nRows, nCols>& input, const std::string& name) -> matioCpp::MultiDimensionalArray<double>
Conversion from an iDynTree::MatrixFixSize to a matioCpp::MultiDimensionalArray.
template<class Vector, typename = typename std::enable_if_t<BipedalLocomotion::GenericContainer::is_vector_constructible<Vector>::value&& !std::is_same_v<Vector, std::string>>>
auto tomatioCpp(const Vector& input, const std::string& name) -> matioCpp::Vector<typename std::remove_cv_t<typename BipedalLocomotion::container_data<Vector>::type>>
Conversion from a generic Vector to a matioCpp::Vector.
auto tomatioCpp(const std::string& input, const std::string& name) -> matioCpp::String
Conversion from a std::string to a matioCpp::String.
auto tomatioCpp(const std::vector<bool>& input, const std::string& name) -> matioCpp::Vector<matioCpp::Logical>
Conversion from a boolean vector to a matioCpp::Vector<matioCpp::Logical>
template<typename type, typename = std::enable_if_t<std::is_fundamental_v<type>&& !std::is_same_v<type, bool>>>
auto tomatioCpp(const type& input, const std::string& name) -> matioCpp::Element<type>
Conversion from a fundamental type to the corresponding matioCpp::Element.
auto tomatioCpp(bool input, const std::string& name) -> matioCpp::Element<matioCpp::Logical>
Conversion from a boolean to a matioCpp::Element<matioCpp::Logical>
auto tomatioCpp(const std::vector<std::string>& input, const std::string& name) -> matioCpp::CellArray
Conversion from a vector of strings to a matioCpp::CellArray containing the input strings.
template<class iterator, typename = typename std::enable_if_t<is_pair_iterator_string<iterator>::value>>
auto tomatioCppStruct(iterator begin, iterator end, const std::string& name) -> matioCpp::Struct
Create a matioCpp::Struct starting from the begin and end iterators of a map-like container The dereferenced value of the iterator has to be a pair (like with std::maps and std::unordered_map) with the key being a string.
template<class iterator>
auto toMatioCppCellArray(const iterator& begin, const iterator& end, const std::string& name) -> matioCpp::CellArray
Create a matioCpp::CellArray starting from the begin and end iterators of a container.

Function documentation

template<typename type>
Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, Eigen::Dynamic>> toEigen(matioCpp::MultiDimensionalArray<type>& input)

Conversion from a matioCpp::MultiDimensionalArray to an Eigen matrix.

Parameters
input The matioCpp::MultiDimensionalArray
Returns A map from the internal data of the MultiDimensionalArray

template<typename type>
const Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, Eigen::Dynamic>> toEigen(const matioCpp::MultiDimensionalArray<type>& input)

Conversion from a const matioCpp::MultiDimensionalArray to an Eigen matrix.

Parameters
input The matioCpp::MultiDimensionalArray
Returns A const map from the internal data of the MultiDimensionalArray

template<typename type>
Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, 1>> toEigen(matioCpp::Vector<type>& input)

Conversion from a matioCpp::Vector to an Eigen vector.

Parameters
input The matioCpp::Vector
Returns A map from the internal data of the Vector

template<typename type>
const Eigen::Map<Eigen::Matrix<type, Eigen::Dynamic, 1>> toEigen(const matioCpp::Vector<type>& input)

Conversion from a const matioCpp::Vector to an Eigen vector.

Parameters
input The matioCpp::Vector
Returns A const map from the internal data of the Vector

template<typename EigenDerived, typename = std::enable_if_t<Eigen::MatrixBase<EigenDerived>::RowsAtCompileTime != 1&& Eigen::MatrixBase<EigenDerived>::ColsAtCompileTime != 1>>
matioCpp::MultiDimensionalArray<typename EigenDerived::Scalar> tomatioCpp(const Eigen::MatrixBase<EigenDerived>& input, const std::string& name)

Conversion from an Eigen matrix to a matioCpp::MultiDimensionalArray.

Parameters
input The input matrix.
name The name of the resulting matioCpp variable.
Returns A matioCpp::MultiDimensionalArray containing a copy of the input data

matioCpp::MultiDimensionalArray<double> tomatioCpp(const iDynTree::MatrixDynSize& input, const std::string& name)

Conversion from an iDynTree::MatrixDynSize to a matioCpp::MultiDimensionalArray.

Parameters
input The input matrix.
name The name of the resulting matioCpp variable.
Returns A matioCpp::MultiDimensionalArray containing a copy of the input data

template<unsigned int nRows, unsigned int nCols>
matioCpp::MultiDimensionalArray<double> tomatioCpp(const iDynTree::MatrixFixSize<nRows, nCols>& input, const std::string& name)

Conversion from an iDynTree::MatrixFixSize to a matioCpp::MultiDimensionalArray.

Parameters
input The input matrix.
name The name of the resulting matioCpp variable.
Returns A matioCpp::MultiDimensionalArray containing a copy of the input data

template<class Vector, typename = typename std::enable_if_t<BipedalLocomotion::GenericContainer::is_vector_constructible<Vector>::value&& !std::is_same_v<Vector, std::string>>>
matioCpp::Vector<typename std::remove_cv_t<typename BipedalLocomotion::container_data<Vector>::type>> tomatioCpp(const Vector& input, const std::string& name)

Conversion from a generic Vector to a matioCpp::Vector.

Parameters
input The input vector.
name The name of the resulting matioCpp variable.
Returns A matioCpp::Vector containing a copy of the input data

matioCpp::String tomatioCpp(const std::string& input, const std::string& name)

Conversion from a std::string to a matioCpp::String.

Parameters
input The input string.
name The name of the resulting matioCpp variable.
Returns A matioCpp::String containing a copy of the input data

matioCpp::Vector<matioCpp::Logical> tomatioCpp(const std::vector<bool>& input, const std::string& name)

Conversion from a boolean vector to a matioCpp::Vector<matioCpp::Logical>

Parameters
input The input vector.
name The name of the resulting matioCpp variable.
Returns A matioCpp::Vector<matioCpp::Logical> containing a copy of the input data

template<typename type, typename = std::enable_if_t<std::is_fundamental_v<type>&& !std::is_same_v<type, bool>>>
matioCpp::Element<type> tomatioCpp(const type& input, const std::string& name)

Conversion from a fundamental type to the corresponding matioCpp::Element.

Parameters
input The input element.
name The name of the resulting matioCpp variable.
Returns A matioCpp::Element containing a copy of the input data

matioCpp::Element<matioCpp::Logical> tomatioCpp(bool input, const std::string& name)

Conversion from a boolean to a matioCpp::Element<matioCpp::Logical>

Parameters
input The input element.
name The name of the resulting matioCpp variable.
Returns A matioCpp::Element<matioCpp::Logical> whose value is equal to the input.

matioCpp::CellArray tomatioCpp(const std::vector<std::string>& input, const std::string& name)

Conversion from a vector of strings to a matioCpp::CellArray containing the input strings.

Parameters
input The input vector of strings.
name The name of the resulting matioCpp variable.
Returns A matioCpp::CellArray of dimensions nx1 (with n the number of strings)

template<class iterator, typename = typename std::enable_if_t<is_pair_iterator_string<iterator>::value>>
matioCpp::Struct tomatioCppStruct(iterator begin, iterator end, const std::string& name)

Create a matioCpp::Struct starting from the begin and end iterators of a map-like container The dereferenced value of the iterator has to be a pair (like with std::maps and std::unordered_map) with the key being a string.

Parameters
begin The iterator to the first element
end The iterator to the element after the last.
name The name of the struct.
Returns The corresponding matioCpp::Struct

For each key, there is the corresponding field in the Struct.

template<class iterator>
matioCpp::CellArray toMatioCppCellArray(const iterator& begin, const iterator& end, const std::string& name)

Create a matioCpp::CellArray starting from the begin and end iterators of a container.

Parameters
begin The iterator to the first element
end The iterator to the element after the last.
name The name of the CellArray.
Returns The corresponding matioCpp::CellArray.

If dereferenced value of the iterator is a pair (like with std::maps and std::unordered_map), only the "second" element is considered. The name of the imported variable in the CellArray is "imported_element_x", where "x" is the corresponding raw index. If the iterator is a pair, and "first" is a string, this will be used as a name.