I am trying to access a C++ enumeration within an OOT module from a
python
instance of my OOT. When I try to run my python code it cannot find the
enumeration.
My OOT module is called pll_freq_phase_det_cf and is included in python
as:
from pll_freq_phase_det_cf import pll_freq_phase_det_cf
The C++ enum is defined in the public section of the object class
definition in the include header and looks like:
enum ld_determination {
USE_NONE = 0, USE_PHASE_THRESHOLD = 1, USE_SIG_THRESHOLD = 2,
USE_ALL = 3, USE_FULL = USE_ALL
};
I would expect to be able to reference this from my python code like
“pll_freq_phase_det_cf.USE_ALL”, but the python interpreter cannot find
a
reference to this.
I have looked at gr-filter firdes windowing enum and I do not see
anything
special about how this was declared, or within any CMake or swig files
for
this, so I do not know where to go from here.
I have also looked at the python files in
/usr/local/lib/python2.7/site-packages for my OOT and firdes and see no
differences between how the enum values look (besides the names
obviously
being different…).
Michael B.
It sounds like you’re definitely on the right track. My only
suggestion is to double-check your swig file that the header is being
included properly. But you’re right; it’s nothing special exporting
those enums through swig.
Another place to look is sig_source_waveform.h in gr-analog.
For what it’s worth, I have enums in fosphor and the way I had to
access them is :
from gnuradio.fosphor.fosphor_swig import base_sink_c
base_sink_c.REF_DOWN
Because the base_sink_c from gnuradio.fosphor directly isn’t really
the SWIG object … it’s just the wrapper for the make() function that
creates the sptr and you can’t access any of the members.
Thank you all for the ideas so far. I unfortunately will not be able to
play around with this until the new year, but I will post back then if I
get it working to help people down the road.
Michael
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.