Get rid of gr::random so it can be compiled with c++17

The error was:

In file included from
/Users/carlesfernandez/git/cttc/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc:31:
In file included from
/Users/carlesfernandez/git/cttc/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h:36:
In file included from /opt/local/include/gnuradio/random.h:30:
In file included from /opt/local/include/boost/random.hpp:83:
/opt/local/include/boost/random/uniform_on_sphere.hpp:229:37: error: no
member named 'bind2nd' in namespace 'std'
        std::bind2nd(std::multiplies<RealType>(), 1/sqrt(sqsum)));
                               ~~~~~^
1 error generated.
This commit is contained in:
Carles Fernandez 2018-04-07 14:15:48 +02:00
parent 04e400ffa7
commit fc34bb4d98
2 changed files with 6 additions and 5 deletions

View File

@ -133,8 +133,8 @@ void signal_generator_c::init()
}
}
}
random_ = new gr::random();
std::default_random_engine e1(r());
std::default_random_engine e2(r());
std::uniform_int_distribution<int> uniform_dist(0, RAND_MAX);
}
@ -271,7 +271,6 @@ signal_generator_c::~signal_generator_c()
}
} */
volk_gnsssdr_free(complex_phase_);
delete random_;
}
@ -433,7 +432,7 @@ int signal_generator_c::general_work(int noutput_items __attribute__((unused)),
{
for (out_idx = 0; out_idx < vector_length_; out_idx++)
{
out[out_idx] += gr_complex(random_->gasdev(), random_->gasdev());
out[out_idx] += gr_complex(normal_dist(e1), normal_dist(e2));
}
}

View File

@ -33,7 +33,7 @@
#include "gnss_signal.h"
#include <boost/scoped_array.hpp>
#include <gnuradio/random.h>
//#include <gnuradio/random.h>
#include <gnuradio/block.h>
#include <string>
#include <vector>
@ -120,13 +120,15 @@ private:
boost::scoped_array<gr_complex *> sampled_code_data_;
boost::scoped_array<gr_complex *> sampled_code_pilot_;
gr::random *random_;
//gr::random *random_;
gr_complex *complex_phase_;
unsigned int work_counter_;
std::random_device r;
std::default_random_engine e1;
std::default_random_engine e2;
std::uniform_int_distribution<int> uniform_dist;
std::normal_distribution<float> normal_dist;
public:
~signal_generator_c(); // public destructor