![]() |
librnr
1.14.5
RoadNarrows Robotics Common Library 1
|
Simple [io] buffer declarations and operations. More...
Go to the source code of this file.
Functions | |
| SimpleBuf_T * | SimpleBufNew () |
| Allocate a new simple buffer with no internal buffer allocation. More... | |
| SimpleBuf_T * | SimpleBufNewWithBuf (size_t nBufSize) |
| Allocate a new simple buffer with internal buffer of nBufSize. More... | |
| void | SimpleBufDelete (SimpleBuf_T *pBuf) |
| Delete a simple buffer along with the internal buffer. More... | |
| void | SimpleBufSetBuf (SimpleBuf_T *pBuf, byte_t *pRWBuf, size_t nBufSize, size_t nLen) |
| Set simple buffer's internal read/write buffer. More... | |
| size_t | SimpleBufCopy (SimpleBuf_T *pTgt, SimpleBuf_T *pSrc) |
| Copy contents of source simple buffer to the end of the target simple buffer. More... | |
Simple [io] buffer declarations and operations.
The buffer is orgainized as a simple linear buffer with independent read and write positions. Ideal for multi-tasking.
Definition in file simplebuf.c.
| size_t SimpleBufCopy | ( | SimpleBuf_T * | pTgt, |
| SimpleBuf_T * | pSrc | ||
| ) |
Copy contents of source simple buffer to the end of the target simple buffer.
| pTgt | Pointer to target simple buffer. |
| pSrc | Pointer to source simple buffer. |
Return Value:
Definition at line 165 of file simplebuf.c.
References SimpleBuf_T::m_nBufSize, SimpleBuf_T::m_nRPos, SimpleBuf_T::m_nWPos, SimpleBuf_T::m_pRWBuf, and NULL.
| void SimpleBufDelete | ( | SimpleBuf_T * | pBuf | ) |
Delete a simple buffer along with the internal buffer.
Actual deletion on occurs if buffer is owned by this simple buffer.
| pBuf | Pointer to simple buffer to be deleted. |
Definition at line 111 of file simplebuf.c.
References SimpleBuf_T::m_bBufDel, SimpleBuf_T::m_pRWBuf, and NULL.
Referenced by SocketBufNewBuf(), and SocketDelete().
| SimpleBuf_T* SimpleBufNew | ( | ) |
Allocate a new simple buffer with no internal buffer allocation.
Definition at line 70 of file simplebuf.c.
References SimpleBuf_T::m_bBufDel, SimpleBuf_T::m_nBufSize, SimpleBuf_T::m_nRPos, SimpleBuf_T::m_nWPos, SimpleBuf_T::m_pRWBuf, NEW, and NULL.
Referenced by SocketNew().
| SimpleBuf_T* SimpleBufNewWithBuf | ( | size_t | nBufSize | ) |
Allocate a new simple buffer with internal buffer of nBufSize.
| nBufSize | Size in bytes of internal buffer to allocate with simple buffer. |
Definition at line 91 of file simplebuf.c.
References SimpleBuf_T::m_bBufDel, SimpleBuf_T::m_nBufSize, SimpleBuf_T::m_nRPos, SimpleBuf_T::m_nWPos, SimpleBuf_T::m_pRWBuf, and NEW.
Referenced by SocketBufNewBuf().
| void SimpleBufSetBuf | ( | SimpleBuf_T * | pBuf, |
| byte_t * | pRWBuf, | ||
| size_t | nBufSize, | ||
| size_t | nLen | ||
| ) |
Set simple buffer's internal read/write buffer.
| pBuf | Pointer to simple buffer. |
| pRWBuf | Pointer to buffer to be set as the internal read/write buffer. |
| nBufSize | Size in bytes of pRWBuf. |
| nLen | Current length (bytes) of data in pRWBuf. |
Definition at line 134 of file simplebuf.c.
References SimpleBuf_T::m_bBufDel, SimpleBuf_T::m_nBufSize, SimpleBuf_T::m_nRPos, SimpleBuf_T::m_nWPos, SimpleBuf_T::m_pRWBuf, and NULL.
Referenced by SocketBufSetBuf().