mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Add move assignment operator
This commit is contained in:
parent
1237a29fc9
commit
0e0991a1a5
@ -51,6 +51,24 @@ Exponential_Smoother::Exponential_Smoother()
|
||||
Exponential_Smoother::~Exponential_Smoother() = default;
|
||||
|
||||
|
||||
// Move assignment operator
|
||||
Exponential_Smoother& Exponential_Smoother::operator=(Exponential_Smoother&& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
this->alpha_ = other.alpha_;
|
||||
this->old_value_ = other.old_value_;
|
||||
this->one_minus_alpha_ = 1.0 - other.alpha_;
|
||||
this->samples_for_initialization_ = other.samples_for_initialization_;
|
||||
this->initializing_ = other.initializing_;
|
||||
this->init_counter_ = other.init_counter_;
|
||||
this->min_value_ = other.min_value_;
|
||||
this->offset_ = other.offset_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void Exponential_Smoother::set_alpha(float alpha)
|
||||
{
|
||||
alpha_ = alpha;
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
void set_offset(float offset);
|
||||
float smooth(float raw);
|
||||
double smooth(double raw);
|
||||
Exponential_Smoother& operator=(Exponential_Smoother&& other); //!< Move assignment operator
|
||||
private:
|
||||
float alpha_; // takes value 0.0001 if not set
|
||||
int samples_for_initialization_;
|
||||
|
@ -71,6 +71,25 @@ Tracking_loop_filter::Tracking_loop_filter()
|
||||
Tracking_loop_filter::~Tracking_loop_filter() = default;
|
||||
|
||||
|
||||
// Move assignment operator
|
||||
Tracking_loop_filter& Tracking_loop_filter::operator=(Tracking_loop_filter&& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
this->d_inputs = other.d_inputs;
|
||||
this->d_outputs = other.d_outputs;
|
||||
this->d_input_coefficients = other.d_input_coefficients;
|
||||
this->d_output_coefficients = other.d_output_coefficients;
|
||||
this->d_loop_order = other.d_loop_order;
|
||||
this->d_current_index = other.d_current_index;
|
||||
this->d_include_last_integrator = other.d_include_last_integrator;
|
||||
this->d_noise_bandwidth = other.d_noise_bandwidth;
|
||||
this->d_update_interval = other.d_update_interval;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
float Tracking_loop_filter::apply(float current_input)
|
||||
{
|
||||
// Now apply the filter coefficients:
|
||||
|
@ -44,6 +44,15 @@
|
||||
class Tracking_loop_filter
|
||||
{
|
||||
public:
|
||||
Tracking_loop_filter();
|
||||
~Tracking_loop_filter();
|
||||
|
||||
Tracking_loop_filter(float update_interval, float noise_bandwidth,
|
||||
int loop_order = 2,
|
||||
bool include_last_integrator = false);
|
||||
|
||||
Tracking_loop_filter& operator=(Tracking_loop_filter&& other); //!< Move assignment operator
|
||||
|
||||
float get_noise_bandwidth(void) const;
|
||||
float get_update_interval(void) const;
|
||||
bool get_include_last_integrator(void) const;
|
||||
@ -57,13 +66,6 @@ public:
|
||||
void initialize(float initial_output = 0.0);
|
||||
float apply(float current_input);
|
||||
|
||||
Tracking_loop_filter(float update_interval, float noise_bandwidth,
|
||||
int loop_order = 2,
|
||||
bool include_last_integrator = false);
|
||||
|
||||
Tracking_loop_filter();
|
||||
~Tracking_loop_filter();
|
||||
|
||||
private:
|
||||
// Store the last inputs and outputs:
|
||||
std::vector<float> d_inputs;
|
||||
|
Loading…
Reference in New Issue
Block a user