2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

doc updates,

arbitrary arity constructors


[SVN r13511]
This commit is contained in:
Dave Abrahams
2002-04-17 00:22:38 +00:00
parent 0c1e2a7347
commit 4250893d2f
6 changed files with 214 additions and 87 deletions

View File

@@ -21,7 +21,6 @@
<h2>Contents</h2>
<dl class="page-index">
<dt><a href="#introduction">Introduction</a></dt>
<dt><a href="#functions">Functions</a></dt>
<dl class="page-index">
<dt><a href="#call-spec">call</a></dt>
@@ -32,11 +31,15 @@
</dl>
<hr>
<h2><a name="introduction"></a>Introduction</h2>
<p>{{Introductory text}}</p>
<p>
<code>&lt;boost/python/call.hpp&gt;</code> defines the <a
href="#call-spec"><code>call</code></a> family of overloaded function
templates, used to invoke Python callable objects from C++.
<h2><a name="functions"></a>Functions</h2>
<pre>
<a name="call-spec"></a>call
<a name="call-spec">template &lt;class R, class A1, class A2, ... class A<i>n</i>&gt;</a>
<i>result-type</i> call(PyObject* callable, A1 const&amp;, A2 const&amp;, ... A<i>n</i> const&amp;)
</pre>
<dl class="function-semantics">
<dt><b>Requires:</b> {{text}}</dt>

View File

@@ -51,7 +51,7 @@
<h2><a name="functions"></a>Functions</h2>
<pre>
<a name="make_function-spec">template &lt;class F&gt;</a>
objects::function* make_function(F f)&lt;/a&gt;
objects::function* make_function(F f)
template &lt;class F, class Policies&gt;
objects::function* make_function(F f, Policies const&amp; policies)

View File

