mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	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:
		| @@ -133,8 +133,8 @@ void signal_generator_c::init() | |||||||
|                         } |                         } | ||||||
|                 } |                 } | ||||||
|         } |         } | ||||||
|     random_ = new gr::random(); |  | ||||||
|     std::default_random_engine e1(r()); |     std::default_random_engine e1(r()); | ||||||
|  |     std::default_random_engine e2(r()); | ||||||
|     std::uniform_int_distribution<int> uniform_dist(0, RAND_MAX); |     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_); |     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++) |             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)); | ||||||
|                 } |                 } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ | |||||||
|  |  | ||||||
| #include "gnss_signal.h" | #include "gnss_signal.h" | ||||||
| #include <boost/scoped_array.hpp> | #include <boost/scoped_array.hpp> | ||||||
| #include <gnuradio/random.h> | //#include <gnuradio/random.h> | ||||||
| #include <gnuradio/block.h> | #include <gnuradio/block.h> | ||||||
| #include <string> | #include <string> | ||||||
| #include <vector> | #include <vector> | ||||||
| @@ -120,13 +120,15 @@ private: | |||||||
|  |  | ||||||
|     boost::scoped_array<gr_complex *> sampled_code_data_; |     boost::scoped_array<gr_complex *> sampled_code_data_; | ||||||
|     boost::scoped_array<gr_complex *> sampled_code_pilot_; |     boost::scoped_array<gr_complex *> sampled_code_pilot_; | ||||||
|     gr::random *random_; |     //gr::random *random_; | ||||||
|     gr_complex *complex_phase_; |     gr_complex *complex_phase_; | ||||||
|  |  | ||||||
|     unsigned int work_counter_; |     unsigned int work_counter_; | ||||||
|     std::random_device r; |     std::random_device r; | ||||||
|     std::default_random_engine e1; |     std::default_random_engine e1; | ||||||
|  |     std::default_random_engine e2; | ||||||
|     std::uniform_int_distribution<int> uniform_dist; |     std::uniform_int_distribution<int> uniform_dist; | ||||||
|  |     std::normal_distribution<float> normal_dist; | ||||||
|  |  | ||||||
| public: | public: | ||||||
|     ~signal_generator_c();  // public destructor |     ~signal_generator_c();  // public destructor | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez