summaryrefslogtreecommitdiff
path: root/libs/python/doc/html/reference/to_from_python_type_conversion/boost_python_opaque_pointer_conv.html
blob: 1225e1e9ee5dd826b4ebe4a3fee9f8dcaf979344 (plain)
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
111
112
113
114
115
116
117
118
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>boost/python/opaque_pointer_converter.hpp</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../index.html" title="Boost.Python Reference Manual">
<link rel="up" href="../to_from_python_type_conversion.html" title="Chapter&#160;5.&#160;To/From Python Type Conversion">
<link rel="prev" href="boost_python_lvalue_from_pytype_.html" title="boost/python/lvalue_from_pytype.hpp">
<link rel="next" href="boost_python_to_python_converter.html" title="boost/python/to_python_converter.hpp">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../../images/boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost_python_lvalue_from_pytype_.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../to_from_python_type_conversion.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="boost_python_to_python_converter.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv"></a><a class="link" href="boost_python_opaque_pointer_conv.html" title="boost/python/opaque_pointer_converter.hpp">boost/python/opaque_pointer_converter.hpp</a>
</h2></div></div></div>
<div class="toc"><dl>
<dt><span class="section"><a href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.introduction">Introduction</a></span></dt>
<dt><span class="section"><a href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.class_template_opaque_constructo">Class
        template <code class="computeroutput"><span class="identifier">opaque</span></code> constructor</a></span></dt>
<dt><span class="section"><a href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.macro_boost_python_opaque_specia">Macro
        <code class="computeroutput"><span class="identifier">BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID</span><span class="special">(</span><span class="identifier">Pointee</span><span class="special">)</span></code></a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv.introduction"></a><a class="link" href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.introduction" title="Introduction">Introduction</a>
</h3></div></div></div>
<p>
          <code class="computeroutput"><span class="identifier">opaque</span><span class="special">&lt;&gt;</span></code>
          registers itself as a converter from Python objects to pointers to undefined
          types and vice versa.
        </p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">python</span>
<span class="special">{</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Pointee</span><span class="special">&gt;</span>
    <span class="keyword">struct</span> <span class="identifier">opaque</span>
    <span class="special">{</span>
        <span class="identifier">opaque</span><span class="special">();</span>
    <span class="special">};</span>
<span class="special">}}</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv.class_template_opaque_constructo"></a><a class="link" href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.class_template_opaque_constructo" title="Class template opaque constructor">Class
        template <code class="computeroutput"><span class="identifier">opaque</span></code> constructor</a>
</h3></div></div></div>
<pre class="programlisting"><span class="identifier">opaque</span><span class="special">();</span></pre>
<div class="variablelist">
<p class="title"><b></b></p>
<dl>
<dt><span class="term">Effects</span></dt>
<dd><div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
                    Registers the instance as a <a class="link" href="boost_python_lvalue_from_pytype_.html#to_from_python_type_conversion.boost_python_lvalue_from_pytype_.class_template_lvalue_from_pytyp" title="Class template lvalue_from_pytype"><code class="computeroutput"><span class="identifier">lvalue_from_pytype</span></code></a> converter
                    from Python objects into opaque pointers. The Python Objects
                    created are named after the type pointed to by the opaque pointer
                    being wrapped.
                  </li>
<li class="listitem">
                    Registers the instance as a <a class="link" href="boost_python_to_python_converter.html#to_from_python_type_conversion.boost_python_to_python_converter.class_template_to_python_convert" title="Class template to_python_converter"><code class="computeroutput"><span class="identifier">to_python_converter</span></code></a>
                    from opaque pointers to Python objects.
                  </li>
</ul></div></dd>
</dl>
</div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
            If there is already an instance registered by another module, this instance
            doesn't try to register again in order to avoid warnings about multiple
            registrations.
          </p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv.macro_boost_python_opaque_specia"></a><a class="link" href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.macro_boost_python_opaque_specia" title="Macro BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee)">Macro
        <code class="computeroutput"><span class="identifier">BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID</span><span class="special">(</span><span class="identifier">Pointee</span><span class="special">)</span></code></a>
</h3></div></div></div>
<p>
          This macro must be used to define specializations of the <a class="link" href="../utility_and_infrastructure/boost_python_type_id_hpp.html#utility_and_infrastructure.boost_python_type_id_hpp.functions" title="Functions"><code class="computeroutput"><span class="identifier">type_id</span></code></a> function which can't be
          instantiated for incomplete types.
        </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
            The macro must be invoked in every translation unit which uses the opaque
            converter.
          </p></td></tr>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        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>
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost_python_lvalue_from_pytype_.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../to_from_python_type_conversion.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="boost_python_to_python_converter.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>