I am attempting to create python bindings for some C++ code using swig. I seem have run into a problem trying to create python properties from some accessor functions I have for
In the SWIG Lib folder is a file called "attributes.i" which is not discussed in the documentation but that contains inline documentation.
All you have to do is add the following line to your interface file.
%include
You then receive a number of macros (such as %attribute) for defining attributes from existing methods.
An excerpt from the documentation in the attributes.i file:
The following macros convert a pair of set/get methods into a "native" attribute. Use %attribute when you have a pair of get/set methods to a primitive type like in:
%attribute(A, int, a, get_a, set_a);
struct A
{
int get_a() const;
void set_a(int aa);
};