From 5bd8ef10f7cdbdd47334affdf2f2b92a3674d9c4 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Fri, 8 Nov 2019 11:58:46 +0100 Subject: [PATCH] all: define struct call for common expose --- include/eigenpy/angle-axis.hpp | 17 +++++++---------- include/eigenpy/expose.hpp | 23 ++++++++++------------- include/eigenpy/quaternion.hpp | 19 ++++++++----------- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/include/eigenpy/angle-axis.hpp b/include/eigenpy/angle-axis.hpp index e7aca37a..a9accb94 100644 --- a/include/eigenpy/angle-axis.hpp +++ b/include/eigenpy/angle-axis.hpp @@ -19,18 +19,15 @@ namespace eigenpy template<typename AngleAxis> class AngleAxisVisitor; - namespace internal + template<typename Scalar> + struct call< Eigen::AngleAxis<Scalar> > { - template<typename Scalar> - struct call_expose< Eigen::AngleAxis<Scalar> > + typedef Eigen::AngleAxis<Scalar> AngleAxis; + static inline void expose() { - typedef Eigen::AngleAxis<Scalar> type; - static inline void run() - { - AngleAxisVisitor<type>::expose(); - } - }; - } // namespace internal + AngleAxisVisitor<AngleAxis>::expose(); + } + }; template<typename AngleAxis> class AngleAxisVisitor diff --git a/include/eigenpy/expose.hpp b/include/eigenpy/expose.hpp index 24158cd2..9fa8e51b 100644 --- a/include/eigenpy/expose.hpp +++ b/include/eigenpy/expose.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019, INRIA + * Copyright 2019 INRIA */ #ifndef __eigenpy_expose_hpp__ @@ -9,18 +9,15 @@ namespace eigenpy { - namespace internal + /// + /// \brief Allows a template specialization. + /// + template<typename T> + struct call { - /// - /// \brief Allows a template specialization. - /// - template<typename T> - struct call_expose - { - static inline void run() { T::expose(); } - }; - } // namespace internal - + static inline void expose() { T::expose(); } + }; + /// /// \brief Call the expose function of a given type T. /// @@ -28,7 +25,7 @@ namespace eigenpy inline void expose() { if(!register_symbolic_link_to_registered_type<T>()) - internal::call_expose<T>::run(); + call<T>::expose(); } } diff --git a/include/eigenpy/quaternion.hpp b/include/eigenpy/quaternion.hpp index 610a0347..e0cd3e62 100644 --- a/include/eigenpy/quaternion.hpp +++ b/include/eigenpy/quaternion.hpp @@ -31,19 +31,16 @@ namespace eigenpy template<typename QuaternionDerived> class QuaternionVisitor; - namespace internal + template<typename Scalar, int Options> + struct call< Eigen::Quaternion<Scalar,Options> > { - template<typename Scalar, int Options> - struct call_expose< Eigen::Quaternion<Scalar,Options> > + typedef Eigen::Quaternion<Scalar,Options> Quaternion; + static inline void expose() { - typedef Eigen::Quaternion<Scalar,Options> type; - static inline void run() - { - QuaternionVisitor<type>::expose(); - } - }; - } // namespace internal - + QuaternionVisitor<Quaternion>::expose(); + } + }; + template<typename Quaternion> class QuaternionVisitor : public bp::def_visitor< QuaternionVisitor<Quaternion> > -- GitLab