1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-15 11:45:47 +00:00

Fix const usage

This commit is contained in:
Carles Fernandez 2019-09-09 23:31:20 +02:00
parent a89ed4512d
commit e2d4fab080
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -42,16 +42,16 @@ class Gnss_circular_deque
{ {
public: public:
Gnss_circular_deque(); //!< Default constructor Gnss_circular_deque(); //!< Default constructor
Gnss_circular_deque(const unsigned int max_size, const unsigned int nchann); //!< nchann = number of channels; max_size = channel capacity Gnss_circular_deque(unsigned int max_size, unsigned int nchann); //!< nchann = number of channels; max_size = channel capacity
unsigned int size(const unsigned int ch); //!< Returns the number of available elements in a channel unsigned int size(unsigned int ch); //!< Returns the number of available elements in a channel
T& at(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element with bount checking T& at(unsigned int ch, unsigned int pos); //!< Returns a reference to an element with bount checking
const T& get(const unsigned int ch, const unsigned int pos) const; //!< Returns a reference to an element without bound checking const T& get(unsigned int ch, unsigned int pos) const; //!< Returns a const reference to an element without bound checking
T& front(const unsigned int ch); //!< Returns a reference to the first element in the deque T& front(unsigned int ch); //!< Returns a reference to the first element in the deque
T& back(const unsigned int ch); //!< Returns a reference to the last element in the deque T& back(unsigned int ch); //!< Returns a reference to the last element in the deque
void push_back(const unsigned int ch, const T& new_data); //!< Inserts an element at the end of the deque void push_back(unsigned int ch, const T& new_data); //!< Inserts an element at the end of the deque
void pop_front(const unsigned int ch); //!< Removes the first element of the deque void pop_front(unsigned int ch); //!< Removes the first element of the deque
void clear(const unsigned int ch); //!< Removes all the elements of the deque (Sets size to 0). Capacity is not modified void clear(unsigned int ch); //!< Removes all the elements of the deque (Sets size to 0). Capacity is not modified
void reset(const unsigned int max_size, const unsigned int nchann); //!< Removes all the elements in all the channels. Re-sets the number of channels and their capacity void reset(unsigned int max_size, unsigned int nchann); //!< Removes all the elements in all the channels. Re-sets the number of channels and their capacity
void reset(); //!< Removes all the channels (Sets nchann to 0) void reset(); //!< Removes all the channels (Sets nchann to 0)
private: private:
@ -67,56 +67,56 @@ Gnss_circular_deque<T>::Gnss_circular_deque()
template <class T> template <class T>
Gnss_circular_deque<T>::Gnss_circular_deque(const unsigned int max_size, const unsigned int nchann) Gnss_circular_deque<T>::Gnss_circular_deque(unsigned int max_size, unsigned int nchann)
{ {
reset(max_size, nchann); reset(max_size, nchann);
} }
template <class T> template <class T>
unsigned int Gnss_circular_deque<T>::size(const unsigned int ch) unsigned int Gnss_circular_deque<T>::size(unsigned int ch)
{ {
return d_data.at(ch).size(); return d_data[ch].size();
} }
template <class T> template <class T>
T& Gnss_circular_deque<T>::back(const unsigned int ch) T& Gnss_circular_deque<T>::back(unsigned int ch)
{ {
return d_data.at(ch).back(); return d_data[ch].back();
} }
template <class T> template <class T>
T& Gnss_circular_deque<T>::front(const unsigned int ch) T& Gnss_circular_deque<T>::front(unsigned int ch)
{ {
return d_data.at(ch).front(); return d_data[ch].front();
} }
template <class T> template <class T>
T& Gnss_circular_deque<T>::at(const unsigned int ch, const unsigned int pos) T& Gnss_circular_deque<T>::at(unsigned int ch, unsigned int pos)
{ {
return d_data.at(ch).at(pos); return d_data.at(ch).at(pos);
} }
template <class T> template <class T>
const T& Gnss_circular_deque<T>::get(const unsigned int ch, const unsigned int pos) const const T& Gnss_circular_deque<T>::get(unsigned int ch, unsigned int pos) const
{ {
return d_data[ch][pos]; return d_data[ch][pos];
} }
template <class T> template <class T>
void Gnss_circular_deque<T>::clear(const unsigned int ch) void Gnss_circular_deque<T>::clear(unsigned int ch)
{ {
d_data.at(ch).clear(); d_data[ch].clear();
} }
template <class T> template <class T>
void Gnss_circular_deque<T>::reset(const unsigned int max_size, const unsigned int nchann) void Gnss_circular_deque<T>::reset(unsigned int max_size, unsigned int nchann)
{ {
d_data.clear(); d_data.clear();
if (max_size > 0 and nchann > 0) if (max_size > 0 and nchann > 0)
@ -137,16 +137,16 @@ void Gnss_circular_deque<T>::reset()
template <class T> template <class T>
void Gnss_circular_deque<T>::pop_front(const unsigned int ch) void Gnss_circular_deque<T>::pop_front(unsigned int ch)
{ {
d_data.at(ch).pop_front(); d_data[ch].pop_front();
} }
template <class T> template <class T>
void Gnss_circular_deque<T>::push_back(const unsigned int ch, const T& new_data) void Gnss_circular_deque<T>::push_back(unsigned int ch, const T& new_data)
{ {
d_data.at(ch).push_back(new_data); d_data[ch].push_back(new_data);
} }
#endif /* GNSS_SDR_CIRCULAR_DEQUE_H_ */ #endif /* GNSS_SDR_CIRCULAR_DEQUE_H_ */