discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] C++ Vector equivalent in Python using swig


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] C++ Vector equivalent in Python using swig
Date: Wed, 14 Apr 2010 10:23:36 -0700
User-agent: Mutt/1.5.20 (2009-08-17)

On Wed, Apr 14, 2010 at 09:56:48AM -0400, Tom Rondeau wrote:
> On Wed, Apr 14, 2010 at 2:15 AM, Mir M. Ali <address@hidden> 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<X> to the C++
> block.

We pass 

  const std::vector<foo> &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<foo> &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




reply via email to

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