General purpose ring buffer library

Dependents:   iSerial DGWWebServer iSerial Dumb_box_rev2 ... more

RingBuffer.h

Committer:
ykuroda
Date:
2012-08-31
Revision:
0:db7fa84ff50e
Child:
1:1c3a10f2eb04

File content as of revision 0:db7fa84ff50e:

/*
 *    RingBuffer.h
 *
 *    2012.08.31 ... Y.Kuroda
 */
#ifndef _RINGBUFFER_H
#define _RINGBUFFER_H

class RingBuffer {

  protected:
    unsigned char* buf;
    unsigned int sp;
    unsigned int ep;
    unsigned int bufsize;

  public:
    RingBuffer(int _bufsize=100);
    ~RingBuffer();
    
    int  save(unsigned char c);
    unsigned char read(void);
    int check(void);

};


#endif /* _RINGBUFFER_H */