1 | // This file has been generated by Py++.
|
---|
2 |
|
---|
3 | // Copyright 2004-2008 Roman Yakovenko.
|
---|
4 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
5 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
6 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
7 |
|
---|
8 | #include "boost/python.hpp"
|
---|
9 |
|
---|
10 | #include "virtual_inheritance_to_be_exported.hpp"
|
---|
11 |
|
---|
12 | namespace bp = boost::python;
|
---|
13 |
|
---|
14 | struct base_wrapper : base, bp::wrapper< base > {
|
---|
15 |
|
---|
16 | base_wrapper(base const & arg )
|
---|
17 | : base( arg )
|
---|
18 | , bp::wrapper< base >(){
|
---|
19 | // copy constructor
|
---|
20 |
|
---|
21 | }
|
---|
22 |
|
---|
23 | base_wrapper()
|
---|
24 | : base()
|
---|
25 | , bp::wrapper< base >(){
|
---|
26 | // null constructor
|
---|
27 |
|
---|
28 | }
|
---|
29 |
|
---|
30 | virtual void do_smth( ) {
|
---|
31 | if( bp::override func_do_smth = this->get_override( "do_smth" ) )
|
---|
32 | func_do_smth( );
|
---|
33 | else
|
---|
34 | this->base::do_smth( );
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | void default_do_smth( ) {
|
---|
39 | base::do_smth( );
|
---|
40 | }
|
---|
41 |
|
---|
42 | };
|
---|
43 |
|
---|
44 | struct derived_wrapper : derived, bp::wrapper< derived > {
|
---|
45 |
|
---|
46 | derived_wrapper(derived const & arg )
|
---|
47 | : derived( arg )
|
---|
48 | , bp::wrapper< derived >(){
|
---|
49 | // copy constructor
|
---|
50 |
|
---|
51 | }
|
---|
52 |
|
---|
53 | derived_wrapper()
|
---|
54 | : derived()
|
---|
55 | , bp::wrapper< derived >(){
|
---|
56 | // null constructor
|
---|
57 |
|
---|
58 | }
|
---|
59 |
|
---|
60 | virtual void do_smth( ) {
|
---|
61 | if( bp::override func_do_smth = this->get_override( "do_smth" ) )
|
---|
62 | func_do_smth( );
|
---|
63 | else
|
---|
64 | this->base::do_smth( );
|
---|
65 | }
|
---|
66 |
|
---|
67 |
|
---|
68 | void default_do_smth( ) {
|
---|
69 | base::do_smth( );
|
---|
70 | }
|
---|
71 |
|
---|
72 | };
|
---|
73 |
|
---|
74 | BOOST_PYTHON_MODULE(virtual_inheritance){
|
---|
75 | bp::class_< base_wrapper >( "base", "documentation" )
|
---|
76 | .def(
|
---|
77 | "do_smth"
|
---|
78 | , (void ( ::base::* )( ) )(&::base::do_smth)
|
---|
79 | , (void ( base_wrapper::* )( ) )(&base_wrapper::default_do_smth) );
|
---|
80 |
|
---|
81 | bp::class_< derived_wrapper, bp::bases< base > >( "derived", "documentation" )
|
---|
82 | .def(
|
---|
83 | "do_smth"
|
---|
84 | , (void ( ::base::* )( ) )(&::base::do_smth)
|
---|
85 | , (void ( derived_wrapper::* )( ) )(&derived_wrapper::default_do_smth) );
|
---|
86 | }
|
---|