1 | <!-- Copyright David Abrahams 2006. Distributed under the Boost --> |
---|
2 | <!-- Software License, Version 1.0. (See accompanying --> |
---|
3 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> |
---|
4 | <html> |
---|
5 | <head> |
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
7 | <link rel="stylesheet" type="text/css" href=../../../../boost.css> |
---|
8 | <title>Boost.Python - Extractor Concept</title> |
---|
9 | </head> |
---|
10 | <body link="#0000ff" vlink="#800080"> |
---|
11 | <table border="0" cellpadding="7" cellspacing="0" width="100%" summary= |
---|
12 | "header"> |
---|
13 | <tr> |
---|
14 | <td valign="top" width="300"> |
---|
15 | <h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../boost.png" border="0"></a></h3> |
---|
16 | </td> |
---|
17 | <td valign="top"> |
---|
18 | <h1 align="center"><a href="../index.html">Boost.Python</a></h1> |
---|
19 | <h2 align="center">Extractor Concept</h2> |
---|
20 | </td> |
---|
21 | </tr> |
---|
22 | </table> |
---|
23 | <hr> |
---|
24 | <dl class="page-index"> |
---|
25 | <dt><a href="#introduction">Introduction</a></dt> |
---|
26 | <dt><a href="#concept-requirements">Concept Requirements</a></dt> |
---|
27 | <dl class="page-index"> |
---|
28 | <dt><a href="#Extractor-concept">Extractor Concept</a></dt> |
---|
29 | </dl> |
---|
30 | <dt><a href="#notes">Notes</a></dt> |
---|
31 | </dl> |
---|
32 | |
---|
33 | <h2><a name="introduction"></a>Introduction</h2> |
---|
34 | |
---|
35 | <p>An Extractor is a class which Boost.Python can use to extract C++ |
---|
36 | objects from Python objects, and is typically used by facilities that |
---|
37 | define <code>from_python</code> conversions for |
---|
38 | "traditional" Python extension types. |
---|
39 | |
---|
40 | <h2><a name="concept-requirements"></a>Concept Requirements</h2> |
---|
41 | <h3><a name="Extractor-concept"></a>Extractor Concept</h3> |
---|
42 | |
---|
43 | <p>In the table below, <code><b>X</b></code> denotes a model of |
---|
44 | Extractor and <code><b>a</b></code> denotes an instance of a Python |
---|
45 | object type. |
---|
46 | |
---|
47 | <table summary="Extractor expressions" border="1" cellpadding="5"> |
---|
48 | |
---|
49 | <tr> |
---|
50 | <td><b>Expression</b></td> |
---|
51 | <td><b>Type</b></td> |
---|
52 | <td><b>Semantics</b></td> |
---|
53 | </tr> |
---|
54 | |
---|
55 | <tr> |
---|
56 | <td valign="top"><code>X::execute(a)</code></td> |
---|
57 | <td>non-void |
---|
58 | <td>Returns the C++ object being extracted. The |
---|
59 | <code>execute</code> function must not be overloaded. |
---|
60 | </tr> |
---|
61 | |
---|
62 | <tr> |
---|
63 | <td valign="top"><code>&a.ob_type</code> |
---|
64 | <td><code><a |
---|
65 | href="http://www.python.org/doc/2.2/ext/dnt-type-methods.html">PyTypeObject</a>**</code> |
---|
66 | <td>Points to the <code>ob_type</code> field of an object which is |
---|
67 | layout-compatible with <code>PyObject</code> |
---|
68 | </tr> |
---|
69 | |
---|
70 | </tr> |
---|
71 | |
---|
72 | </table> |
---|
73 | |
---|
74 | <h2><a name="notes"></a>Notes</h2> |
---|
75 | |
---|
76 | Informally, an Extractor's <code>execute</code> member must be a |
---|
77 | non-overloaded static function whose single argument is a Python |
---|
78 | object type. Acceptable Python object types include those publicly (and |
---|
79 | unambiguously) derived from <code>PyObject</code>, and POD types which |
---|
80 | are layout-compatible with PyObject. |
---|
81 | |
---|
82 | <hr> |
---|
83 | <p>Revised |
---|
84 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
---|
85 | 13 November, 2002 |
---|
86 | <!--webbot bot="Timestamp" endspan i-checksum="39359" --> |
---|
87 | </p> |
---|
88 | <p><i>© Copyright <a href="../../../../people/dave_abrahams.htm">Dave |
---|
89 | Abrahams</a> 2002. </i> |
---|
90 | |
---|
91 | <p>Permission to copy, use, modify, sell |
---|
92 | and distribute this software is granted provided this copyright notice appears |
---|
93 | in all copies. This software is provided "as is" without express or implied |
---|
94 | warranty, and with no claim as to its suitability for any purpose. |
---|
95 | </body> |
---|
96 | </html> |
---|