.. _program_listing_file__tmp_ws_src_eigenpy_include_eigenpy_registration_class.hpp: Program Listing for File registration_class.hpp =============================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/eigenpy/include/eigenpy/registration_class.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2023, INRIA */ #ifndef __eigenpy_registration_class_hpp__ #define __eigenpy_registration_class_hpp__ #include #include "eigenpy/fwd.hpp" namespace eigenpy { template class registration_class { public: using self = registration_class; registration_class(bp::object object) : m_object(object) {} template self& def(Visitor const& visitor) { visitor.visit(*this); return *this; } template self& def(bp::def_visitor const& visitor) { static_cast(visitor).visit(*this); return *this; } template self& def(char const* name, F f) { def_impl(bp::detail::unwrap_wrapper((W*)0), name, f, bp::detail::def_helper(0), &f); return *this; } template self& def(char const* name, A1 a1, A2 const& a2) { def_maybe_overloads(name, a1, a2, &a2); return *this; } template self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2) { def_impl(bp::detail::unwrap_wrapper((W*)0), name, fn, bp::detail::def_helper(a1, a2), &fn); return *this; } template self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2, A3 const& a3) { def_impl(bp::detail::unwrap_wrapper((W*)0), name, fn, bp::detail::def_helper(a1, a2, a3), &fn); return *this; } private: template inline void def_impl(T*, char const* name, Fn fn, Helper const& helper, ...) { bp::objects::add_to_namespace( m_object, name, make_function(fn, helper.policies(), helper.keywords(), bp::detail::get_signature(fn, (T*)0)), helper.doc()); def_default(name, fn, helper, boost::mpl::bool_()); } template inline void def_default(char const* name, Fn, Helper const& helper, boost::mpl::bool_) { bp::detail::error::virtual_function_default< W, Fn>::must_be_derived_class_member(helper.default_implementation()); bp::objects::add_to_namespace( m_object, name, make_function(helper.default_implementation(), helper.policies(), helper.keywords())); } template inline void def_default(char const*, Fn, Helper const&, boost::mpl::bool_) {} template void def_maybe_overloads(char const* name, SigT sig, OverloadsT const& overloads, bp::detail::overloads_base const*) { bp::detail::define_with_defaults(name, overloads, *this, bp::detail::get_signature(sig)); } template void def_maybe_overloads(char const* name, Fn fn, A1 const& a1, ...) { def_impl(bp::detail::unwrap_wrapper((W*)0), name, fn, bp::detail::def_helper(a1), &fn); } private: bp::object m_object; }; } // namespace eigenpy #endif // ifndef __eigenpy_registration_class_hpp__