discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Public method in out of tree module


From: Dirk Van Bruggen
Subject: [Discuss-gnuradio] Public method in out of tree module
Date: Fri, 22 Nov 2013 10:51:22 -0500

Hello,

I am trying to create a block that has a publicly accessible method and am having trouble accessing the method from within Python.  Here is a simple example of my process.

First, I boot Gnuradio Live DVD, Ubutnu 12.04, Gnuradio 3.7.2

Second, i create a new module according to: http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules

> gr_modtool newmod testmod
> cd gr-testmod
> gr_modtool add -t general testblock (empty argument list, default answers)
> vim lib/testblock_impl.cc (Edit this to the same as the square_ff.cc code from the example)
> mkdir build
> cd build
> cmake ../
> make
> sudo make install
> sudo ldconfig 


This works fine, I can verify the block is working correctly.

Then I edit the public header file to add a pure virtual method pub()

vim include/testmod/testblock.h

> ....
> public:
>     virtual int pub() = 0;
> ......


Then I edit the private header file to implement the method

> .....
> public:
>     int pub(){ return 1; }
> ....


If I build this, it will make and install just fine.  The only problem comes when I run python like so

> import testmod
> b = testmod.testblock()
> b.pub()


I get the following error:

> AttributeError: 'testblock_sptr' object has no attribute 'pub'


I've tried following the examples of in tree blocks, but just cannot seem to be able to access pub() from python.  Am I missing an include, or something?

Thank you,

Dirk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]