Skip to content

ulyssis/ringBuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

***************************************************************************************
  ringBufher.c - C ring buffer (FIFO) implementation.
 
  Written in 2016 by Di Li 
 					<[email protected]>
 					https://de.linkedin.com/in/di-li-420a0152
***************************************************************************************
This project implements a ring Bufer, the available operations are 

    Push                    
    Pop                     // two versions, pop the oldest data, and a chunk of data
    Peek
    Current Size
    Maximum Size
    Empty
    Full
This ring buffer spares one element to distinguish the head and tail.
The codes have been tested on ubuntu 14.04.1 and with gcc 4.8.4

****************************************************************************************
How to use:
	1. enter folder
	2. type make to compile
	3. type ./ringBuffer_test to run the unit test
		users need to define two parameters in ringBuffer_test.c

		#define kNumPointsInMyBuffer 100  //maxLen
		#define initialSize 20			// size
	


In ringBuffer_test.c, these are intended for use with the test harness, and should probably
be removed from production code, once you're confident that ringbuf works as intended.

The unit test may fail when you change these inputs, the printf lines can help you to know 
which part goes wrong.




***************************************************************************************
This implementation refers the following sources.
**********************************************************************
https://github.com/dhylands/TimerUART/blob/master/Timer-UART.cpp
http://stackoverflow.com/questions/827691/how-do-you-implement-a-circular-buffer-in-c

About

ring buffer (FIFO)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published