diff --git a/doc/v2/to_python_indirect.html b/doc/v2/to_python_indirect.html new file mode 100644 index 00000000..8910cd97 --- /dev/null +++ b/doc/v2/to_python_indirect.html @@ -0,0 +1,194 @@ + + + + + +
|
+ |
+ Boost.Python+ +Header <boost/python/to_python_indirect.hpp>+ |
to_python_indirect
+
+ to_python_indirect synopsis
+
+ to_python_indirect observer functions
+
+ to_python_indirect static functions
+ <boost/python/to_python_indirect.hpp> supplies
+ a way to construct new Python objects that hold wrapped C++ class
+ instances via a pointer or smart pointer.
+
+ to_python_indirectClass template to_python_indirect converts objects
+of its first argument type to python as extension class instances, using the ownership policy provided by its 2nd argument.
+
+
+ + +
| Parameter + + | Requirements + + | Description + + |
|---|---|---|
T
+
+ | Either U cv&
+ (where cv is any optional cv-qualification) or a Dereferenceable type such that
+ *x is convertible to U const&, where
+ U is a class type.
+
+ | A type deferencing a C++ class exposed to Python using
+ class template class_.
+
+ |
MakeHolder
+
+ | h = MakeHolder::execute(p); + + | A class whose static execute() creates an
+ instance_holder.
+
+ |
to_python_indirect are models of ResultConverter.
+
+
+ to_python_indirect synopsis
+namespace boost { namespace python
+{
+ template <class T, class MakeHolder>
+ struct to_python_indirect
+ {
+ static bool convertible();
+ PyObject* operator()(T ptr_or_reference) const;
+ private:
+ static PyTypeObject* type();
+ };
+}}
+
+
+ to_python_indirect observers+PyObject* operator()(T x) const; ++ +
x refers to an object (if it
+ is a pointer type, it is non-null). convertible() ==
+ true.
+
+ MakeHolder to create
+ an instance_holder from x, installs
+ the instance_holder in the new extension class
+ instance, and returns a pointer to it.
+
+ to_python_indirect statics+bool convertible(); ++ +
true iff any module has
+ registered a Python type corresponding to U.
+
+
+
+struct make_reference_holder
+{
+ typedef boost::python::objects::instance_holder* result_type;
+ template <class T>
+ static result_type execute(T* p)
+ {
+ return new boost::python::objects::pointer_holder<T*, T>(p);
+ }
+};
+
+struct reference_existing_object
+{
+ // metafunction returning the ResultConverter
+ template <class T>
+ struct apply
+ {
+ typedef boost::python::to_python_indirect<T,make_reference_holder> type;
+ };
+};
+
+
+ Revised + + 16 February, 2002 + + + +
© Copyright Dave + Abrahams 2002. All Rights Reserved. +