#ifndef CCYCLEBUFFER_H
#define CCYCLEBUFFER_H

#include <QtGlobal>
#include <QReadWriteLock>

class CCycleBuffer
{
public:
    bool isFull();
    bool isEmpty();
    void Empty();
    uint32_t GetLength();
    uint32_t GetFreeLength();
    CCycleBuffer(uint32_t size);
    ~CCycleBuffer();
    uint32_t Write(uint8_t * buf, uint32_t count);
    uint32_t Read(uint8_t * buf, uint32_t count);

private:
    bool m_bEmpty;
    bool m_bFull;
    char * m_pBuf;
    uint32_t m_nBufSize;
    uint32_t m_nReadPos;
    uint32_t m_nWritePos;



    QReadWriteLock *lock;
};

#endif // CCYCLEBUFFER_H
