Hi all,
The story is this:
I always add all the necessary gr_modtool created files to a new project in qt-creator named "pre_gr" and develop a new OOT block there. Then, by building from source, I add the block to GRC, test it, and use it. This way I have developed some nontrivial practical modems.
BUT
I decided to be more organized by using more object-oriented features.
The problem is: the code in qt-creator compiled OK but when I add the block to GRC, I get this error:
Executing: /usr/bin/python2 -u /home/ali/grdrills/top_block.py
Traceback (most recent call last):
File "/home/ali/grdrills/top_block.py", line 168, in <module>
main()
File "/home/ali/grdrills/top_block.py", line 156, in main
tb = top_block_cls()
File "/home/ali/grdrills/top_block.py", line 69, in __init__
self.tmp_tmp_cmo_acq0_0 = tmp.tmp_cmo_acq0()
AttributeError: 'module' object has no attribute 'tmp_cmo_acq0'
which is usually related to SWIG.
The point is that the class "_impl.h" has two member variables:
Prm d_p;
ACQ d_acq;
ACQ d_acq;
which are Prm class to hold all the parameters, and ACQ class for acquisition, and in "_impl.cpp" the constructor is like this:
tmp_cmo_acq0_impl::tmp_cmo_acq0_impl(): gr::block("tmp_cmo_acq0",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_p(awgn, 5),
d_acq(d_p)
{
}
}
and the problem arises just as I add "d_acq" to the block.
I really wonder why and it drives me crazy these days.
I did a lot of searches but nothing!
I am certain that there are lots of experts on the list and that's my only hope!
The code is as follows:
tmp_cmo_acq0_impl.h:
#ifndef INCLUDED_TMP_TMP_CMO_ACQ0_IMPL_H
#define INCLUDED_TMP_TMP_CMO_ACQ0_IMPL_H
#include <tmp/tmp_cmo_acq0.h>
#include "acq.h"
#include "nco.h"
#include "prm.h"
#include <itpp/itbase.h>
#include <itpp/signal/transforms.h>
#include <complex>
#include <deque>
#define INCLUDED_TMP_TMP_CMO_ACQ0_IMPL_H
#include <tmp/tmp_cmo_acq0.h>
#include "acq.h"
#include "nco.h"
#include "prm.h"
#include <itpp/itbase.h>
#include <itpp/signal/transforms.h>
#include <complex>
#include <deque>
namespace gr {
namespace tmp {
class tmp_cmo_acq0_impl : public tmp_cmo_acq0
{
private:
Prm d_p;
ACQ d_acq;
public:
tmp_cmo_acq0_impl();
~tmp_cmo_acq0_impl();
// Where all the action really happens
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace tmp
} // namespace gr
namespace tmp {
class tmp_cmo_acq0_impl : public tmp_cmo_acq0
{
private:
Prm d_p;
ACQ d_acq;
public:
tmp_cmo_acq0_impl();
~tmp_cmo_acq0_impl();
// Where all the action really happens
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace tmp
} // namespace gr
No comments:
Post a Comment