5 #ifndef __eigenpy_registration_class_hpp__
6 #define __eigenpy_registration_class_hpp__
8 #include <boost/python/class.hpp>
27 template <
class Visitor>
28 self&
def(Visitor
const& visitor) {
33 template <
class DerivedVisitor>
34 self&
def(bp::def_visitor<DerivedVisitor>
const& visitor) {
35 static_cast<DerivedVisitor const&
>(visitor).visit(*
this);
43 bp::detail::def_helper<char const*>(0), &f);
48 template <
class A1,
class A2>
49 self&
def(
char const*
name, A1 a1, A2
const& a2) {
56 template <
class Fn,
class A1,
class A2>
57 self&
def(
char const*
name, Fn fn, A1
const& a1, A2
const& a2) {
59 bp::detail::def_helper<A1, A2>(a1, a2), &fn);
66 template <
class Fn,
class A1,
class A2,
class A3>
67 self&
def(
char const*
name, Fn fn, A1
const& a1, A2
const& a2, A3
const& a3) {
69 bp::detail::def_helper<A1, A2, A3>(a1, a2, a3), &fn);
77 template <
class T,
class Fn,
class Helper>
78 inline void def_impl(T*,
char const*
name, Fn fn, Helper
const& helper, ...) {
79 bp::objects::add_to_namespace(
81 make_function(fn, helper.policies(), helper.keywords(),
82 bp::detail::get_signature(fn, (T*)0)),
86 boost::mpl::bool_<Helper::has_default_implementation>());
91 template <
class Fn,
class Helper>
93 boost::mpl::bool_<true>) {
94 bp::detail::error::virtual_function_default<
95 W, Fn>::must_be_derived_class_member(helper.default_implementation());
97 bp::objects::add_to_namespace(
99 make_function(helper.default_implementation(), helper.policies(),
105 template <
class Fn,
class Helper>
107 boost::mpl::bool_<false>) {}
111 template <
class OverloadsT,
class SigT>
113 OverloadsT
const& overloads,
114 bp::detail::overloads_base
const*)
117 bp::detail::define_with_defaults(
name, overloads, *
this,
118 bp::detail::get_signature(sig));
123 template <
class Fn,
class A1>
126 bp::detail::def_helper<A1>(a1), &fn);
135 #endif // ifndef __eigenpy_registration_class_hpp__