bindings.xml
103 lines
| 4.6 KiB
| application/xml
|
XmlLexer
r1477 | <?xml version="1.0"?> | |||
<typesystem package="SciQLopBindings"> | ||||
<load-typesystem name="typesystem_core.xml" generate="no" /> | ||||
<load-typesystem name="typesystem_gui.xml" generate="no" /> | ||||
<load-typesystem name="typesystem_widgets.xml" generate="no" /> | ||||
<primitive-type name="std::string"/> | ||||
<primitive-type name="std::size_t"/> | ||||
r1479 | <enum-type name="DataSeriesType"/> | |||
r1477 | <container-type name="std::vector" type="vector"> | |||
<include file-name="vector" location="global"/> | ||||
<conversion-rule> | ||||
<native-to-target> | ||||
%INTYPE::size_type vectorSize = %in.size(); | ||||
PyObject* %out = PyList_New((int) vectorSize); | ||||
for (%INTYPE::size_type idx = 0; idx < vectorSize; ++idx) { | ||||
%INTYPE_0 cppItem(%in[idx]); | ||||
PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem)); | ||||
} | ||||
return %out; | ||||
</native-to-target> | ||||
<target-to-native> | ||||
<add-conversion type="PySequence"> | ||||
Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0)); | ||||
int vectorSize = PySequence_Fast_GET_SIZE(seq.object()); | ||||
%out.reserve(vectorSize); | ||||
for (int idx = 0; idx < vectorSize; ++idx ) { | ||||
PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), idx); | ||||
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); | ||||
%out.push_back(cppItem); | ||||
} | ||||
</add-conversion> | ||||
</target-to-native> | ||||
</conversion-rule> | ||||
</container-type> | ||||
r1479 | <primitive-type name="NpArray" target-lang-api-name="PyObject"> | |||
<include file-name="numpy_wrappers.h" location="local"/> | ||||
<conversion-rule> | ||||
<native-to-target> | ||||
auto result = %in.py_object(); | ||||
return result; | ||||
</native-to-target> | ||||
<target-to-native> | ||||
<add-conversion type="PyObject" check="NpArray::isNpArray(%in)"> | ||||
%out = %OUTTYPE(%in); | ||||
</add-conversion> | ||||
</target-to-native> | ||||
</conversion-rule> | ||||
</primitive-type> | ||||
<object-type name="PyDataProvider"/> | ||||
r1478 | <object-type name="Product" /> | |||
r1477 | <object-type name="MainWindow" /> | |||
<object-type name="SqpApplication"> | ||||
<modify-function signature="SqpApplication(int&,char**)" access="private"/> | ||||
</object-type> | ||||
r1478 | <function signature="SqpApplication_ctor()" return-type="SqpApplication*"/> | |||
<add-function signature="SqpApplication_ctor(PySequence)" return-type="SqpApplication*"> | ||||
<inject-code class="target"> | ||||
static int argc; | ||||
static char **argv; | ||||
Shiboken::listToArgcArgv(%1, &argc, &argv, "PySideApp"); | ||||
auto retval = new SqpApplication(argc,argv); | ||||
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); | ||||
</inject-code> | ||||
</add-function> | ||||
r1477 | <function signature="init_resources()"/> | |||
<function signature="load_plugins(const SqpApplication&)"/> | ||||
<object-type name="ScalarTimeSerie"> | ||||
<add-function signature="ScalarTimeSerie(NpArray&,NpArray&)" return-type="ScalarTimeSerie"> | ||||
<inject-code class="target"> | ||||
%BEGIN_ALLOW_THREADS | ||||
%0 = new ScalarTimeSerieWrapper(); | ||||
r1479 | %0.set_data(std::move(%1.data),std::move(%2.data)); | |||
%END_ALLOW_THREADS | ||||
</inject-code> | ||||
</add-function> | ||||
<add-function signature="size()" return-type="int" access="public" static="no"> | ||||
<inject-code class="target"> | ||||
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(); | ||||
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); | ||||
</inject-code> | ||||
</add-function> | ||||
</object-type> | ||||
<object-type name="VectorTimeSerie"> | ||||
<add-function signature="VectorTimeSerie(NpArray&,NpArray&)" return-type="VectorTimeSerie"> | ||||
<inject-code class="target"> | ||||
%BEGIN_ALLOW_THREADS | ||||
%0 = new VectorTimeSerieWrapper(); | ||||
%0.set_data(std::move(%1.data),%2.to_std_vect_vect()); | ||||
r1477 | %END_ALLOW_THREADS | |||
</inject-code> | ||||
</add-function> | ||||
<add-function signature="size()" return-type="int" access="public" static="no"> | ||||
<inject-code class="target"> | ||||
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(); | ||||
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); | ||||
</inject-code> | ||||
</add-function> | ||||
</object-type> | ||||
<function signature="test_np_array(NpArray&)"/> | ||||
</typesystem> | ||||
r1479 | ||||