mirror of https://github.com/g4klx/MMDVM.git
No more need to specify each types for ringBuffer
This commit is contained in:
parent
7302dc8bd7
commit
6c3dd265ab
|
@ -53,9 +53,9 @@ public:
|
||||||
|
|
||||||
uint16_t getData() const;
|
uint16_t getData() const;
|
||||||
|
|
||||||
bool put(TDATATYPE sample);
|
bool put(const TDATATYPE item);
|
||||||
|
|
||||||
bool get(TDATATYPE& sample);
|
bool get(TDATATYPE& item);
|
||||||
|
|
||||||
TDATATYPE peek() const;
|
TDATATYPE peek() const;
|
||||||
|
|
||||||
|
@ -72,6 +72,6 @@ private:
|
||||||
bool m_overflow;
|
bool m_overflow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "RingBuffer.impl.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -56,7 +56,7 @@ template <typename TDATATYPE> uint16_t CRingBuffer<TDATATYPE>::getData() const
|
||||||
return m_length - m_tail + m_head;
|
return m_length - m_tail + m_head;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::put(TDATATYPE sample)
|
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::put(const TDATATYPE sample)
|
||||||
{
|
{
|
||||||
if (m_full) {
|
if (m_full) {
|
||||||
m_overflow = true;
|
m_overflow = true;
|
||||||
|
@ -80,12 +80,12 @@ template <typename TDATATYPE> TDATATYPE CRingBuffer<TDATATYPE>::peek() const
|
||||||
return m_buffer[m_tail];
|
return m_buffer[m_tail];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::get(TDATATYPE& sample)
|
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::get(TDATATYPE& item)
|
||||||
{
|
{
|
||||||
if (m_head == m_tail && !m_full)
|
if (m_head == m_tail && !m_full)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sample = m_buffer[m_tail];
|
item = m_buffer[m_tail];
|
||||||
|
|
||||||
m_full = false;
|
m_full = false;
|
||||||
|
|
||||||
|
@ -111,9 +111,4 @@ template <typename TDATATYPE> void CRingBuffer<TDATATYPE>::reset()
|
||||||
m_tail = 0U;
|
m_tail = 0U;
|
||||||
m_full = false;
|
m_full = false;
|
||||||
m_overflow = false;
|
m_overflow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add here any declarations you need
|
|
||||||
template class CRingBuffer<uint8_t>;
|
|
||||||
template class CRingBuffer<q15_t>;
|
|
||||||
template class CRingBuffer<uint16_t>;
|
|
Loading…
Reference in New Issue