@@ -24,9 +24,11 @@
<dl class="Reference">
<dt><a href="#high_level">High Level Components</a>
<dt><a href="#framework">Framework Elements</a>
<dt><a href="#models_of_call_policies">Models of CallPolicies</a>
<dt><a href="#utilities">Utilities</a>
<dt><a href="#return_handler_generators">Models of ReturnHandlerGenerator</a>
<dt><a href="#type_conversion">To/From Python Type Conversion</a>
<dt><a href="#by_name">Index By Name</a>
</dl>
@@ -41,6 +43,31 @@
<h3>General Purpose</h3>
<dl class="index">
<dt><a href="call.html">call.hpp</a>
<dd>
<dl class="index">
<dt><a href="call.html#functions">Functions</a>
<dd>
<dl class="index">
<dt><a href=
"call.html#call-spec">call</a>
</dl>
</dl>
<dt><a href="call_method.html">call_method.hpp</a>
<dd>
<dl class="index">
<dt><a href="call_method.html#functions">Functions</a>
<dd>
<dl class="index">
<dt><a href=
"call_method.html#call_method-spec">call_method</a>
</dl>
</dl>
<dt><a href="class.html">class.hpp/class_fwd.hpp</a>
<dd>
@@ -57,6 +84,22 @@
</dl>
</dl>
<dt><a href="data_members.html">data_members.hpp</a>
<dd>
<dl class="index">
<dt><a href="data_members.html#functions">Functions</a>
<dd>
<dl class="index">
<dt><a href=
"data_members.html#make_getter-spec">make_getter</a>
<dt><a href=
"data_members.html#make_setter-spec">make_setter</a>
</dl>
</dl>
<dt><a href="errors.html">errors.hpp</a>
<dd>
@@ -140,89 +183,8 @@
</dl>
</dl>
</dl>
<a name="type_conversion"></a>
<h3>To/From Python Type Conversion</h3>
<dl class="index">
<dt><a href="from_python.html">from_python.hpp</a>
<dd>
<dl class="index">
<dt><a href="from_python.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"from_python.html#from_python-spec">from_python</a>
</dl>
</dl>
<dt><a href="to_python_converter.html">to_python_converter.hpp</a>
<dd>
<dl class="index">
<dt><a href="to_python_converter.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"to_python_converter.html#to_python_converter-spec">to_python_converter</a>
</dl>
</dl>
<dt><a href="to_python_indirect.html">to_python_indirect.hpp</a>
<dd>
<dl class="index">
<dt><a href="to_python_indirect.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"to_python_indirect.html#to_python_indirect-spec">to_python_indirect</a>
</dl>
</dl>
<dt><a href="to_python_value.html">to_python_value.hpp</a>
<dd>
<dl class="index">
<dt><a href="to_python_value.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"to_python_value.html#to_python_value-spec">to_python_value</a>
</dl>
</dl>
<dt><a href="type_from_python.html">type_from_python.hpp</a>
<dd>
<dl class="index">
<dt><a href="type_from_python.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"type_from_python.html#type_from_python-spec">type_from_python</a>
</dl>
</dl>
<dt><a href="value_from_python.html">value_from_python.hpp</a>
<dd>
<dl class="index">
<dt><a href="value_from_python.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"value_from_python.html#value_from_python-spec">value_from_python</a>
</dl>
</dl>
</dl>
<a name="models_of_call_policies"></a>
<h3>Models of CallPolicies</h3>
@@ -369,6 +331,129 @@
</dl>
</dl>
</dl>
<a name="type_conversion"></a>
<h3>To/From Python Type Conversion</h3>
<dl class="index">
<dt><a href="from_python.html">from_python.hpp</a>
<dd>
<dl class="index">
<dt><a href="from_python.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"from_python.html#from_python-spec">from_python</a>
</dl>
</dl>
<dt><a href="has_back_reference.html">has_back_reference.hpp</a>
<dd>
<dl class="index">
<dt><a href="has_back_reference.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"has_back_reference.html#has_back_reference-spec">has_back_reference</a>
</dl>
</dl>
<dt><a href="implicit.html">implicit.hpp</a>
<dd>
<dl class="index">
<dt><a href="implicit.html#classes">Functions</a>
<dd>
<dl class="index">
<dt><a href=
"implicit.html#implicitly_convertible-spec">implicitly_convertible</a>
</dl>
</dl>
<dt><a href="ptr_hpp.html">ptr.hpp</a>
<dd>
<dl class="index">
<dt><a href="ptr_hpp.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href="ptr_hpp.html#ptr-spec">ptr</a>
</dl>
</dl>
<dt><a href="to_python_converter.html">to_python_converter.hpp</a>
<dd>
<dl class="index">
<dt><a href="to_python_converter.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"to_python_converter.html#to_python_converter-spec">to_python_converter</a>
</dl>
</dl>
<dt><a href="to_python_indirect.html">to_python_indirect.hpp</a>
<dd>
<dl class="index">
<dt><a href="to_python_indirect.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"to_python_indirect.html#to_python_indirect-spec">to_python_indirect</a>
</dl>
</dl>
<dt><a href="to_python_value.html">to_python_value.hpp</a>
<dd>
<dl class="index">
<dt><a href="to_python_value.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"to_python_value.html#to_python_value-spec">to_python_value</a>
</dl>
</dl>
<dt><a href="type_from_python.html">type_from_python.hpp</a>
<dd>
<dl class="index">
<dt><a href="type_from_python.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"type_from_python.html#type_from_python-spec">type_from_python</a>
</dl>
</dl>
<dt><a href="value_from_python.html">value_from_python.hpp</a>
<dd>
<dl class="index">
<dt><a href="value_from_python.html#classes">Classes</a>
<dd>
<dl class="index">
<dt><a href=
"value_from_python.html#value_from_python-spec">value_from_python</a>
</dl>
</dl>
</dl>
</dl>
<hr>

View File

@@ -63,6 +63,7 @@ bpl-test data_members ;
bpl-test bienstman1 ;
bpl-test bienstman2 ;
bpl-test bienstman3 ;
bpl-test multi_arg_constructor ;
if $(TEST_BIENSTMAN_NON_BUGS)
{
bpl-test bienstman4 ;

View File

@@ -0,0 +1,22 @@
#include <boost/python/module.hpp>
#include <boost/python/class.hpp>
struct A
{
A(const double, const double, const double, const double, const double, const double, const double) {}
};
BOOST_PYTHON_MODULE_INIT(multi_arg_constructor_ext)
{
using namespace boost::python;
using boost::shared_ptr;
module("multi_arg_constructor_ext")
.add(class_<A, shared_ptr<A> >("A")
.def_init(args<const double, const double, const double, const double, const double, const double, const double>())
)
;
}

View File

@@ -0,0 +1,16 @@
'''
>>> from multi_arg_constructor_ext import *
>>> a = A(1.0, 2, 3, 4, 5, 6, 7.0)
'''
def run(args = None):
import sys
import doctest
if args is not None:
sys.argv = args
return doctest.testmod(sys.modules.get(__name__))
if __name__ == '__main__':
print "running..."
import sys
sys.exit(run()[0])