Ringbuffer class
Diff: RingBuffer.h
- Revision:
- 2:959aad917307
- Parent:
- 1:fa4c2377a741
--- a/RingBuffer.h Wed Jan 13 02:34:23 2016 +0000 +++ b/RingBuffer.h Wed Jan 13 05:31:28 2016 +0000 @@ -5,6 +5,34 @@ #include <stdint.h> #include <string.h> +class RingBuffer +{ + private: + uint8_t* m_buf; + uint8_t* m_latchingbuffer; + volatile uint32_t m_wloc; + volatile uint32_t m_rloc; + volatile uint32_t m_ActualCapacity; + uint32_t m_size; + uint32_t m_ElementSize; + + public: + RingBuffer(uint32_t NumberOfElements = 128,uint32_t SizeOfElement = 1); + ~RingBuffer(); + + void put(void* data); + int get(void* data); + + void clear(void); + uint32_t GetSize(){return m_size;}; //Return the size of the ring buffer + + uint32_t GetCapacity(){return m_ActualCapacity;}; //Return the number of elements stored in the buffer + + uint32_t GetElementSize(){return m_ElementSize;}; + + void LatchBuffer(void* DstBuffer); +}; +/* template <typename T> class RingBuffer { @@ -36,5 +64,5 @@ }; - +*/ #endif \ No newline at end of file