[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can a hier_block2 have a work function?
From: |
Marcus Müller |
Subject: |
Re: can a hier_block2 have a work function? |
Date: |
Mon, 13 Sep 2021 15:01:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Hi Jameson,
On 13/09/2021 13.21, Jameson Collins wrote:
Is it possible to have a work function in a hier_block2 block?
no!
It seems the answer is yes, in the sense that the code will compile.
That's C++: you can declare new methods that the parent class didn't have.
Hint: if you attach `override` to your method signature, for example
class jamesons_block_impl : public jamesons_block {
int work(…) override;
};
then the compiler will gladly complain if you're implementing a method
that you thought was something present in the parent class(es), but that
isn't.
However the work function will never be executed.
On what would it be executed?
I get that if it did execute that there'd be some ambiguity about where
in the chain it is (i.e. is the first, or last thing executed in the
signal processing chain).
Exactly! If you want a signal processing block, derive from gr::block,
gr::sync_block etc.; hier_block2 is really for hierarchical blocks only
meant to enclose a subgraph, not one or multiple vertices of such a graph.
Best regards,
Marcus
smime.p7s
Description: S/MIME Cryptographic Signature