]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/pickle4.cpp
1 // Copyright Ralf W. Grosse-Kunstleve 2004. Distributed under the Boost
2 // Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 This example shows how to enable pickling without using the
7 pickle_suite. The pickling interface (__getinitargs__) is
10 For more information refer to boost/libs/python/doc/pickle.html.
13 #include <boost/python/module.hpp>
14 #include <boost/python/class.hpp>
18 namespace boost_python_test
{
26 world(const std::string
& _country
) {
27 this->country
= _country
;
29 std::string
greet() const { return "Hello from " + country
+ "!"; }
30 std::string
get_country() const { return country
; }
35 BOOST_PYTHON_MODULE(pickle4_ext
)
37 using namespace boost::python
;
38 using namespace boost_python_test
;
39 class_
<world
>("world", init
<const std::string
&>())
41 .def("greet", &world::greet
)
42 .def("get_country", &world::get_country
)