- ResultConverterGenerator
+ ResultConverterGenerator
A model of ResultConverterGenerator .
diff --git a/doc/v2/type_id.html b/doc/v2/type_id.html
new file mode 100755
index 00000000..6407f913
--- /dev/null
+++ b/doc/v2/type_id.html
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+ Boost.Python - <boost/python/type_id.hpp>
+
+
+
+
+
+
+
+
+ Boost.Python
+
+ Header <boost/python/type_id.hpp>
+
+
+
+ Contents
+
+
+ Introduction
+
+ Classes
+
+
+
+ Class
+ type_info
+
+
+
+ Class
+ type_info synopsis
+
+ Class
+ type_info constructor
+
+ Class
+ type_info comparison functions
+
+ Class
+ type_info observer functions
+
+
+
+ Functions
+
+
+
+ type_id
+
+
+ Example
+
+
+
+ Introduction
+
+ <boost/python/type_id.hpp> provides types and
+ functions for runtime type identification like those of of
+ <typeinfo>. It exists mostly to work around
+ certain compiler bugs and platform-dependent interactions with
+ shared libraries.
+
+
Classes
+
+ Class type_info
+
+ type_info instances identify a type. As
+ std::type_info is specified to (but unlike its
+ implementation in some compilers),
+ boost::python::type_info never represents top-level
+ references or cv-qualification (see section 5.2.8 in the C++
+ standard). Unlike std::type_info,
+ boost::python::type_info instances are copyable, and
+ comparisons always work reliably across shared library boundaries.
+
+
Class type_info
+ synopsis
+
+namespace boost { namespace python
+{
+ class type_info : totally_ordered <type_info>
+ {
+ public:
+ // constructor
+ type_info(std::type_info const& = typeid(void));
+
+ // comparisons
+ bool operator<(type_info const& rhs) const;
+ bool operator==(type_info const& rhs) const;
+
+ // observers
+ char const* name() const;
+ };
+}}
+
+
+
+
+type_info(std::type_info const& = typeid(void));
+
+
+
+ Effects: constructs a type_info object
+ which identifies the same type as its argument.
+
+ Rationale: Since it is occasionally neccessary to make
+ an array of type_info objects a benign default
+ argument is supplied. Note: this
+ constructor does not correct for non-conformance of
+ compiler typeid() implementations. See type_id , below.
+
+
+
+
+bool operator<(type_info const& rhs) const;
+
+
+
+ Effects: yields a total order over
+ type_info objects.
+
+
+bool operator==(type_info const& rhs) const;
+
+
+
+ Returns: true iff the two values describe
+ the same type.
+
+
+
+ Note: The use of totally_ordered <type_info>
+ as a private base class supplies operators <=,
+ >=, >, and !=
+
+
+
+
+char const* name() const;
+
+
+
+ Returns: The result of calling name() on
+ the argument used to construct the object.
+
+
+ Functions
+
+std::ostream& operator<<(std::ostream&s, type_info const&x);
+
+
+
+ Effects: Writes a description of the type described by
+ to x into s.
+
+ Rationale: Not every C++ implementation provides a
+ truly human-readable type_info::name() string, but
+ for some we may be able to decode the string and produce a
+ reasonable representation.
+
+
+template <class T> type_info type_id ()
+
+
+
+ Returns: type_info(typeid(T))
+
+ Note: On some non-conforming C++ implementations, the
+ code is not actually as simple as described above; the semantics
+ are adjusted to work as-if the C++ implementation were
+ conforming.
+
+
+ Example
+ The following example, though silly, illustrates how the
+ type_id facility might be used
+
+#include <boost/python/type_id.hpp>
+
+// Returns true iff the user passes an int argument
+template <class T>
+bool is_int(T x)
+{
+ using boost::python::type_id;
+ return type_id<T>() == type_id<int>();
+}
+
+
+ Revised
+
+ 18 November, 2002
+
+
+
+
© Copyright Dave Abrahams 2002. All
+ Rights Reserved.
+
diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp
index 16f6a4cf..50afba85 100644
--- a/include/boost/python/class.hpp
+++ b/include/boost/python/class.hpp
@@ -11,7 +11,7 @@
# include
# include
# include
-# include
+# include
# include
# include
# include
@@ -194,7 +194,7 @@ class class_ : public objects::class_base
id_vector()
{
// Stick the derived class id into the first element of the array
- ids[0] = converter::undecorated_type_id();
+ ids[0] = type_id();
// Write the rest of the elements into succeeding positions.
class_id* p = ids + 1;
@@ -276,9 +276,9 @@ namespace detail
typedef void type;
// Here's the runtime behavior
- static void execute(converter::undecorated_type_id_t** p)
+ static void execute(type_info** p)
{
- *(*p)++ = converter::undecorated_type_id();
+ *(*p)++ = type_id();
}
};
};
diff --git a/include/boost/python/converter/callback.hpp b/include/boost/python/converter/callback.hpp
index 9e9c694f..ae399eed 100644
--- a/include/boost/python/converter/callback.hpp
+++ b/include/boost/python/converter/callback.hpp
@@ -6,7 +6,6 @@
#ifndef CALLBACK_DWA2002228_HPP
# define CALLBACK_DWA2002228_HPP
-# include
# include
# include
# include
diff --git a/include/boost/python/converter/from_python.hpp b/include/boost/python/converter/from_python.hpp
index 40a75645..12740439 100644
--- a/include/boost/python/converter/from_python.hpp
+++ b/include/boost/python/converter/from_python.hpp
@@ -8,6 +8,7 @@
# include
# include
+# include
# include
# include
# include
diff --git a/include/boost/python/converter/lvalue_from_python_chain.hpp b/include/boost/python/converter/lvalue_from_python_chain.hpp
index 2a86bcfa..7a064841 100644
--- a/include/boost/python/converter/lvalue_from_python_chain.hpp
+++ b/include/boost/python/converter/lvalue_from_python_chain.hpp
@@ -6,9 +6,11 @@
#ifndef LVALUE_FROM_PYTHON_CHAIN_DWA200237_HPP
# define LVALUE_FROM_PYTHON_CHAIN_DWA200237_HPP
+# include
# include
# include
# include
+# include
namespace boost { namespace python { namespace converter {
@@ -39,7 +41,7 @@ namespace detail
template
lvalue_from_python_registration*const&
ref_lvalue_from_python_chain::value
- = registry::lvalue_converters(undecorated_type_id());
+ = registry::lvalue_converters(type_id());
template
struct select_lvalue_from_python_chain
diff --git a/include/boost/python/converter/pointee_to_python_function.hpp b/include/boost/python/converter/pointee_to_python_function.hpp
index 0f1ae99e..039914a9 100644
--- a/include/boost/python/converter/pointee_to_python_function.hpp
+++ b/include/boost/python/converter/pointee_to_python_function.hpp
@@ -9,7 +9,6 @@
# include
# include
# include
-# include
# include
# include
# include
diff --git a/include/boost/python/converter/pointer_type_id.hpp b/include/boost/python/converter/pointer_type_id.hpp
index 79a30b02..01e55977 100644
--- a/include/boost/python/converter/pointer_type_id.hpp
+++ b/include/boost/python/converter/pointer_type_id.hpp
@@ -6,7 +6,7 @@
#ifndef POINTER_TYPE_ID_DWA2002222_HPP
# define POINTER_TYPE_ID_DWA2002222_HPP
-# include
+# include
# include
namespace boost { namespace python { namespace converter {
@@ -17,9 +17,9 @@ namespace detail
struct pointer_typeid_select
{
template
- static inline undecorated_type_id_t execute(T*(*)() = 0)
+ static inline type_info execute(T*(*)() = 0)
{
- return undecorated_type_id();
+ return type_id();
}
};
@@ -27,37 +27,37 @@ namespace detail
struct pointer_typeid_select
{
template
- static inline undecorated_type_id_t execute(T* const volatile&(*)() = 0)
+ static inline type_info execute(T* const volatile&(*)() = 0)
{
- return undecorated_type_id();
+ return type_id();
}
template
- static inline undecorated_type_id_t execute(T*volatile&(*)() = 0)
+ static inline type_info execute(T*volatile&(*)() = 0)
{
- return undecorated_type_id();
+ return type_id();
}
template
- static inline undecorated_type_id_t execute(T*const&(*)() = 0)
+ static inline type_info execute(T*const&(*)() = 0)
{
- return undecorated_type_id();
+ return type_id();
}
template
- static inline undecorated_type_id_t execute(T*&(*)() = 0)
+ static inline type_info execute(T*&(*)() = 0)
{
- return undecorated_type_id();
+ return type_id();
}
};
}
// Usage: pointer_type_id()
//
-// Returns an undecorated_type_id_t associated with the type pointed
+// Returns a type_info associated with the type pointed
// to by T, which may be a pointer or a reference to a pointer.
template
-undecorated_type_id_t pointer_type_id(T(*)() = 0)
+type_info pointer_type_id(T(*)() = 0)
{
return detail::pointer_typeid_select<
is_reference::value
diff --git a/include/boost/python/converter/registry.hpp b/include/boost/python/converter/registry.hpp
index 72676605..cf5daa5e 100644
--- a/include/boost/python/converter/registry.hpp
+++ b/include/boost/python/converter/registry.hpp
@@ -5,7 +5,7 @@
// to its suitability for any purpose.
#ifndef REGISTRY_DWA20011127_HPP
# define REGISTRY_DWA20011127_HPP
-# include
+# include
# include
# include
# include
@@ -19,22 +19,22 @@ struct rvalue_from_python_registration;
// This namespace acts as a sort of singleton
namespace registry
{
- BOOST_PYTHON_DECL lvalue_from_python_registration*& lvalue_converters(undecorated_type_id_t);
- BOOST_PYTHON_DECL rvalue_from_python_registration*& rvalue_converters(undecorated_type_id_t);
+ BOOST_PYTHON_DECL lvalue_from_python_registration*& lvalue_converters(type_info);
+ BOOST_PYTHON_DECL rvalue_from_python_registration*& rvalue_converters(type_info);
BOOST_PYTHON_DECL to_python_function_t const&
- get_to_python_function(undecorated_type_id_t);
+ get_to_python_function(type_info);
- BOOST_PYTHON_DECL void insert(to_python_function_t, undecorated_type_id_t);
+ BOOST_PYTHON_DECL void insert(to_python_function_t, type_info);
// Insert an lvalue from_python converter
- BOOST_PYTHON_DECL void insert(void* (*convert)(PyObject*), undecorated_type_id_t);
+ BOOST_PYTHON_DECL void insert(void* (*convert)(PyObject*), type_info);
// Insert an rvalue from_python converter
BOOST_PYTHON_DECL void insert(
void* (*convertible)(PyObject*)
, constructor_function
- , undecorated_type_id_t
+ , type_info
);
// Insert an rvalue from_python converter at the tail of the
@@ -42,10 +42,10 @@ namespace registry
BOOST_PYTHON_DECL void push_back(
void* (*convertible)(PyObject*)
, constructor_function
- , undecorated_type_id_t
+ , type_info
);
- BOOST_PYTHON_DECL PyTypeObject*& class_object(undecorated_type_id_t key);
+ BOOST_PYTHON_DECL PyTypeObject*& class_object(type_info key);
}
}}} // namespace boost::python::converter
diff --git a/include/boost/python/converter/rvalue_from_python_chain.hpp b/include/boost/python/converter/rvalue_from_python_chain.hpp
index c57ef564..4576e7fc 100644
--- a/include/boost/python/converter/rvalue_from_python_chain.hpp
+++ b/include/boost/python/converter/rvalue_from_python_chain.hpp
@@ -5,6 +5,7 @@
// to its suitability for any purpose.
#ifndef RVALUE_FROM_PYTHON_CHAIN_DWA200237_HPP
# define RVALUE_FROM_PYTHON_CHAIN_DWA200237_HPP
+# include
# include
# include
# include
@@ -21,7 +22,7 @@ namespace detail
template
rvalue_from_python_registration*const& rvalue_from_python_chain_impl::value
- = registry::rvalue_converters(undecorated_type_id());
+ = registry::rvalue_converters(type_id());
}
template
diff --git a/include/boost/python/converter/to_python_function.hpp b/include/boost/python/converter/to_python_function.hpp
index ff3891e2..0112463e 100644
--- a/include/boost/python/converter/to_python_function.hpp
+++ b/include/boost/python/converter/to_python_function.hpp
@@ -9,7 +9,7 @@
# include
# include
# include
-# include
+# include
# include
# include
@@ -32,7 +32,7 @@ namespace detail
template
to_python_function_t const&
to_python_function_base::value
- = converter::registry::get_to_python_function(undecorated_type_id());
+ = converter::registry::get_to_python_function(type_id());
}
template
diff --git a/include/boost/python/converter/type_id.hpp b/include/boost/python/converter/type_id.hpp
deleted file mode 100644
index 015e55e9..00000000
--- a/include/boost/python/converter/type_id.hpp
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright David Abrahams 2001. 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 TYPE_ID_DWA20011127_HPP
-# define TYPE_ID_DWA20011127_HPP
-# include
-# include
-# include
-# include
-# include
-# include
-# include
-# include
-# include
-# include
-# include
-
-
-namespace boost { namespace python { namespace converter {
-
-// for this compiler at least, cross-shared-library type_info
-// comparisons don't work, so use typeid(x).name() instead. It's not
-// yet clear what the best default strategy is.
-# if defined(__GNUC__) && __GNUC__ >= 3
-# define BOOST_PYTHON_TYPE_ID_NAME
-# endif
-
-// type ids which represent the same information as std::type_info
-// (i.e. the top-level reference and cv-qualifiers are stripped), but
-// which works across shared libraries.
-struct undecorated_type_id_t : totally_ordered
-{
- undecorated_type_id_t(std::type_info const&);
-
- // default constructor needed to build arrays, etc.
- undecorated_type_id_t();
-
- bool operator<(undecorated_type_id_t const& rhs) const;
- bool operator==(undecorated_type_id_t const& rhs) const;
-
- char const* name() const;
- friend BOOST_PYTHON_DECL std::ostream& operator<<(
- std::ostream&, undecorated_type_id_t const&);
-
- private: // data members
-# ifdef BOOST_PYTHON_TYPE_ID_NAME
- typedef char const* base_id_t;
-# else
- typedef std::type_info const* base_id_t;
-# endif
-
- base_id_t m_base_type;
-};
-
-struct type_id_t : totally_ordered
-{
- enum decoration { const_ = 0x1, volatile_ = 0x2, reference = 0x4 };
-
- type_id_t(undecorated_type_id_t, decoration = decoration());
-
- bool operator<(type_id_t const& rhs) const;
- bool operator==(type_id_t const& rhs) const;
-
- friend BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, type_id_t const&);
-
- operator undecorated_type_id_t const&() const;
- private: // type
- typedef undecorated_type_id_t base_id_t;
-
- private: // data members
- decoration m_decoration;
- base_id_t m_base_type;
-};
-
-template
-inline undecorated_type_id_t undecorated_type_id(boost::type* = 0)
-{
- return undecorated_type_id_t(
-# if (!defined(BOOST_MSVC) || BOOST_MSVC > 1300) && (!defined(BOOST_INTEL_CXX_VERSION) || BOOST_INTEL_CXX_VERSION > 600)
- typeid(T)
-# else // strip the decoration which msvc and Intel mistakenly leave in
- python::detail::msvc_typeid()
-# endif
- );
-}
-
-template
-inline type_id_t type_id(boost::type* = 0)
-{
- return type_id_t(
- undecorated_type_id()
- , type_id_t::decoration(
- (is_const::value || python::detail::is_reference_to_const::value
- ? type_id_t::const_ : 0)
- | (is_volatile::value || python::detail::is_reference_to_volatile::value
- ? type_id_t::volatile_ : 0)
- | (is_reference::value ? type_id_t::reference : 0)
- )
- );
-}
-
-inline undecorated_type_id_t::undecorated_type_id_t(std::type_info const& id)
- : m_base_type(
-# ifdef BOOST_PYTHON_TYPE_ID_NAME
- id.name()
-# else
- &id
-# endif
- )
-{
-}
-
-inline undecorated_type_id_t::undecorated_type_id_t()
- : m_base_type()
-{
-}
-
-inline type_id_t::type_id_t(undecorated_type_id_t base_t, decoration decoration)
- : m_decoration(decoration)
- , m_base_type(base_t)
-{
-}
-
-inline bool undecorated_type_id_t::operator<(undecorated_type_id_t const& rhs) const
-{
-# ifdef BOOST_PYTHON_TYPE_ID_NAME
- return std::strcmp(m_base_type, rhs.m_base_type) < 0;
-# else
- return m_base_type->before(*rhs.m_base_type);
-# endif
-}
-
-inline bool type_id_t::operator<(type_id_t const& rhs) const
-{
- return m_decoration < rhs.m_decoration
- || m_decoration == rhs.m_decoration
- && m_base_type < rhs.m_base_type;
-}
-
-inline bool undecorated_type_id_t::operator==(undecorated_type_id_t const& rhs) const
-{
-# ifdef BOOST_PYTHON_TYPE_ID_NAME
- return !std::strcmp(m_base_type, rhs.m_base_type);
-# else
- return *m_base_type == *rhs.m_base_type;
-# endif
-}
-
-inline bool type_id_t::operator==(type_id_t const& rhs) const
-{
- return m_decoration == rhs.m_decoration && m_base_type == rhs.m_base_type;
-}
-
-inline type_id_t::operator undecorated_type_id_t const&() const
-{
- return m_base_type;
-}
-
-inline char const* undecorated_type_id_t::name() const
-{
-# ifdef BOOST_PYTHON_TYPE_ID_NAME
- return m_base_type;
-# else
- return m_base_type->name();
-# endif
-}
-
-
-BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, undecorated_type_id_t const&);
-BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, type_id_t const&);
-
-}}} // namespace boost::python::converter
-
-#endif // TYPE_ID_DWA20011127_HPP
diff --git a/include/boost/python/detail/decorated_type_id.hpp b/include/boost/python/detail/decorated_type_id.hpp
new file mode 100755
index 00000000..f70e369a
--- /dev/null
+++ b/include/boost/python/detail/decorated_type_id.hpp
@@ -0,0 +1,77 @@
+// 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 DECORATED_TYPE_ID_DWA2002517_HPP
+# define DECORATED_TYPE_ID_DWA2002517_HPP
+
+# include
+# include
+# include
+
+namespace boost { namespace python { namespace detail {
+
+struct decorated_type_info : totally_ordered
+{
+ enum decoration { const_ = 0x1, volatile_ = 0x2, reference = 0x4 };
+
+ decorated_type_info(type_info, decoration = decoration());
+
+ bool operator<(decorated_type_info const& rhs) const;
+ bool operator==(decorated_type_info const& rhs) const;
+
+ friend BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, decorated_type_info const&);
+
+ operator type_info const&() const;
+ private: // type
+ typedef type_info base_id_t;
+
+ private: // data members
+ decoration m_decoration;
+ base_id_t m_base_type;
+};
+
+template
+inline decorated_type_info decorated_type_id(boost::type* = 0)
+{
+ return decorated_type_info(
+ type_id()
+ , decorated_type_info::decoration(
+ (is_const::value || python::detail::is_reference_to_const::value
+ ? decorated_type_info::const_ : 0)
+ | (is_volatile::value || python::detail::is_reference_to_volatile::value
+ ? decorated_type_info::volatile_ : 0)
+ | (is_reference::value ? decorated_type_info::reference : 0)
+ )
+ );
+}
+
+inline decorated_type_info::decorated_type_info(type_info base_t, decoration decoration)
+ : m_decoration(decoration)
+ , m_base_type(base_t)
+{
+}
+
+inline bool decorated_type_info::operator<(decorated_type_info const& rhs) const
+{
+ return m_decoration < rhs.m_decoration
+ || m_decoration == rhs.m_decoration
+ && m_base_type < rhs.m_base_type;
+}
+
+inline bool decorated_type_info::operator==(decorated_type_info const& rhs) const
+{
+ return m_decoration == rhs.m_decoration && m_base_type == rhs.m_base_type;
+}
+
+inline decorated_type_info::operator type_info const&() const
+{
+ return m_base_type;
+}
+
+BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, decorated_type_info const&);
+
+}}} // namespace boost::python::detail
+
+#endif // DECORATED_TYPE_ID_DWA2002517_HPP
diff --git a/include/boost/python/implicit.hpp b/include/boost/python/implicit.hpp
index f7146e40..a6e73eba 100644
--- a/include/boost/python/implicit.hpp
+++ b/include/boost/python/implicit.hpp
@@ -8,7 +8,7 @@
# include
# include
# include
-# include
+# include
namespace boost { namespace python {
@@ -20,7 +20,7 @@ void implicitly_convertible(boost::type* = 0, boost::type* = 0)
converter::registry::push_back(
&functions::convertible
, &functions::construct
- , converter::undecorated_type_id());
+ , type_id());
}
}} // namespace boost::python
diff --git a/include/boost/python/instance_holder.hpp b/include/boost/python/instance_holder.hpp
new file mode 100755
index 00000000..eb148431
--- /dev/null
+++ b/include/boost/python/instance_holder.hpp
@@ -0,0 +1,43 @@
+// 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 INSTANCE_HOLDER_DWA2002517_HPP
+# define INSTANCE_HOLDER_DWA2002517_HPP
+
+# include
+# include
+
+namespace boost { namespace python {
+
+// Base class for all holders
+struct BOOST_PYTHON_DECL instance_holder : private noncopyable
+{
+ public:
+ instance_holder();
+ virtual ~instance_holder();
+
+ // return the next holder in a chain
+ instance_holder* next() const;
+
+ virtual void* holds(type_info) = 0;
+
+ void install(PyObject* inst) throw();
+ private:
+ instance_holder* m_next;
+};
+// This macro is needed for implementation of derived holders
+# define BOOST_PYTHON_UNFORWARD(N,ignored) (typename unforward::type)(a##N)
+
+//
+// implementation
+//
+inline instance_holder* instance_holder::next() const
+{
+ return m_next;
+}
+
+}} // namespace boost::python
+
+#endif // INSTANCE_HOLDER_DWA2002517_HPP
diff --git a/include/boost/python/make_function.hpp b/include/boost/python/make_function.hpp
index 5ce5ec7d..47579fd5 100644
--- a/include/boost/python/make_function.hpp
+++ b/include/boost/python/make_function.hpp
@@ -35,8 +35,8 @@ objects::function* make_function(F f, Policies const& policies)
, detail::arg_tuple_size::value);
}
-template
-objects::function* make_constructor(Holder* = 0, ArgList* = 0)
+template
+objects::function* make_constructor(HolderGenerator* = 0, ArgList* = 0)
{
enum { nargs = mpl::size::value };
@@ -44,13 +44,13 @@ objects::function* make_constructor(Holder* = 0, ArgList* = 0)
objects::py_function(
::boost::bind(detail::caller(),
objects::make_holder
- ::template apply::execute
+ ::template apply::execute
, _1, _2, default_call_policies()))
, nargs + 1);
}
-template
-objects::function* make_constructor(Policies const& policies, Holder* = 0, ArgList* = 0)
+template
+objects::function* make_constructor(Policies const& policies, HolderGenerator* = 0, ArgList* = 0)
{
enum { nargs = mpl::size::value };
@@ -58,7 +58,7 @@ objects::function* make_constructor(Policies const& policies, Holder* = 0, ArgLi
objects::py_function(
::boost::bind(detail::caller(),
objects::make_holder
- ::template apply::execute
+ ::template apply::execute
, _1, _2, policies))
, nargs + 1);
}
diff --git a/include/boost/python/object/class.hpp b/include/boost/python/object/class.hpp
index 4d8d3bbe..466b6e44 100644
--- a/include/boost/python/object/class.hpp
+++ b/include/boost/python/object/class.hpp
@@ -9,8 +9,9 @@
# include
# include
# include
-# include
+# include
# include
+# include
# include
namespace boost { namespace python {
@@ -19,10 +20,8 @@ class module;
namespace objects {
-template struct holder;
-
// To identify a class, we don't need cv/reference decorations
-typedef converter::undecorated_type_id_t class_id;
+typedef type_info class_id;
struct BOOST_PYTHON_DECL class_base : private noncopyable
{
@@ -46,25 +45,6 @@ struct BOOST_PYTHON_DECL class_base : private noncopyable
BOOST_PYTHON_DECL ref registered_class_object(class_id id);
-// Base class for all holders
-struct BOOST_PYTHON_DECL instance_holder : private noncopyable
-{
- public:
- instance_holder();
- virtual ~instance_holder();
-
- // return the next holder in a chain
- instance_holder* next() const;
-
- virtual void* holds(converter::undecorated_type_id_t) = 0;
-
- void install(PyObject* inst) throw();
- private:
- instance_holder* m_next;
-};
-// This macro is needed for implementation of derived holders
-# define BOOST_PYTHON_UNFORWARD(N,ignored) (typename unforward::type)(a##N)
-
// Each extension instance will be one of these
struct instance
{
@@ -75,14 +55,6 @@ struct instance
BOOST_PYTHON_DECL ref class_metatype();
BOOST_PYTHON_DECL ref class_type();
-//
-// implementation
-//
-inline instance_holder* instance_holder::next() const
-{
- return m_next;
-}
-
}}} // namespace boost::python::objects
#endif // CLASS_DWA20011214_HPP
diff --git a/include/boost/python/object/class_object.hpp b/include/boost/python/object/class_object.hpp
index 76960762..57a8ee5d 100644
--- a/include/boost/python/object/class_object.hpp
+++ b/include/boost/python/object/class_object.hpp
@@ -6,7 +6,7 @@
#ifndef CLASS_OBJECT_DWA200222_HPP
# define CLASS_OBJECT_DWA200222_HPP
-# include
+# include
# include
namespace boost { namespace python { namespace objects {
@@ -18,8 +18,8 @@ struct class_object
};
template
-PyTypeObject*& class_object::reference = converter::registry::class_object(
- converter::undecorated_type_id());
+PyTypeObject*& class_object::reference
+ = converter::registry::class_object(python::type_id());
}}} // namespace boost::python::objects
diff --git a/include/boost/python/object/find_instance.hpp b/include/boost/python/object/find_instance.hpp
index 3db670fc..44c79550 100644
--- a/include/boost/python/object/find_instance.hpp
+++ b/include/boost/python/object/find_instance.hpp
@@ -6,14 +6,14 @@
#ifndef FIND_INSTANCE_DWA2002312_HPP
# define FIND_INSTANCE_DWA2002312_HPP
-# include
+# include
# include
namespace boost { namespace python { namespace objects {
-// Given an undecorated type_id, find the instance data which
-// corresponds to it, or return 0 in case no such type is held.
-BOOST_PYTHON_DECL void* find_instance_impl(PyObject*, converter::undecorated_type_id_t);
+// Given a type_id, find the instance data which corresponds to it, or
+// return 0 in case no such type is held.
+BOOST_PYTHON_DECL void* find_instance_impl(PyObject*, type_info);
// This produces a function with the right signature for use in from_python conversions
template
@@ -21,14 +21,14 @@ struct instance_finder
{
instance_finder()
{
- converter::registry::insert(&execute, converter::undecorated_type_id());
+ converter::registry::insert(&execute, python::type_id());
}
static instance_finder const registration;
private:
static inline void* execute(PyObject* p)
{
- return find_instance_impl(p, converter::undecorated_type_id());
+ return find_instance_impl(p, python::type_id());
}
};
diff --git a/include/boost/python/object/inheritance.hpp b/include/boost/python/object/inheritance.hpp
index ceeac8f9..5129e35e 100644
--- a/include/boost/python/object/inheritance.hpp
+++ b/include/boost/python/object/inheritance.hpp
@@ -6,13 +6,15 @@
#ifndef INHERITANCE_DWA200216_HPP
# define INHERITANCE_DWA200216_HPP
-# include
+# include
# include
+# include
+# include
namespace boost { namespace python { namespace objects {
-typedef converter::undecorated_type_id_t class_id;
-using converter::undecorated_type_id;
+typedef type_info class_id;
+using python::type_id;
// Types used to get address and id of most derived type
typedef std::pair dynamic_id_t;
@@ -70,7 +72,7 @@ struct non_polymorphic_id_generator
{
static dynamic_id_t execute(void* p_)
{
- return std::make_pair(p_, converter::undecorated_type_id());
+ return std::make_pair(p_, python::type_id());
}
};
@@ -91,7 +93,7 @@ void register_dynamic_id(T* = 0)
{
typedef typename dynamic_id_generator::type generator;
register_dynamic_id_aux(
- converter::undecorated_type_id(), &generator::execute);
+ python::type_id(), &generator::execute);
}
//
@@ -154,8 +156,8 @@ inline void register_conversion(
{
typedef typename cast_generator::type generator;
- add_cast(converter::undecorated_type_id()
- , converter::undecorated_type_id()
+ add_cast(python::type_id()
+ , python::type_id()
, &generator::execute
, is_downcast);
}
diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp
index c3bffa2c..6d0ef81c 100644
--- a/include/boost/python/object/pointer_holder.hpp
+++ b/include/boost/python/object/pointer_holder.hpp
@@ -7,7 +7,7 @@
# define POINTER_HOLDER_DWA20011215_HPP
# include
-# include
+# include
# include
# include
# include
@@ -46,7 +46,7 @@ struct pointer_holder : instance_holder
BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_POINTER_HOLDER,nil)
private: // required holder implementation
- void* holds(converter::undecorated_type_id_t);
+ void* holds(type_info);
private: // data members
Pointer m_p;
@@ -84,45 +84,45 @@ struct pointer_holder_back_reference : instance_holder
BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_POINTER_HOLDER_BACK_REFERENCE,nil)
private: // required holder implementation
- void* holds(converter::undecorated_type_id_t);
+ void* holds(type_info);
private: // data members
Pointer m_p;
};
template
-pointer_holder::pointer_holder(Pointer p)
+inline pointer_holder::pointer_holder(Pointer p)
: m_p(p)
{
}
template
-pointer_holder_back_reference::pointer_holder_back_reference(Pointer p)
+inline pointer_holder_back_reference::pointer_holder_back_reference(Pointer p)
: m_p(p)
{
}
template
-void* pointer_holder::holds(converter::undecorated_type_id_t dst_t)
+void* pointer_holder::holds(type_info dst_t)
{
- if (dst_t == converter::undecorated_type_id())
+ if (dst_t == python::type_id())
return &this->m_p;
- converter::type_id_t src_t = converter::undecorated_type_id();
+ type_info src_t = python::type_id();
return src_t == dst_t ? &*this->m_p
: find_dynamic_type(&*this->m_p, src_t, dst_t);
}
template
-void* pointer_holder_back_reference::holds(converter::undecorated_type_id_t dst_t)
+void* pointer_holder_back_reference::holds(type_info dst_t)
{
- if (dst_t == converter::undecorated_type_id())
+ if (dst_t == python::type_id())
return &this->m_p;
- if (dst_t == converter::undecorated_type_id())
+ if (dst_t == python::type_id())
return &*this->m_p;
- converter::type_id_t src_t = converter::undecorated_type_id();
+ type_info src_t = python::type_id();
Value* p = &*this->m_p;
return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
}
diff --git a/include/boost/python/object/value_holder.hpp b/include/boost/python/object/value_holder.hpp
index 49251921..3543d61b 100644
--- a/include/boost/python/object/value_holder.hpp
+++ b/include/boost/python/object/value_holder.hpp
@@ -8,7 +8,7 @@
# include
# include
-# include
+# include
# include
# include
# include
@@ -40,7 +40,7 @@ struct value_holder : instance_holder
BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_VALUE_HOLDER,nil)
private: // required holder implementation
- void* holds(converter::undecorated_type_id_t);
+ void* holds(type_info);
private: // data members
Held m_held;
@@ -72,32 +72,32 @@ struct value_holder_back_reference : instance_holder
BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_VALUE_HOLDER_BACK_REFERENCE,nil)
private: // required holder implementation
- void* holds(converter::undecorated_type_id_t);
+ void* holds(type_info);
private: // data members
BackReferenceType m_held;
};
template
-void* value_holder::holds(converter::undecorated_type_id_t dst_t)
+void* value_holder::holds(type_info dst_t)
{
- converter::undecorated_type_id_t src_t = converter::undecorated_type_id();
+ type_info src_t = python::type_id();
return src_t == dst_t ? &m_held
: find_static_type(&m_held, src_t, dst_t);
}
template
void* value_holder_back_reference::holds(
- converter::undecorated_type_id_t dst_t)
+ type_info dst_t)
{
- converter::undecorated_type_id_t src_t = converter::undecorated_type_id();
+ type_info src_t = python::type_id();
if (src_t == dst_t)
{
Held* x = &m_held;
return x;
}
- src_t = converter::undecorated_type_id();
+ src_t = python::type_id();
return src_t == dst_t
? &m_held
: find_static_type(&m_held, src_t, dst_t);
diff --git a/include/boost/python/to_python_converter.hpp b/include/boost/python/to_python_converter.hpp
index 47473419..f5155e58 100644
--- a/include/boost/python/to_python_converter.hpp
+++ b/include/boost/python/to_python_converter.hpp
@@ -8,7 +8,7 @@
# include
# include
-# include
+# include
namespace boost { namespace python {
@@ -31,7 +31,7 @@ to_python_converter::to_python_converter()
converter::registry::insert(
&normalized::convert
- , converter::undecorated_type_id());
+ , type_id());
}
}} // namespace boost::python
diff --git a/include/boost/python/to_python_value.hpp b/include/boost/python/to_python_value.hpp
index ffb68ada..8f3b0e22 100644
--- a/include/boost/python/to_python_value.hpp
+++ b/include/boost/python/to_python_value.hpp
@@ -7,7 +7,6 @@
# define TO_PYTHON_VALUE_DWA200221_HPP
# include
-# include
# include
# include
# include
diff --git a/include/boost/python/type_from_python.hpp b/include/boost/python/type_from_python.hpp
index 38d2ceea..9fcd1f8f 100644
--- a/include/boost/python/type_from_python.hpp
+++ b/include/boost/python/type_from_python.hpp
@@ -6,6 +6,7 @@
#ifndef TYPE_FROM_PYTHON_DWA2002130_HPP
# define TYPE_FROM_PYTHON_DWA2002130_HPP
+# include