1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Extractor</title> 5<link rel="stylesheet" href="../../boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../index.html" title="Boost.Python Reference Manual"> 8<link rel="up" href="../concepts.html" title="Chapter 1. Concepts"> 9<link rel="prev" href="dereferenceable.html" title="Dereferenceable"> 10<link rel="next" href="holdergenerator.html" title="HolderGenerator"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../../images/boost.png"></td></tr></table> 14<hr> 15<div class="spirit-nav"> 16<a accesskey="p" href="dereferenceable.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="holdergenerator.html"><img src="../../images/next.png" alt="Next"></a> 17</div> 18<div class="section"> 19<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 20<a name="concepts.extractor"></a><a class="link" href="extractor.html" title="Extractor">Extractor</a> 21</h2></div></div></div> 22<div class="toc"><dl class="toc"> 23<dt><span class="section"><a href="extractor.html#concepts.extractor.introduction">Introduction</a></span></dt> 24<dt><span class="section"><a href="extractor.html#concepts.extractor.concept_requirements">Concept Requirements</a></span></dt> 25<dt><span class="section"><a href="extractor.html#concepts.extractor.notes">Notes</a></span></dt> 26</dl></div> 27<div class="section"> 28<div class="titlepage"><div><div><h3 class="title"> 29<a name="concepts.extractor.introduction"></a><a class="link" href="extractor.html#concepts.extractor.introduction" title="Introduction">Introduction</a> 30</h3></div></div></div> 31<p> 32 An Extractor is a class which Boost.Python can use to extract C++ objects 33 from Python objects, and is typically used by facilities that define <code class="computeroutput"><span class="identifier">from_python</span></code> conversions for "traditional" 34 Python extension types. 35 </p> 36</div> 37<div class="section"> 38<div class="titlepage"><div><div><h3 class="title"> 39<a name="concepts.extractor.concept_requirements"></a><a class="link" href="extractor.html#concepts.extractor.concept_requirements" title="Concept Requirements">Concept Requirements</a> 40</h3></div></div></div> 41<p> 42 In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes 43 a model of <code class="computeroutput"><span class="identifier">Extractor</span></code> and 44 <code class="computeroutput"><span class="identifier">a</span></code> denotes an instance of 45 a Python object type. 46 </p> 47<div class="informaltable"><table class="table"> 48<colgroup> 49<col> 50<col> 51<col> 52</colgroup> 53<thead><tr> 54<th> 55 <p> 56 Expression 57 </p> 58 </th> 59<th> 60 <p> 61 Type 62 </p> 63 </th> 64<th> 65 <p> 66 Semantics 67 </p> 68 </th> 69</tr></thead> 70<tbody> 71<tr> 72<td> 73 <p> 74 <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">execute</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> 75 </p> 76 </td> 77<td> 78 <p> 79 non-void 80 </p> 81 </td> 82<td> 83 <p> 84 Returns the C++ object being extracted. The execute function 85 must not be overloaded. 86 </p> 87 </td> 88</tr> 89<tr> 90<td> 91 <p> 92 <code class="computeroutput"><span class="special">&</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">ob_type</span></code> 93 </p> 94 </td> 95<td> 96 <p> 97 <code class="computeroutput"><span class="identifier">PyTypeObject</span><span class="special">**</span></code> 98 </p> 99 </td> 100<td> 101 <p> 102 Points to the <code class="computeroutput"><span class="identifier">ob_type</span></code> 103 field of an object which is layout-compatible with <code class="computeroutput"><span class="identifier">PyObject</span></code> 104 </p> 105 </td> 106</tr> 107</tbody> 108</table></div> 109</div> 110<div class="section"> 111<div class="titlepage"><div><div><h3 class="title"> 112<a name="concepts.extractor.notes"></a><a class="link" href="extractor.html#concepts.extractor.notes" title="Notes">Notes</a> 113</h3></div></div></div> 114<p> 115 Informally, an Extractor's execute member must be a non-overloaded static 116 function whose single argument is a Python object type. Acceptable Python 117 object types include those publicly (and unambiguously) derived from PyObject, 118 and POD types which are layout-compatible with PyObject. 119 </p> 120</div> 121</div> 122<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 123<td align="left"></td> 124<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2015 David Abrahams, Stefan Seefeld<p> 125 Distributed under the Boost Software License, Version 1.0. (See accompanying 126 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a> 127 </p> 128</div></td> 129</tr></table> 130<hr> 131<div class="spirit-nav"> 132<a accesskey="p" href="dereferenceable.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="holdergenerator.html"><img src="../../images/next.png" alt="Next"></a> 133</div> 134</body> 135</html> 136