discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Where in OOT C++ code to write a boolean variable that is set at sta


From: Glen Langston
Subject: Re: Where in OOT C++ code to write a boolean variable that is set at startup
Date: Tue, 30 Jun 2020 13:01:25 -0400

Hi George,

This kind of parameter goes in the .h file that defines the classes.

in our event detection software we have a similar issue (If I understand you 
correctly).
in our detect_impl.h

namespace gr {
  namespace radio_astro {

    class detect_impl : public detect
    {
     private:
      // values computed in this block
...
     bool initialized = 0;   // flag initializing output
…

Then somewhere in the code (detect_impl.cc)

...skipping...
      if (! initialized) {
        for (int iii = 0; iii <  d_vec_length; iii++)
          { samples[iii] = input[iii];
          }
        initialized = 1;     // no need to re-initialize the event
      }

Best regards,

Glen


> On Jun 30, 2020, at 12:35 PM, George Edwards <gedwards.eng@gmail.com> wrote:
> 
> Hello,
> 
> I am writing my Gnuradio OOT in C++ and wish to add a boolean variable that 
> at startup is set to "true". Then, in Gnuradio "work" method, this variable 
> is tested and if true will cause an initialization method to run and 
> initialize parameters for the signal processing. The initialization method 
> would in turn set this variable to "false" so that Gnuradio "work method" can 
> only call it once (the first time the work method is entered". Which of the 
> methods in the OOT *.cc file do I put this variable in so that it is in scope 
> in the work method and the initialization method?
> 
> Thanks,
> George




reply via email to

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