# Addding enums to custom processing blocks

**URL:** <https://www.ruby-forum.com/t/addding-enums-to-custom-processing-blocks/236674>\
**Category:** GNU Radio\
**Created:** [September 24, 2013, 3:27pm UTC](https://www.ruby-forum.com/t/addding-enums-to-custom-processing-blocks/236674 "2013-09-24T15:27:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 24, 2013, 3:27pm UTC](https://www.ruby-forum.com/t/addding-enums-to-custom-processing-blocks/236674/1 "2013-09-24T15:27:43Z")

</div>

Hi,

What’s the process by which enums are added to the Python namespace via  
SWIG in gnuradio? I mean in gr\_firdes, the following are added to the  
gr.firdes namespace in Python:

enum win\_type {  
WIN\_HAMMING = 0, // max attenuation 53 dB  
WIN\_HANN = 1, // max attenuation 44 dB  
WIN\_BLACKMAN = 2, // max attenuation 74 dB  
WIN\_RECTANGULAR = 3,  
WIN\_KAISER = 4, // max attenuation variable with beta, google it  
WIN\_BLACKMAN\_hARRIS = 5,  
};

But I can’t seem to get it to work with my code?

Cheers,

John

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [September 25, 2013, 7:03pm UTC](https://www.ruby-forum.com/t/addding-enums-to-custom-processing-blocks/236674/2 "2013-09-25T19:03:24Z")

</div>

On Tue, Sep 24, 2013 at 9:26 AM, John W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> WIN_RECTANGULAR = 3,
> WIN_KAISER = 4, // max attenuation variable with beta, google it
> WIN_BLACKMAN_hARRIS = 5,
> 
> ```
> 
> };
> 
> But I can’t seem to get it to work with my code?
> 
> Cheers,
> 
> John

Which version of GNU Radio are you using? That’ll make a difference on  
how easy it is to set this up.

In 3.7, we declare the enum inside of the gr::filter namespace. In the  
filter\_swig.i file, the firdes.h header is included using both the C++  
and Swig methods to makes sure everything in it is read and processed  
properly.

%{  
#include “gnuradio/filter/firdes.h”  
%}

%include “gnnuradio/filter/firdes.h”

If you’re running 3.6, you can do similar. But check how gr\_firdes.i  
is written such that it redeclares the enum in SWIG.

–  
Tom  
GRCon13 Oct. 1 - 4

> **[GNU Radio Conference 2013 — Rondeau Research](http://www.trondeau.com/gnu-radio-conference-2013)**
