File: ResultConverter.html

package info (click to toggle)
boost 1.33.1-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 100,948 kB
  • ctags: 145,103
  • sloc: cpp: 573,492; xml: 49,055; python: 15,626; ansic: 13,588; sh: 2,099; yacc: 858; makefile: 660; perl: 427; lex: 111; csh: 6
file content (110 lines) | stat: -rw-r--r-- 4,099 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href=../../../../boost.css>
<title>Boost.Python - ResultConverter Concept</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
    "header">
  <tr> 
    <td valign="top" width="300"> 
      <h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../boost.png" border="0"></a></h3>
    </td>
    <td valign="top"> 
      <h1 align="center"><a href="../index.html">Boost.Python</a></h1>
      <h2 align="center">ResultConverter Concept</h2>
    </td>
  </tr>
</table>
<hr>
<dl class="page-index"> 
  <dt><a href="#introduction">Introduction</a></dt>
  <dt><a href="#concept-requirements">Concept Requirements</a></dt>
  <dl class="page-index"> 
    <dt><a href="#ResultConverter-concept">ResultConverter Concept</a></dt>
    <dt><a href="#ResultConverterGenerator-concept">ResultConverterGenerator Concept</a></dt>
  </dl>
</dl>

<h2><a name="introduction"></a>Introduction</h2>

<p>A ResultConverter for a type <code>T</code> is a type whose
instances can be used to convert C++ return values of type
<code>T</code> <code>to_python</code>. A ResultConverterGenerator is
an MPL unary metafunction class which, given the return type of a C++
function, returns a ResultConverter for that type. ResultConverters in
Boost.Python generally inspect library's registry of converters to
find a suitable converter, but converters which don't use the registry
are also possible.

<h2><a name="concept-requirements"></a>Concept Requirements</h2>
<h3><a name="ResultConverter-concept"></a>ResultConverter Concept</h3>

<p>In the table below, <code><b>C</b></code> denotes a ResultConverter
type for a type <b><code>R</code></b> , <code><b>c</b></code> denotes
an object of type <code><b>C</b></code> , and <code><b>r</b></code>
denotes an object of type <code><b>R</b></code>.

<table summary="ResultConverter expressions" border="1" cellpadding="5">

  <tr> 
    <td><b>Expression</b></td>
    <td><b>Type</b></td>
    <td><b>Semantics</b></td>
  </tr>

  <tr> 
    <td valign="top"><code>C c;</code></td>
    <td>
    <td>Constructs a <code>C</code> object.
  </tr>

  <tr> 
    <td valign="top"><code>c.convertible()</code></td>
    <td>convertible to <code>bool</code></td>
    <td><code>false</code> iff no conversion from any <code>R</code> value
    to a Python object is possible.</td>
  </tr>

  <tr> 
    <td valign="top"><code>c(r)</code></td>
    <td>convertible to <code>PyObject*</code></td>
    <td>A pointer to a Python object corresponding to <code>r</code>,
    or <code>0</code> iff <code>r</code> could not be converted
    <code>to_python</code>, in which case <a
    href="http://www.python.org/doc/current/api/exceptionHandling.html#l2h-71">PyErr_Occurred</a>
    should return non-zero.</td>
  </tr>
</table>

<h3><a name="ResultConverterGenerator-concept"></a>ResultConverterGenerator Concept</h3>
<p>In the table below, <code><b>G</b></code> denotes a
ResultConverterGenerator type and <code><b>R</b></code> denotes a possible
C++ function return type.

<table summary="ResultConverterGenerator expressions" border="1" cellpadding="5">
  <tr> 
    <td><b>Expression</b></td>
    <td><b>Requirements</b></td>
  </tr>
  <tr> 
    <td valign="top"><code>G::apply&lt;R&gt;::type</code></td>
    <td>A ResultConverter type for <code>R</code>.</td>
</table>

<hr>
<p>Revised 
  <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
  09 May, 2002    <!--Luann's birthday! -->
  <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
    <p><i>&copy; Copyright <a href="../../../../people/dave_abrahams.htm">Dave
    Abrahams</a> 2002. </i>

<p>Permission to copy, use, modify, sell
 and distribute this software is granted provided this copyright notice appears
 in all copies. This software is provided "as is" without express or implied
 warranty, and with no claim as to its suitability for any purpose.
</body>
</html>