2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-30 20:12:37 +00:00

Move module_base to detail, avoiding recompilation dependencies

[SVN r12970]
This commit is contained in:
Dave Abrahams
2002-02-28 00:24:06 +00:00
parent ccb7a8f94f
commit 412a00249f
5 changed files with 51 additions and 35 deletions

View File

@@ -0,0 +1,44 @@
// Copyright David Abrahams 2002. Permission to copy, use,
// modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#ifndef MODULE_BASE_DWA2002227_HPP
# define MODULE_BASE_DWA2002227_HPP
# include <boost/python/detail/wrap_python.hpp>
# include <boost/python/reference.hpp>
namespace boost { namespace python { namespace detail {
class BOOST_PYTHON_DECL module_base
{
public:
// Create a module. REQUIRES: only one module is created per module.
module_base(const char* name);
~module_base();
// Add elements to the module
void setattr(const char* name, PyObject*);
void setattr(const char* name, ref const&);
void add(PyTypeObject* x); // just use the type's name
void add_type(ref);
// Return a reference to the Python module object being built
inline ref object() const;
private:
ref m_module;
static PyMethodDef initial_methods[1];
};
//
// inline implementations
//
inline ref module_base::object() const
{
return m_module;
}
}}} // namespace boost::python::detail
#endif // MODULE_BASE_DWA2002227_HPP

View File

@@ -8,36 +8,14 @@
# include <boost/python/errors.hpp>
# include <boost/python/detail/config.hpp>
# include <boost/python/reference.hpp>
# include <boost/python/make_function.hpp>
# include <boost/python/objects.hpp>
# include <boost/python/detail/wrap_python.hpp>
# include <boost/python/class_fwd.hpp>
# include <boost/python/detail/module_base.hpp>
namespace boost { namespace python {
class BOOST_PYTHON_DECL module_base
{
public:
// Create a module. REQUIRES: only one module is created per module.
module_base(const char* name);
~module_base();
// Add elements to the module
void setattr(const char* name, PyObject*);
void setattr(const char* name, ref const&);
void add(PyTypeObject* x); // just use the type's name
void add_type(ref);
// Return a reference to the Python module object being built
ref object() const;
private:
ref m_module;
static PyMethodDef initial_methods[1];
};
class module : public module_base
class module : public detail::module_base
{
public:
module(const char* name)
@@ -76,11 +54,6 @@ class module : public module_base
//
// inline implementations
//
inline ref module_base::object() const
{
return m_module;
}
inline module& module::setattr(const char* name, PyObject* x)
{
this->module_base::setattr(name, x);

View File

@@ -6,7 +6,6 @@
#ifndef CLASS_DWA20011214_HPP
# define CLASS_DWA20011214_HPP
# include <boost/python/module.hpp>
# include <boost/python/detail/wrap_python.hpp>
# include <boost/python/detail/config.hpp>
# include <boost/utility.hpp>

View File

@@ -6,9 +6,10 @@
// The author gratefully acknowleges the support of Dragon Systems, Inc., in
// producing this work.
#include <boost/python/module.hpp>
#include <boost/python/detail/module_base.hpp>
#include <boost/python/object/function.hpp>
namespace boost { namespace python {
namespace boost { namespace python { namespace detail {
module_base::module_base(const char* name)
: m_module(
@@ -46,4 +47,4 @@ void module_base::add_type(ref x)
PyMethodDef module_base::initial_methods[] = { { 0, 0, 0, 0 } };
}} // namespace boost::python
}}} // namespace boost::python::detail

View File

@@ -3,8 +3,7 @@
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/python/detail/config.hpp>
#include <boost/python/detail/wrap_python.hpp>
#include <boost/python/converter/registry.hpp>
#include <boost/python/object/class.hpp>
#include <boost/python/objects.hpp>
#include <boost/python/detail/map_entry.hpp>