Hi,
I have a Gnuradio block that i built in C++ that has a vector passed to
it.
When I want to import the python equivalent of that block in python how
will
i pass a vector to it. I thought lists were an equivalent but it doesn’t
work.
Thanks
Mir
On Wed, Apr 14, 2010 at 01:15:17AM -0500, Mir M. Ali wrote:
Hi,
I have a Gnuradio block that i built in C++ that has a vector passed to it.
When I want to import the python equivalent of that block in python how will i
pass a vector to it. I thought lists were an equivalent but it doesn’t work.
This happens all the time in the GNU Radio qa-code, so have a look
there.
Tuples definitively work.
Cheers
MB
–
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)
Dipl.-Ing. Martin B.
Research Associate
Kaiserstraße 12
Building 05.01
76131 Karlsruhe
Phone: +49 721 608-3790
Fax: +49 721 608-6071
www.cel.kit.edu
KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
On Wed, Apr 14, 2010 at 2:15 AM, Mir M. Ali [email protected]
wrote:
Hi,
I have a Gnuradio block that i built in C++ that has a vector passed to it.
When I want to import the python equivalent of that block in python how will
i pass a vector to it. I thought lists were an equivalent but it doesn’t
work.
Thanks
Mir
Python tuples and lists can be passed as std::vector to the C++
block. You can look in gr_ofdm_mapper_bcv to see one example of how we
did this. More complicated, look at gr_ofdm_insert_preamble where we
pass in a vector of vectors. It’s possibly a problem with your swig
interface file.
Tom
On Wed, Apr 14, 2010 at 09:56:48AM -0400, Tom R. wrote:
Python tuples and lists can be passed as std::vector to the C++
block.
We pass
const std::vector &bar
which semantically allows a copy to be made of the data (a copy from a
python representation to the C++ representation).
If you use
std::vector &bar
The copy cannot be made (since changes to bar would need to be
reflected back into python).
You can look in gr_ofdm_mapper_bcv to see one example of how we
did this. More complicated, look at gr_ofdm_insert_preamble where we
pass in a vector of vectors. It’s possibly a problem with your swig
interface file.
Tom
Eric