diff --git a/RingBuffer.h b/RingBuffer.h index cfb8d53..4878d8c 100644 --- a/RingBuffer.h +++ b/RingBuffer.h @@ -53,9 +53,9 @@ public: uint16_t getData() const; - bool put(TDATATYPE sample); + bool put(const TDATATYPE item); - bool get(TDATATYPE& sample); + bool get(TDATATYPE& item); TDATATYPE peek() const; @@ -72,6 +72,6 @@ private: bool m_overflow; }; - +#include "RingBuffer.impl.h" #endif \ No newline at end of file diff --git a/RingBuffer.cpp b/RingBuffer.impl.h similarity index 89% rename from RingBuffer.cpp rename to RingBuffer.impl.h index f350023..6839255 100644 --- a/RingBuffer.cpp +++ b/RingBuffer.impl.h @@ -56,7 +56,7 @@ template uint16_t CRingBuffer::getData() const return m_length - m_tail + m_head; } -template bool CRingBuffer::put(TDATATYPE sample) +template bool CRingBuffer::put(const TDATATYPE sample) { if (m_full) { m_overflow = true; @@ -80,12 +80,12 @@ template TDATATYPE CRingBuffer::peek() const return m_buffer[m_tail]; } -template bool CRingBuffer::get(TDATATYPE& sample) +template bool CRingBuffer::get(TDATATYPE& item) { if (m_head == m_tail && !m_full) return false; - sample = m_buffer[m_tail]; + item = m_buffer[m_tail]; m_full = false; @@ -111,9 +111,4 @@ template void CRingBuffer::reset() m_tail = 0U; m_full = false; m_overflow = false; -} - -//Add here any declarations you need -template class CRingBuffer; -template class CRingBuffer; -template class CRingBuffer; \ No newline at end of file +} \ No newline at end of file