Logo ROOT  
Reference Guide
py11_functioncalls.cxx
Go to the documentation of this file.
1#include <pybind11/pybind11.h>
2#include "functioncalls.h"
3
4
5namespace py = pybind11;
6
7PYBIND11_MODULE(py11_functioncalls, m) {
8//- group: empty-free --------------------------------------------------------
9 m.def("empty_call", &empty_call);
10
11//- group: empty-inst --------------------------------------------------------
12 py::class_<EmptyCall>(m, "EmptyCall")
13 .def(py::init<>())
14 .def("empty_call", &EmptyCall::empty_call);
15
16
17//- group: builtin-args-free -------------------------------------------------
18 py::class_<Value>(m, "Value")
19 .def(py::init<>());
20
21 m.def("take_an_int", &take_an_int);
22 m.def("take_a_double", &take_a_double);
23 m.def("take_a_struct", &take_a_struct);
24
25//- group: builtin-args-free -------------------------------------------------
26 py::class_<TakeAValue>(m, "TakeAValue")
27 .def(py::init<>())
28 .def("take_an_int", &TakeAValue::take_an_int)
29 .def("take_a_double", &TakeAValue::take_a_double)
30 .def("take_a_struct", &TakeAValue::take_a_struct)
31
32//- group: builtin-args-pass -------------------------------------------------
33 .def("pass_int", &TakeAValue::pass_int);
34
35
36//- group: do-work-free ------------------------------------------------------
37 m.def("do_work", &do_work);
38
39//- group: do-work-inst ------------------------------------------------------
40 py::class_<DoWork>(m, "DoWork")
41 .def(py::init<>())
42 .def("do_work", &DoWork::do_work);
43
44
45//- group: overload-inst -----------------------------------------------------
46 py::class_<OverloadedCall>(m, "OverloadedCall")
47 .def(py::init<>())
48 .def("add_it", (double (OverloadedCall::*)(int, int)) &OverloadedCall::add_it)
49 .def("add_it", (double (OverloadedCall::*)(short)) &OverloadedCall::add_it)
50 .def("add_it", (double (OverloadedCall::*)(long)) &OverloadedCall::add_it)
51 .def("add_it", (double (OverloadedCall::*)(int, int, int))&OverloadedCall::add_it)
52 .def("add_it", (double (OverloadedCall::*)(double)) &OverloadedCall::add_it)
53 .def("add_it", (double (OverloadedCall::*)(float)) &OverloadedCall::add_it)
54 .def("add_it", (double (OverloadedCall::*)(int)) &OverloadedCall::add_it);
55}
double do_work(double)
void empty_call()
double add_it(int a, int b)
void take_a_struct(Value)
void take_a_double(double)
void take_an_int(int)
int pass_int(int)
double do_work(double arg)
void take_a_double(double)
void take_a_struct(Value)
void empty_call()
void take_an_int(int)
PYBIND11_MODULE(py11_functioncalls, m)
TMarker m
Definition: textangle.C:8