discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Implementing feedback loops


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Implementing feedback loops
Date: Mon, 9 Oct 2017 02:30:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Hi Vipin,

implies that I can simply define a simple class member of the custom block C++ class to store the state.
Indeed!

Do class member variables of custom GRC block retain their state across two different calls of the function?
Yes! As said, this is bog-normal C++ or Python. What would be the sense in having a member variable if it wasn't persistent?

Does the custom block class’ object gets created once during initialization and only the general work function gets called multiple times for processing.
Exactly.

The only state we loose are the local variables which get defined in the general work function itself.
That's not a state, that's parameterization of the function, if you will.

Not quite sure what to recommend here – on one hand, it looks like you're actually very intensely consider what you're doing on a level that most software developers simply wouldn't think about (since the language takes care of that for them), but that on the other hand might be an indication of you not being overly used to writing procedural and object-oriented code at all. But that is really just a hunch!

Best regards,
Marcus

On 10/08/2017 09:17 AM, Vipin Sharma wrote:
Marcus,

Your comment:

just give your block, which is a
normal C++ or Python class, a member that holds the state”

implies that I can simply define a simple class member of the custom block C++ class to store the state. 

However, I was initially thinking that would mean feedback as well. After thinking through though it shouldn’t be because member variables are not input/output streams. 

I still have one question though. Do class member variables of custom GRC block retain their state across two different calls of the function? I guess I don’t really understand how GRC calls the custom block during runtime. Does the custom block class’ object gets created once during initialization and only the general work function gets called multiple times for processing. That way all custom block’s class’ object retain all their state across the calls? The only state we loose are the local variables which get defined in the general work function itself. 

Vipin 


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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