I have a simple enum in C in myenum.h:
enum MyEnum {
ONE,
TWO,
THREE
};
The problem is that when I map this to Python, I can only access the enum through the module name, not through MyEnum. So the values ONE, TWO, THREE are included with any other functions I define, instead of being contained with MyEnum.
My api.i file is:
%module api
%{
#include "myenum.h"
%}
%include "myenum.h"
I generate with SWIG
swig -builtin -python api.i
And import it into Python
import _api
And now I have to use the enum values from the _api module:
_api.ONE
_api.TWO
_api.THREE
While I want to use them like
_api.MyEnum.ONE
_api.MyEnum.TWO
_api.MyEnum.THREE
Does anyone know how I can accomplish this?