boost/python/default_call_policies.hpp
クラス
default_call_policies クラス
-
struct default_call_policies
default_call_policiesはprecallおよびpostcallの振る舞いを持たないCallPoliciesのモデルであり、値返しを行うresult_converterである。ラップする C++ の関数およびメンバ関数は、特に指定しなければdefault_call_policiesを使用する。新規のCallPoliciesはdefault_call_policiesから派生すると便利である。
default_call_policies クラスの概要
namespace boost { namespace python
{
struct default_call_policies
{
static bool precall(PyObject*);
static PyObject* postcall(PyObject*, PyObject* result);
typedef default_result_converter result_converter;
template <class Sig> struct extract_return_type : mpl::front<Sig>{};
};
}}
default_call_policies クラスの静的関数
-
bool precall(PyObject*)
- 戻り値
true- 例外
なし
-
PyObject *postcall(PyObject*, PyObject *result)
- 戻り値
result- 例外
なし
default_result_converter クラス
-
struct default_result_converter
default_result_converter クラスの概要
namespace boost { namespace python
{
struct default_result_converter
{
template <class T> struct apply;
};
}}
default_result_converter クラスのメタ関数
-
template<class T>
struct apply - 要件
Tが参照型でない。Tがポインタ型の場合、Tはconst char*かPyObject*。
-
typedef to_python_value<T const&> type
例
この例は Boost.Python の実装そのものからとった。return_value_policy クラステンプレートは precall および postcall に対する振る舞いの実装を持たないので、その基底クラスは default_call_policies となっている。
template <class Handler, class Base = default_call_policies>
struct return_value_policy : Base
{
typedef Handler result_converter;
};