mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
vector_converter.hpp File Reference

Implements the convertTo() and convertFrom() functions for conversion between different vector representations (Eigen, OpenCV, tf2 etc.). More...

#include <experimental/type_traits>
+ Include dependency graph for vector_converter.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mrs_lib
 All mrs_lib functions, classes, variables and definitions are contained in this namespace.
 

Macros

#define GENERATE_HAS_MEMBER_FUNC(func, rettype)
 
#define GENERATE_HAS_MEMBER(memb, type)
 

Typedefs

using mrs_lib::impl::unw_t = std::tuple< double, double, double >
 
template<class T >
using mrs_lib::impl::_has_squarebracket_operator_chk = decltype(std::declval< T & >()[0])
 

Functions

template<typename in_t >
std::enable_if_t< has_xfun_v< in_t >, unw_t > mrs_lib::impl::convertFrom (const in_t &in)
 
template<typename in_t >
std::enable_if_t< has_xmem_v< in_t >, unw_t > mrs_lib::impl::convertFrom (const in_t &in)
 
template<typename in_t >
std::enable_if_t< has_squarebracket_operator_v< in_t > &&!has_xfun_v< in_t >, unw_t > mrs_lib::impl::convertFrom (const in_t &in)
 
template<typename ret_t >
std::enable_if_t< has_xyz_constructor_v< ret_t >, void > mrs_lib::impl::convertTo (ret_t &out, const double x, const double y, const double z)
 
template<typename ret_t >
std::enable_if_t<!has_xyz_constructor_v< ret_t > &&has_xmem_v< ret_t >, void > mrs_lib::impl::convertTo (ret_t &out, const double x, const double y, const double z)
 
template<typename ret_t >
ret_t mrs_lib::impl::convertTo (const double x, const double y, const double z)
 

Variables

template<class T >
constexpr bool mrs_lib::impl::has_squarebracket_operator_v = std::experimental::is_detected_convertible_v<double, _has_squarebracket_operator_chk, T>
 
template<class T >
constexpr bool mrs_lib::impl::has_xyz_constructor_v = std::experimental::is_constructible_v<T, double, double, double>
 

Detailed Description

Implements the convertTo() and convertFrom() functions for conversion between different vector representations (Eigen, OpenCV, tf2 etc.).

Author
Matouš Vrba - vrbam.nosp@m.ato@.nosp@m.fel.c.nosp@m.vut..nosp@m.cz

Macro Definition Documentation

◆ GENERATE_HAS_MEMBER

#define GENERATE_HAS_MEMBER (   memb,
  type 
)
Value:
template<class T> using _has_##memb##mem_chk = \
decltype(std::declval<T &>().memb); \
template<class T> constexpr bool has_##memb##mem_v = \
std::experimental::is_detected_convertible_v<type, _has_##memb##mem_chk, T>;

◆ GENERATE_HAS_MEMBER_FUNC

#define GENERATE_HAS_MEMBER_FUNC (   func,
  rettype 
)
Value:
template<class T> using _has_##func##fun_chk = \
decltype(std::declval<T &>().func()); \
template<class T> constexpr bool has_##func##fun_v = \
std::experimental::is_detected_convertible_v<rettype, _has_##func##fun_chk, T>;