[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Some doubts in using gr_modtool
From: |
Marcus Müller |
Subject: |
Re: [Discuss-gnuradio] Some doubts in using gr_modtool |
Date: |
Sun, 08 Sep 2013 09:58:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
Hi Manu!
Suppose I don't know the block size before hand, and I want to pass a parameter
"x" to toe constructor such that block size can be obtained from x using
certain computation (that will be defined inside the constructor). Can I do this? If so
how?
Yes, that's possible *inside the constructor only*. See the
gr::basic_block::set_{in,out}put_signature(gr::io_signature::sptr) doxygen.
When I add a new block "encoder", to the module "ldpc", modtool add files "include/ldpc/encoder.h",
"lib/encoder_impl.cc", and "lib/encoder_impl.h". And the work function is to be declared and defined in encoder_impl.h and
encoder_impl.cc respectively. Consider that I have the function "encode" defined and declared in ldpc.h and ldpc.cc respectively. ldpc.*
does not define any signal processing block, so I don't add them using modtool. But they are required as they have the definition for the
"encode" function and inside the work function in encoder_impl.cc I just want to call the encode function defined inside this ldpc class.
Am I supposed to put ldpc.h in inlclude/ldpc/ and ldpc.cc in lib/? Or should I
put both of them inside lib/ ? Which section of CMakeLists.txt am I supposed to
modify?
Yes, that would be the correct structure.
Just add ldpc.cc to lib/CMakeLists.txt:
list_append (APPEND projectname_sources
encoder_impl.cc
...
ldpc.cc )
Happy Hacking!
PS:You should also the include_directuries(${library_INCLUDE_DIR}) for each
external library you use to that file if you haven't done so; same applies for
target_link_libraries)