1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>ResultConverter</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="holdergenerator.html" title="HolderGenerator"> 10<link rel="next" href="objectwrapper.html" title="ObjectWrapper"> 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="holdergenerator.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="objectwrapper.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.resultconverter"></a><a class="link" href="resultconverter.html" title="ResultConverter">ResultConverter</a> 21</h2></div></div></div> 22<div class="toc"><dl class="toc"> 23<dt><span class="section"><a href="resultconverter.html#concepts.resultconverter.introduction">Introduction</a></span></dt> 24<dt><span class="section"><a href="resultconverter.html#concepts.resultconverter.resultconverter_concept_requirem">ResultConverter 25 Concept Requirements</a></span></dt> 26<dt><span class="section"><a href="resultconverter.html#concepts.resultconverter.resultconvertergenerator_concept">ResultConverterGenerator 27 Concept Requirements</a></span></dt> 28</dl></div> 29<div class="section"> 30<div class="titlepage"><div><div><h3 class="title"> 31<a name="concepts.resultconverter.introduction"></a><a class="link" href="resultconverter.html#concepts.resultconverter.introduction" title="Introduction">Introduction</a> 32</h3></div></div></div> 33<p> 34 A ResultConverter for a type <code class="computeroutput"><span class="identifier">T</span></code> 35 is a type whose instances can be used to convert C++ return values of type 36 <code class="computeroutput"><span class="identifier">T</span></code> <code class="computeroutput"><span class="identifier">to_python</span></code>. 37 A ResultConverterGenerator is an MPL unary metafunction class which, given 38 the return type of a C++ function, returns a ResultConverter for that type. 39 ResultConverters in Boost.Python generally inspect library's registry of 40 converters to find a suitable converter, but converters which don't use 41 the registry are also possible. 42 </p> 43</div> 44<div class="section"> 45<div class="titlepage"><div><div><h3 class="title"> 46<a name="concepts.resultconverter.resultconverter_concept_requirem"></a><a class="link" href="resultconverter.html#concepts.resultconverter.resultconverter_concept_requirem" title="ResultConverter Concept Requirements">ResultConverter 47 Concept Requirements</a> 48</h3></div></div></div> 49<p> 50 In the table below, <code class="computeroutput"><span class="identifier">C</span></code> denotes 51 a ResultConverter type for a type <code class="computeroutput"><span class="identifier">R</span></code>, 52 <code class="computeroutput"><span class="identifier">c</span></code> denotes an object of 53 type <code class="computeroutput"><span class="identifier">C</span></code>, and <code class="computeroutput"><span class="identifier">r</span></code> denotes an object of type <code class="computeroutput"><span class="identifier">R</span></code>. 54 </p> 55<div class="informaltable"><table class="table"> 56<colgroup> 57<col> 58<col> 59<col> 60</colgroup> 61<thead><tr> 62<th> 63 <p> 64 Expression 65 </p> 66 </th> 67<th> 68 <p> 69 Type 70 </p> 71 </th> 72<th> 73 <p> 74 Semantics 75 </p> 76 </th> 77</tr></thead> 78<tbody> 79<tr> 80<td> 81 <p> 82 <code class="computeroutput"><span class="identifier">C</span> <span class="identifier">c</span></code> 83 </p> 84 </td> 85<td> 86 </td> 87<td> 88 <p> 89 Constructs a <code class="computeroutput"><span class="identifier">c</span></code> 90 object. 91 </p> 92 </td> 93</tr> 94<tr> 95<td> 96 <p> 97 <code class="computeroutput"><span class="identifier">c</span><span class="special">.</span><span class="identifier">convertible</span><span class="special">()</span></code> 98 </p> 99 </td> 100<td> 101 <p> 102 convertible to <code class="computeroutput"><span class="keyword">bool</span></code> 103 </p> 104 </td> 105<td> 106 <p> 107 <code class="computeroutput"><span class="keyword">false</span></code> iff no conversion 108 from any <code class="computeroutput"><span class="identifier">R</span></code> value 109 to a Python object is possible. 110 </p> 111 </td> 112</tr> 113<tr> 114<td> 115 <p> 116 <code class="computeroutput"><span class="identifier">c</span><span class="special">(</span><span class="identifier">r</span><span class="special">)</span></code> 117 </p> 118 </td> 119<td> 120 <p> 121 convertible to <code class="computeroutput"><span class="identifier">PyObject</span><span class="special">*</span></code> 122 </p> 123 </td> 124<td> 125 <p> 126 A pointer to a Python object corresponding to <code class="computeroutput"><span class="identifier">r</span></code>, 127 or <code class="computeroutput"><span class="number">0</span></code> iff <code class="computeroutput"><span class="identifier">r</span></code> could not be converted <code class="computeroutput"><span class="identifier">to_python</span></code>, in which case <code class="computeroutput"><span class="identifier">PyErr_Occurred</span></code> should return 128 non-zero. 129 </p> 130 </td> 131</tr> 132<tr> 133<td> 134 <p> 135 <code class="computeroutput"><span class="identifier">c</span><span class="special">.</span><span class="identifier">get_pytype</span><span class="special">()</span></code> 136 </p> 137 </td> 138<td> 139 <p> 140 <code class="computeroutput"><span class="identifier">PyTypeObject</span> <span class="keyword">const</span> <span class="special">*</span></code> 141 </p> 142 </td> 143<td> 144 <p> 145 A pointer to a Python Type object corresponding to result of 146 the conversion, or <code class="computeroutput"><span class="number">0</span></code>. 147 Used for documentation generation. If <code class="computeroutput"><span class="number">0</span></code> 148 is returned the generated type in the documentation will be object. 149 </p> 150 </td> 151</tr> 152</tbody> 153</table></div> 154</div> 155<div class="section"> 156<div class="titlepage"><div><div><h3 class="title"> 157<a name="concepts.resultconverter.resultconvertergenerator_concept"></a><a class="link" href="resultconverter.html#concepts.resultconverter.resultconvertergenerator_concept" title="ResultConverterGenerator Concept Requirements">ResultConverterGenerator 158 Concept Requirements</a> 159</h3></div></div></div> 160<p> 161 In the table below, <code class="computeroutput"><span class="identifier">G</span></code> denotes 162 a ResultConverterGenerator type and <code class="computeroutput"><span class="identifier">R</span></code> 163 denotes a possible C++ function return type. 164 </p> 165<div class="informaltable"><table class="table"> 166<colgroup> 167<col> 168<col> 169</colgroup> 170<thead><tr> 171<th> 172 <p> 173 Expression 174 </p> 175 </th> 176<th> 177 <p> 178 Requirements 179 </p> 180 </th> 181</tr></thead> 182<tbody><tr> 183<td> 184 <p> 185 <code class="computeroutput"><span class="identifier">G</span><span class="special">::</span><span class="identifier">apply</span><span class="special"><</span><span class="identifier">R</span><span class="special">>::</span><span class="identifier">type</span></code> 186 </p> 187 </td> 188<td> 189 <p> 190 A ResultConverter type for <code class="computeroutput"><span class="identifier">R</span></code>. 191 </p> 192 </td> 193</tr></tbody> 194</table></div> 195</div> 196</div> 197<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 198<td align="left"></td> 199<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2015 David Abrahams, Stefan Seefeld<p> 200 Distributed under the Boost Software License, Version 1.0. (See accompanying 201 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> 202 </p> 203</div></td> 204</tr></table> 205<hr> 206<div class="spirit-nav"> 207<a accesskey="p" href="holdergenerator.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="objectwrapper.html"><img src="../../images/next.png" alt="Next"></a> 208</div> 209</body> 210</html> 211