How to write a block

hi,
how to use the gr_modtoolto write a block inherent from a
in_tree_block,such as inherent from stream_to _vector
BZS

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi BZS,

just use gr_modtool to generate a block of the same type
(sync/hier/general/…) and then modify the include/blockname.h to
inherit from the file you want.
You will also have to use
set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS)
in the top-directory CMakeLists.txt (if the base class is in
gnuradio::blocks, otherwise replace BLOCKS by that module).

Problem is, that inheriting from the in-tree classes won’t help you
much in terms of functionality. Class structure of OOTs as well as
in-tree modules is usually (let’s assume we’re talking about a block
called bzt_block):

bzt_block: Specified only in include/bzt_block.h. Most methods are
purely virtual. Does not do anything, but specifies an interface to
use, and an shared_pointer factory (make) that returns a shared
pointer to an instance of a subclass

bzt_block_impl: subclass of bzt_block. Declared in
lib/bzt_block_impl.h, defined in lib/bzt_block_imp.cc. Has all the
methods. This class is usually hidden from “outside the module”, and
is only accessed as an instance of the bzt_block base class.

Greetings,
Marcus

On 05.03.2014 02:25, 猪猪猪猪猪猪头 wrote:

hi, how to use the gr_modtoolto write a block inherent from a
in_tree_block,such as inherent from stream_to _vector BZS

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFuyDAAoJEBQ6EdjyzlHtOj4IALtvNH5kfPq7/4VNRdnyN36y
IO64/bkIpkYD0G3LlWIKw56eh584/wXVTyNwvY+jwhdF3kk/vdWp309Y099OzUOk
KCYJYKr7C6cK9XrjarHf1kgIu6cLJkyBgJ+k2Ni0IAFcB8ftlA2s8p4i4EjbD1d0
DkXt2kOj3NZk3PHnO9bXShGlB25XKNJlrR4kwrDW8Lio3vRKlgA8r0ud94eZnz2w
lcXRjzPrp5pSouQ6tz4E2iYmWye0vwR7fK2wbRYTDj3Cpzsa+j7MxsBHNGiOg3tB
hPaWHIs97WtgV+LNgkhgboNqN85UOyzOI5dRpPU+cJKcCmzZtG557plkYRSIMK4=
=mXdS
-----END PGP SIGNATURE-----

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs