Data Structures | Typedefs | Functions
StructRingBuf.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
Include dependency graph for StructRingBuf.h:

Go to the source code of this file.

Data Structures

struct  StructRingBuf_Object
 

Typedefs

typedef struct StructRingBuf_ObjectStructRingBuf_Handle
 

Functions

void StructRingBuf_construct (StructRingBuf_Handle object, void *bufPtr, size_t bufSize, size_t structSize)
 Initialize circular buffer. More...
 
int StructRingBuf_get (StructRingBuf_Handle object, void *data)
 Get an unsigned char from the end of the circular buffer and remove it. More...
 
int StructRingBuf_getCount (StructRingBuf_Handle object)
 Get the number of unsigned chars currently stored on the circular buffer. More...
 
bool StructRingBuf_isFull (StructRingBuf_Handle object)
 Function to determine if the circular buffer is full or not. More...
 
int StructRingBuf_getMaxCount (StructRingBuf_Handle object)
 A high-water mark indicating the largest number of unsigned chars stored on the circular buffer since it was constructed. More...
 
int StructRingBuf_peek (StructRingBuf_Handle object, void **data)
 Get an unsigned char from the end of the circular buffer without remove it. More...
 
int StructRingBuf_put (StructRingBuf_Handle object, const void *data)
 Put an unsigned char into the end of the circular buffer. More...
 

Typedef Documentation

§ StructRingBuf_Handle

Function Documentation

§ StructRingBuf_construct()

void StructRingBuf_construct ( StructRingBuf_Handle  object,
void *  bufPtr,
size_t  bufSize,
size_t  structSize 
)

Initialize circular buffer.

Parameters
objectPointer to a StructRingBuf Object that contains the member variables to operate a circular buffer.
bufPtrPointer to data buffer to be used for the circular buffer. The buffer is NOT stored in StructRingBuf_Object.
bufSizeThe size of bufPtr in number of structures
structSizeThe size of a member structure in bytes

§ StructRingBuf_get()

int StructRingBuf_get ( StructRingBuf_Handle  object,
void *  data 
)

Get an unsigned char from the end of the circular buffer and remove it.

Parameters
objectPointer to a StructRingBuf Object that contains the member variables to operate a circular buffer.
dataPointer to an unsigned char to be filled with the data from the front of the circular buffer.
Returns
Number of unsigned chars on the buffer after taking it out of the circular buffer. If it returns -1, the circular buffer was already empty and data is invalid.

§ StructRingBuf_getCount()

int StructRingBuf_getCount ( StructRingBuf_Handle  object)

Get the number of unsigned chars currently stored on the circular buffer.

Parameters
objectPointer to a StructRingBuf Object that contains the member variables to operate a circular buffer.
Returns
Number of unsigned chars on the circular buffer.

§ StructRingBuf_isFull()

bool StructRingBuf_isFull ( StructRingBuf_Handle  object)

Function to determine if the circular buffer is full or not.

Parameters
objectPointer to a StructRingBuf Object that contains the member variables to operate a circular buffer.
Returns
true if circular buffer is full, else false.

§ StructRingBuf_getMaxCount()

int StructRingBuf_getMaxCount ( StructRingBuf_Handle  object)

A high-water mark indicating the largest number of unsigned chars stored on the circular buffer since it was constructed.

Returns
Get the largest number of unsigned chars that were at one point in the circular buffer.

§ StructRingBuf_peek()

int StructRingBuf_peek ( StructRingBuf_Handle  object,
void **  data 
)

Get an unsigned char from the end of the circular buffer without remove it.

Parameters
objectPointer to a StructRingBuf Object that contains the member variables to operate a circular buffer.
dataPointer to an unsigned char to be filled with the data from the front of the circular buffer. This function does not remove the data from the circular buffer. Do not evaluate data if the count returned is equal to 0.
Returns
Number of unsigned chars on the circular buffer. If the number != 0, then data will contain the unsigned char at the end of the circular buffer.

§ StructRingBuf_put()

int StructRingBuf_put ( StructRingBuf_Handle  object,
const void *  data 
)

Put an unsigned char into the end of the circular buffer.

Parameters
objectPointer to a StructRingBuf Object that contains the member variables to operate a circular buffer.
dataunsigned char to be placed at the end of the circular buffer.
Returns
Number of unsigned chars on the buffer after it was added, or -1 if it's already full.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale