Files
sics/rwpuffer.h
Mark Koennecke 8f704ebab9 Improvements for BOA
- Allowed write buffers to become very large in asynnet. Thus in order to allow for the transfer
  of large images. tested ub to 2kx2k, 16MB
- Handle lack of space in the write buffer more gracefully: just skip the image
2014-08-27 16:24:39 +02:00

62 lines
1.8 KiB
C

/**
* This is a buffer to store bytes for reading and writing.
*
* copyright: see file COPYRIGHT
*
* Mark Koennecke, January 2009
*/
#ifndef RWPUFFER_H_
#define RWPUFFER_H_
typedef struct __RWBuffer *prwBuffer;
/**
* \brief create a RW buffer.
* \param size The size of the buffer.
* \return NULL on success, else a pointer to t a new rwPuffer
*/
prwBuffer MakeRWPuffer(int size);
/**
* \brief create a RW buffer which can grow.
* \param size The size of the buffer.
* \param maxSize The maximum size of the buffer.
* \return NULL on success, else a pointer to t a new rwPuffer
*/
prwBuffer MakeBigRWPuffer(int size, int maxSize);
/**
* \brief delete a rw buffer.
* \param self The rwPuffer to delete.
*/
void KillRWBuffer(prwBuffer self);
/**
* \brief store some data in the RW buffer
* \param self The rw buffer to store the data in
* \param data pointer to the data to store
* \param count The number of bytes to store
* \return 1 on success, 0 on failure
*/
int StoreRWBuffer(prwBuffer self, void *data, int count);
/**
* \brief Test if the data can be stored in the rwBuffer
* \param self The rw buffer to store the data in
* \param data pointer to the data to store
* \param count The number of bytes to store
* \return 1 when OK, 0 when buffer full
*/
int CanStoreRWBuffer(prwBuffer self, void *data, int count);
/**
* \brief Get a pointer to the current buffer data
* \param self the buffer to get the data from
* \param length Will be set to the number of available bytes.
* \return A pointer to the data
*/
void *GetRWBufferData(prwBuffer self, int *length);
/**
* \brief remove data from the buffer
* \param self the buffer to remove data from
* \param count The number of bytes to remove
*/
void RemoveRWBufferData(prwBuffer self, int count);
#endif /*RWPUFFER_H_ */