25 lines
387 B
C++
25 lines
387 B
C++
#ifndef __INC_RINGBUFFER_H__
|
|
#define __INC_RINGBUFFER_H__
|
|
|
|
#include <array>
|
|
|
|
class ringbuffer
|
|
{
|
|
public:
|
|
ringbuffer();
|
|
|
|
int write(char);
|
|
int read(char&);
|
|
|
|
private:
|
|
enum {
|
|
MAX_BUFFER_SIZE = 2
|
|
};
|
|
|
|
std::array<char, MAX_BUFFER_SIZE> buffer;
|
|
std::array<char, MAX_BUFFER_SIZE>::iterator head;
|
|
std::array<char, MAX_BUFFER_SIZE>::iterator tail;
|
|
};
|
|
|
|
#endif
|