File: default_call_policies.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 (170 lines) | stat: -rw-r--r-- 5,653 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <meta name="generator" content="HTML Tidy, see www.w3.org">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="../boost.css">

    <title>Boost.Python -
    &lt;boost/python/default_call_policies.hpp&gt;</title>

    <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 valign="top">
          <h1 align="center"><a href="../index.html">Boost.Python</a></h1>

          <h2 align="center">Header
          &lt;boost/python/default_call_policies.hpp&gt;</h2>
    </table>
    <hr>

    <h2>Contents</h2>

    <dl class="page-index">
      <dt><a href="#classes">Classes</a>

      <dd>
        <dl class="page-index">
          <dt><a href="#default_call_policies-spec">Class
          <code>default_call_policies</code></a>

          <dd>
            <dl class="page-index">
              <dt><a href="#default_call_policies-spec-synopsis">Class
              <code>default_call_policies</code> synopsis</a>

              <dt><a href="#default_call_policies-spec-statics">Class
              <code>default_call_policies</code> static functions</a>
            </dl>

          <dt><a href="#default_result_converter-spec">Class
          <code>default_result_converter</code></a>

          <dd>
            <dl class="page-index">
              <dt><a href="#default_result_converter-spec-synopsis">Class
              <code>default_result_converter</code> synopsis</a>

              <dt><a href="#default_result_converter-spec-metafunctions">Class
              <code>default_result_converter</code> metafunctions</a>
            </dl>
        </dl>

      <dt><a href="#examples">Example</a>
    </dl>
    <hr>

    <h2><a name="classes"></a>Classes</h2>

    <h3><a name="default_call_policies-spec"></a>Class
    <code>default_call_policies</code></h3>

    <p><code>default_call_policies</code> is a model of <a href=
    "CallPolicies.html">CallPolicies</a> with no <code>precall</code> or
    <code>postcall</code> behavior and a <code>result_converter</code> which
    handles by-value returns. Wrapped C++ functions and member functions use
    <code>default_call_policies</code> unless otherwise specified. You may find
    it convenient to derive new models of <a href=
    "CallPolicies.html">CallPolicies</a> from
    <code>default_call_policies</code>.

    <h4><a name="default_call_policies-spec-synopsis"></a>Class
    <code>default_call_policies</code> synopsis</h4>
<pre>
namespace boost { namespace python
{
    struct default_call_policies
    {
        static bool precall(PyObject*);
        static PyObject* postcall(PyObject*, PyObject* result);
        typedef <a href=
"#default_result_converter-spec">default_result_converter</a> result_converter;
    };
}}
</pre>

    <h4><a name="default_call_policies-spec-statics"></a>Class
    <code>default_call_policies</code> static functions</h4>
<pre>
bool precall(PyObject*);
</pre>

    <dl class="function-semantics">
      <dt><b>Returns:</b> <code>true</code>

      <dt><b>Throws:</b> nothing
    </dl>
<pre>
PyObject* postcall(PyObject*, PyObject* result);
</pre>

    <dl class="function-semantics">
      <dt><b>Returns:</b> <code>result</code>

      <dt><b>Throws:</b> nothing
    </dl>

    <h3><a name="default_result_converter-spec"></a>Class
    <code>default_result_converter</code></h3>

    <p><code>default_result_converter</code> is a model of <a href=
    "ResultConverter.html#ResultConverterGenerator-concept">ResultConverterGenerator</a> which can be
    used to wrap C++ functions returning non-pointer types, <code>char
    const*</code>, and <code>PyObject*</code>, by-value.

    <h4><a name="default_result_converter-spec-synopsis"></a>Class
    <code>default_result_converter</code> synopsis</h4>
<pre>
namespace boost { namespace python
{
    struct default_result_converter
    {
        template &lt;class T&gt; struct apply;
    };
}}
</pre>

    <h4><a name="default_result_converter-spec-metafunctions"></a>Class
    <code>default_result_converter</code> metafunctions</h4>
<pre>
template &lt;class T&gt; struct apply
</pre>

    <dl class="metafunction-semantics">
      <dt><b>Requires:</b> <code>T</code> is not a reference type. If
      <code>T</code> is a pointer type, <code>T</code> is <code>const
      char*</code> or <code>PyObject*</code>.

      <dt><b>Returns:</b> <code>typedef <a href=
      "to_python_value.html#to_python_value-spec">to_python_value</a>&lt;T
      const&amp;&gt; type;</code>
    </dl>

    <h2><a name="examples"></a>Example</h2>

    <p>This example comes from the Boost.Python implementation itself. Because
    the <a href=
    "return_value_policy.html#return_value_policy-spec">return_value_policy</a>
    class template does not implement <code>precall</code> or
    <code>postcall</code> behavior, its default base class is
    <code>default_call_policies</code>:
<pre>
template &lt;class Handler, class Base = default_call_policies&gt;
struct return_value_policy : Base
{
   typedef Handler result_converter;
};
</pre>

    <p>Revised 
    <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
  13 November, 2002
  <!--webbot bot="Timestamp" endspan i-checksum="39359" -->


    <p><i>&copy; Copyright <a href="../../../../people/dave_abrahams.htm">Dave
    Abrahams</a> 2002. </i>