Skip to content

Commit 412a002

Browse files
committed
Move module_base to detail, avoiding recompilation dependencies
[SVN r12970]
1 parent ccb7a8f commit 412a002

File tree

5 files changed

+51
-35
lines changed

5 files changed

+51
-35
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright David Abrahams 2002. Permission to copy, use,
2+
// modify, sell and distribute this software is granted provided this
3+
// copyright notice appears in all copies. This software is provided
4+
// "as is" without express or implied warranty, and with no claim as
5+
// to its suitability for any purpose.
6+
#ifndef MODULE_BASE_DWA2002227_HPP
7+
# define MODULE_BASE_DWA2002227_HPP
8+
# include <boost/python/detail/wrap_python.hpp>
9+
# include <boost/python/reference.hpp>
10+
11+
namespace boost { namespace python { namespace detail {
12+
13+
class BOOST_PYTHON_DECL module_base
14+
{
15+
public:
16+
// Create a module. REQUIRES: only one module is created per module.
17+
module_base(const char* name);
18+
~module_base();
19+
20+
// Add elements to the module
21+
void setattr(const char* name, PyObject*);
22+
void setattr(const char* name, ref const&);
23+
void add(PyTypeObject* x); // just use the type's name
24+
void add_type(ref);
25+
26+
// Return a reference to the Python module object being built
27+
inline ref object() const;
28+
29+
private:
30+
ref m_module;
31+
static PyMethodDef initial_methods[1];
32+
};
33+
34+
//
35+
// inline implementations
36+
//
37+
inline ref module_base::object() const
38+
{
39+
return m_module;
40+
}
41+
42+
}}} // namespace boost::python::detail
43+
44+
#endif // MODULE_BASE_DWA2002227_HPP

include/boost/python/module.hpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,14 @@
88

99
# include <boost/python/errors.hpp>
1010
# include <boost/python/detail/config.hpp>
11-
# include <boost/python/reference.hpp>
1211
# include <boost/python/make_function.hpp>
1312
# include <boost/python/objects.hpp>
14-
# include <boost/python/detail/wrap_python.hpp>
1513
# include <boost/python/class_fwd.hpp>
14+
# include <boost/python/detail/module_base.hpp>
1615

1716
namespace boost { namespace python {
1817

19-
class BOOST_PYTHON_DECL module_base
20-
{
21-
public:
22-
// Create a module. REQUIRES: only one module is created per module.
23-
module_base(const char* name);
24-
~module_base();
25-
26-
// Add elements to the module
27-
void setattr(const char* name, PyObject*);
28-
void setattr(const char* name, ref const&);
29-
void add(PyTypeObject* x); // just use the type's name
30-
void add_type(ref);
31-
32-
// Return a reference to the Python module object being built
33-
ref object() const;
34-
35-
private:
36-
ref m_module;
37-
static PyMethodDef initial_methods[1];
38-
};
39-
40-
class module : public module_base
18+
class module : public detail::module_base
4119
{
4220
public:
4321
module(const char* name)
@@ -76,11 +54,6 @@ class module : public module_base
7654
//
7755
// inline implementations
7856
//
79-
inline ref module_base::object() const
80-
{
81-
return m_module;
82-
}
83-
8457
inline module& module::setattr(const char* name, PyObject* x)
8558
{
8659
this->module_base::setattr(name, x);

include/boost/python/object/class.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#ifndef CLASS_DWA20011214_HPP
77
# define CLASS_DWA20011214_HPP
88

9-
# include <boost/python/module.hpp>
109
# include <boost/python/detail/wrap_python.hpp>
1110
# include <boost/python/detail/config.hpp>
1211
# include <boost/utility.hpp>

src/module.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
// The author gratefully acknowleges the support of Dragon Systems, Inc., in
77
// producing this work.
88

9-
#include <boost/python/module.hpp>
9+
#include <boost/python/detail/module_base.hpp>
10+
#include <boost/python/object/function.hpp>
1011

11-
namespace boost { namespace python {
12+
namespace boost { namespace python { namespace detail {
1213

1314
module_base::module_base(const char* name)
1415
: m_module(
@@ -46,4 +47,4 @@ void module_base::add_type(ref x)
4647

4748
PyMethodDef module_base::initial_methods[] = { { 0, 0, 0, 0 } };
4849

49-
}} // namespace boost::python
50+
}}} // namespace boost::python::detail

src/object/class.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
// copyright notice appears in all copies. This software is provided
44
// "as is" without express or implied warranty, and with no claim as
55
// to its suitability for any purpose.
6-
#include <boost/python/detail/config.hpp>
7-
#include <boost/python/detail/wrap_python.hpp>
6+
#include <boost/python/converter/registry.hpp>
87
#include <boost/python/object/class.hpp>
98
#include <boost/python/objects.hpp>
109
#include <boost/python/detail/map_entry.hpp>

0 commit comments

Comments
 (0)