Forum: GNU Radio OOT enums

5b7bae5302f715f777bc9f683dea3c77?d=identicon&s=25 Michael Berman (Guest)
on 2013-12-19 20:09
(Received via mailing list)
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...).

Any help on this would be greatly appreciated.


Thank you very much,

Michael Berman
C539637020fd56193dd6daec746c4a84?d=identicon&s=25 Tom Rondeau (Guest)
on 2013-12-19 21:38
(Received via mailing list)
On Thu, Dec 19, 2013 at 2:07 PM, Michael Berman <mrberman87@gmail.com>
wrote:
>         USE_NONE = 0, USE_PHASE_THRESHOLD = 1, USE_SIG_THRESHOLD = 2,
>
> Michael Berman
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.

Tom
7d89a70df32c0ae27c1235016f9e5441?d=identicon&s=25 "Marcus Müller" <marcus@hostalia.de> (Guest)
on 2013-12-19 21:50
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I had a hard time adding the tag_propagation_policy_t enum to the swig
gateway; maybe my pull request from back then might help you:
https://github.com/gnuradio/gnuradio/pull/69

The point is that I haven't been able to have an enum definition as
class member; only directly in the namespace.

Happy hacking,
Marcus


On 19.12.2013 21:36, Tom Rondeau wrote:
>> The C++ enum is defined in the public section of the object class
>> or swig files for this, so I do not know where to go from here.
>>
>
> _______________________________________________ Discuss-gnuradio
> mailing list Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSs1vHAAoJEAFxB7BbsDrLi3cH/RVDAeTG8Ql4ctSd1LuSf/tF
aiNQ+XX+wIB3CskMcwiFGLvUHfrg9/slOK8QehSG2/oZJWji1dGc9Tqko7DbYRhR
GfZzHWpRjpUlzwiclm9IqKy4ZV1zkzH+DH5Im9FGwdbFBK+cDpupKB4lsKV9Cosm
Q+JZXdMjGkqepraI58Aw9UsBML3akOrjSIYyE41BxCPEfLX9BXdM9aJxPnWl/gJY
xKR38HAwZOTJh6/yojZZ9dOHrWbdJPxFaTF9XaaDrNjEf3SEsvUBV1XQgpUZj/12
jImHwCLBGhoaXbuNf5gw89NSbgSucZRPlus0eX78IK6LNAWInmr3W4BRxHGKIC8=
=Eb1v
-----END PGP SIGNATURE-----
0817fa933c74eec9b3fcf3a04e16f418?d=identicon&s=25 Sylvain Munaut (Guest)
on 2013-12-19 22:08
(Received via mailing list)
Hi,

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.

Cheers,

    Sylvain
5b7bae5302f715f777bc9f683dea3c77?d=identicon&s=25 Michael Berman (Guest)
on 2013-12-23 19:31
(Received via mailing list)
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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.