Files
sics/rwpuffer.h
Ferdi Franceschini 10d29d597c Cleaned up ANSTO code to merge with sinqdev.sics
This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c
Conflicts:
	.gitignore
	SICSmain.c
	asynnet.c
	confvirtualmot.c
	counter.c
	devexec.c
	drive.c
	event.h
	exebuf.c
	exeman.c
	histmem.c
	interface.h
	motor.c
	motorlist.c
	motorsec.c
	multicounter.c
	napi.c
	napi.h
	napi4.c
	network.c
	nwatch.c
	nxscript.c
	nxxml.c
	nxxml.h
	ofac.c
	reflist.c
	scan.c
	sicshipadaba.c
	sicsobj.c
	site_ansto/docs/Copyright.txt
	site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl
	site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl
	statusfile.c
	tasdrive.c
	tasub.c
	tasub.h
	tasublib.c
	tasublib.h
2015-04-23 20:49:26 +10: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_ */