Hi,
The python swig wrapper works great except that I am unable to access the contents of the dimensions objects which is a std::pair<double, double> instance return from DialectNode.getDimensions.
dialect::dimensions is a typedef std::pair<double,double> dimensions
But I am not able to retrieve its contents in python.
In [1]: from adaptagrams import *
In [2]: n = DialectNode.allocate(10.0, 20.0, 30.0, 30.0)
In [3]: d = n.getDimensions()
In [4]: d.first
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-6ed88d6b1bba> in <module>
----> 1 d.first
AttributeError: 'SwigPyObject' object has no attribute 'first'
I have tried to add some additional wrapping code to adaptagrams.i. The following gives the same error as above:
%typedef std::pair<double,double> dimensions;
%template() std::pair<double,double>;
%rename(dimensions) dialect::dimensions;
and when I add a %template(dimensions) std::pair<double,double>; it generates the wrapping code but then cannot find it in the resultant extension module.
My knowledge of SWIG is quite limited so would appreciate some advice on how to fix this.
Hi,
The python swig wrapper works great except that I am unable to access the contents of the
dimensionsobjects which is astd::pair<double, double>instance return from DialectNode.getDimensions.dialect::dimensionsis atypedef std::pair<double,double> dimensionsBut I am not able to retrieve its contents in python.
I have tried to add some additional wrapping code to
adaptagrams.i. The following gives the same error as above:and when I add a
%template(dimensions) std::pair<double,double>;it generates the wrapping code but then cannot find it in the resultant extension module.My knowledge of SWIG is quite limited so would appreciate some advice on how to fix this.