]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/injected.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / python / test / injected.cpp
1 // Copyright David Abrahams 2003.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <boost/python/module.hpp>
7 #include <boost/python/class.hpp>
8 #include "test_class.hpp"
9 #include <memory>
10 #include <boost/shared_ptr.hpp>
11 #include <boost/python/make_constructor.hpp>
12 #include <boost/python/args.hpp>
13
14 using namespace boost::python;
15
16 typedef test_class<> X;
17
18 X* empty() { return new X(1000); }
19
20 std::auto_ptr<X> sum(int a, int b) { return std::auto_ptr<X>(new X(a+b)); }
21
22 boost::shared_ptr<X> product(int a, int b, int c)
23 {
24 return boost::shared_ptr<X>(new X(a*b*c));
25 }
26
27 BOOST_PYTHON_MODULE(injected_ext)
28 {
29 class_<X>("X", init<int>())
30 .def("__init__", make_constructor(empty))
31 .def("__init__", make_constructor(sum))
32 .def("__init__", make_constructor(product
33 , default_call_policies()
34 , ( arg_("a"), arg_("b"), arg_("c"))
35 ),
36 "this is product's docstring")
37 .def("value", &X::value)
38 ;
39 }