35 #ifndef _RNR_SIMPLEBUF_H 36 #define _RNR_SIMPLEBUF_H 52 #define SIMPLEBUF_ABS 0 53 #define SIMPLEBUF_REL 1
79 size_t nBufSize,
size_t nLen);
258 #endif // _RNR_SIMPLEBUF_H static byte_t * SimpleBufGetReadPtr(SimpleBuf_T *pBuf)
Returns pointer to internal I/O buffer at the current read position.
SimpleBuf_T * SimpleBufNew()
Allocate a new simple buffer with no internal buffer allocation.
static size_t SimpleBufHasSize(SimpleBuf_T *pBuf)
Returns size of buffer.
bool_t m_bBufDel
do [not] delete internal R/W buffer
#define SIMPLEBUF_REL
relative
byte_t * m_pRWBuf
internal read/write buffer
static size_t SimpleBufHasLen(SimpleBuf_T *pBuf)
Returns number of bytes currently in buffer.
static int SimpleBufGetC(SimpleBuf_T *pBuf)
Gets byte from buffer at current read position, advancing read position.
static bool_t SimpleBufIsFull(SimpleBuf_T *pBuf)
Test if simple buffer is full.
static int SimpleBufPutC(SimpleBuf_T *pBuf, byte_t c)
Puts byte into buffer at current write position, advancing write position.
SimpleBuf_T * SimpleBufNewWithBuf(size_t nBufSize)
Allocate a new simple buffer with internal buffer of nBufSize.
void SimpleBufDelete(SimpleBuf_T *pBuf)
Delete a simple buffer along with the internal buffer.
static size_t SimpleBufHasAvail(SimpleBuf_T *pBuf)
Returns number of bytes available in buffer for writing.
#define C_DECLS_BEGIN
C declaration block begin in C.
size_t m_nWPos
current write buffer position
size_t m_nBufSize
buffer total size
size_t SimpleBufCopy(SimpleBuf_T *pTgt, SimpleBuf_T *pSrc)
Copy contents of source simple buffer to the end of the target simple buffer.
void SimpleBufSetBuf(SimpleBuf_T *pBuf, byte_t *pRWBuf, size_t nBufSize, size_t nLen)
Set simple buffer's internal read/write buffer.
RoadNarrows Robotics common configuration file.
#define INLINE_IN_H
inline C funtion in C header
#define C_DECLS_END
C declaration block end in C.
static size_t SimpleBufWriteSeek(SimpleBuf_T *pBuf, size_t wpos, int how)
Seek buffer write head to the new write position.
static size_t SimpleBufReadSeek(SimpleBuf_T *pBuf, size_t rpos, int how)
Seek buffer read head to the new read position.
size_t m_nRPos
current read buffer position
static bool_t SimpleBufIsEmpty(SimpleBuf_T *pBuf)
Test if simple buffer is empty.
static void SimpleBufClear(SimpleBuf_T *pBuf)
Clear contents of buffer.
static byte_t * SimpleBufGetWritePtr(SimpleBuf_T *pBuf)
Returns pointer to internal I/O buffer at the current write position.