Hi all,

I am working on writing a new block(class). This block generates 4 streams
of sinusoid at different frequencies and each sinusoid is multiplied with
the 4 streams of float input respectively.  The sinusoid are generated by
defining two struct type variables and do something with these two struct.
My question is, should I put the definition of these two struct in the body
of class as a private member? or should I define them out side of the class
parallel with smart pointer? (i.e. typedef boost::shared_ptr<lpi_itersum_ff>
lpi_itersum_ff_sptr;). What's the difference between puting the struct
definations inside and outside of the class?


Here's my current brief .h file. I am not sure it's acceptable or not. If
you find anything might lead the problem, please let me know. Any
suggestions will be very much appreciated.


--------------------------------- header
file------------------------------------
#ifndef INCLUDED_lpi_itersum_FF_H
#define INCLUDED_lpi_itersum_FF_H

#define PI        (3.141592654)
#define FREQLO        32.0        /* Low frequency (linear)    */
#define FREQHI        10000.0        /* High frequency (linear)    */
#define DOUTGAIN    10.0        /* Standard output gain        */


#include <gr_sync_block.h>

class lpi_itersum_ff;
typedef boost::shared_ptr<lpi_itersum_ff> lpi_itersum_ff_sptr;

typedef struct _RES {
    float        dA;
    float        dB;
    float        dC;
    ........
    float        dOmega;
} RES;

typedef struct _SIG {
    int         nSampsPerSec;
    int         nCutOff;
    float      dOutputGain;
    float        dT;
    RES            RTx[4];
} SIG;

lpi_itersum_ff_sptr lpi_make_itersum_ff ();
static SIG sig;

class lpi_itersum_ff : public gr_sync_block
{
  friend lpi_itersum_ff_sptr lpi_make_itersum_ff ();

  lpi_itersum_ff(float *dAmps);

 public:
  ~lpi_itersum_ff(void);
  int work (int noutput_items,
        gr_vector_const_void_star &input_items,
        gr_vector_void_star &output_items);
};

#endif

--------------------------------- header
file------------------------------------


Thank you,

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

Reply via email to