Simple ring buffer
nine_record_ring/record_ring.h
- Committer:
- jont
- Date:
- 2015-07-13
- Revision:
- 0:c050eb7b0c10
File content as of revision 0:c050eb7b0c10:
#ifndef _RECORD_RING #define _RECORD_RING #include "nine_ring.h" /** Ring Buffer using records of data rather than simple values J.J.Trinder, based on original code for midi projects 199X updateded sometime to the MBED Its a ring buffer for records of data Yeh its atad klunky, it works and is useful to explain things to people... */ /*======================================================================*/ /* Data structures to be used */ /*======================================================================*/ /* At the moment an aribtry collection of mostly float values. If you want different, then fork the library and modify as you see fit. */ typedef struct { // long sampleID; long timestamp; // time stamp float ad1; float ad2; float ad3; float ad4; float ad5; float ad6; int count; int count2; float temperature; char record_type; //J for journal E for event etc }log_record; class JRecordRing : public NRing { public: /** Create JRecordRing instance */ JRecordRing(); ~JRecordRing(); int RingWriteToBuffer(log_record ); long get_next_record(log_record*); protected: log_record opBuffer[buff_size]; /* our Ring out buffer */ log_record * buf; }; #endif