Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/doc/v2/ResultConverter.html @ 45

Last change on this file since 45 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 4.2 KB
Line 
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 - ResultConverter 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">ResultConverter 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="#ResultConverter-concept">ResultConverter Concept</a></dt>
29    <dt><a href="#ResultConverterGenerator-concept">ResultConverterGenerator Concept</a></dt>
30  </dl>
31</dl>
32
33<h2><a name="introduction"></a>Introduction</h2>
34
35<p>A ResultConverter for a type <code>T</code> is a type whose
36instances can be used to convert C++ return values of type
37<code>T</code> <code>to_python</code>. A ResultConverterGenerator is
38an MPL unary metafunction class which, given the return type of a C++
39function, returns a ResultConverter for that type. ResultConverters in
40Boost.Python generally inspect library's registry of converters to
41find a suitable converter, but converters which don't use the registry
42are also possible.
43
44<h2><a name="concept-requirements"></a>Concept Requirements</h2>
45<h3><a name="ResultConverter-concept"></a>ResultConverter Concept</h3>
46
47<p>In the table below, <code><b>C</b></code> denotes a ResultConverter
48type for a type <b><code>R</code></b> , <code><b>c</b></code> denotes
49an object of type <code><b>C</b></code> , and <code><b>r</b></code>
50denotes an object of type <code><b>R</b></code>.
51
52<table summary="ResultConverter expressions" border="1" cellpadding="5">
53
54  <tr> 
55    <td><b>Expression</b></td>
56    <td><b>Type</b></td>
57    <td><b>Semantics</b></td>
58  </tr>
59
60  <tr> 
61    <td valign="top"><code>C c;</code></td>
62    <td>
63    <td>Constructs a <code>C</code> object.
64  </tr>
65
66  <tr> 
67    <td valign="top"><code>c.convertible()</code></td>
68    <td>convertible to <code>bool</code></td>
69    <td><code>false</code> iff no conversion from any <code>R</code> value
70    to a Python object is possible.</td>
71  </tr>
72
73  <tr> 
74    <td valign="top"><code>c(r)</code></td>
75    <td>convertible to <code>PyObject*</code></td>
76    <td>A pointer to a Python object corresponding to <code>r</code>,
77    or <code>0</code> iff <code>r</code> could not be converted
78    <code>to_python</code>, in which case <a
79    href="http://www.python.org/doc/current/api/exceptionHandling.html#l2h-71">PyErr_Occurred</a>
80    should return non-zero.</td>
81  </tr>
82</table>
83
84<h3><a name="ResultConverterGenerator-concept"></a>ResultConverterGenerator Concept</h3>
85<p>In the table below, <code><b>G</b></code> denotes a
86ResultConverterGenerator type and <code><b>R</b></code> denotes a possible
87C++ function return type.
88
89<table summary="ResultConverterGenerator expressions" border="1" cellpadding="5">
90  <tr> 
91    <td><b>Expression</b></td>
92    <td><b>Requirements</b></td>
93  </tr>
94  <tr> 
95    <td valign="top"><code>G::apply&lt;R&gt;::type</code></td>
96    <td>A ResultConverter type for <code>R</code>.</td>
97</table>
98
99<hr>
100<p>Revised
101  <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
102  09 May, 2002    <!--Luann's birthday! -->
103  <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
104</p>
105    <p><i>&copy; Copyright <a href="../../../../people/dave_abrahams.htm">Dave
106    Abrahams</a> 2002. </i>
107
108<p>Permission to copy, use, modify, sell
109 and distribute this software is granted provided this copyright notice appears
110 in all copies. This software is provided "as is" without express or implied
111 warranty, and with no claim as to its suitability for any purpose.
112</body>
113</html>
Note: See TracBrowser for help on using the repository browser.