##// END OF EJS Templates
Update Meson build def...
Update Meson build def Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1479:704e0f1deb02
r1480:fb552be9c83a
Show More
bindings.xml
103 lines | 4.6 KiB | application/xml | XmlLexer
<?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"/>
<enum-type name="DataSeriesType"/>
<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 &lt; 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 &lt; 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>
<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"/>
<object-type name="Product" />
<object-type name="MainWindow" />
<object-type name="SqpApplication">
<modify-function signature="SqpApplication(int&amp;,char**)" access="private"/>
</object-type>
<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, &amp;argc, &amp;argv, "PySideApp");
auto retval = new SqpApplication(argc,argv);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
</inject-code>
</add-function>
<function signature="init_resources()"/>
<function signature="load_plugins(const SqpApplication&amp;)"/>
<object-type name="ScalarTimeSerie">
<add-function signature="ScalarTimeSerie(NpArray&amp;,NpArray&amp;)" return-type="ScalarTimeSerie">
<inject-code class="target">
%BEGIN_ALLOW_THREADS
%0 = new ScalarTimeSerieWrapper();
%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&amp;,NpArray&amp;)" 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());
%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&amp;)"/>
</typesystem>