aboutsummaryrefslogtreecommitdiff
path: root/include/Fifo.h
diff options
context:
space:
mode:
authorB. Bogart <bbogart@users.sourceforge.net>2005-08-13 01:16:59 +0000
committerB. Bogart <bbogart@users.sourceforge.net>2005-08-13 01:16:59 +0000
commit5e05f47d61ebad8aee6c3831912b21ad5dcc36e3 (patch)
treeb8793d1908e5c2ce256e886357cbcb86e1b768b9 /include/Fifo.h
Initial commit of readanysf~ 0.13.1 for Augustsvn2git-root
svn path=/trunk/externals/august/readanysf~/; revision=3426
Diffstat (limited to 'include/Fifo.h')
-rw-r--r--include/Fifo.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/Fifo.h b/include/Fifo.h
new file mode 100644
index 0000000..c060079
--- /dev/null
+++ b/include/Fifo.h
@@ -0,0 +1,31 @@
+#ifndef _FIFO_H_
+#define _FIFO_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <memory.h>
+#include <pthread.h>
+
+class Fifo
+{
+ public:
+ Fifo();
+ Fifo(unsigned int size);
+ ~Fifo();
+ void Flush();
+ int IsAlloc(void) { return astate; }
+ int ReAlloc(unsigned int size);
+ void * Read(void *buf, unsigned int &len);
+ int Write(void *buf, unsigned int len);
+ unsigned int FreeSpace(void);
+ unsigned int UsedSpace(void);
+ private:
+ char *buffer;
+ unsigned int astate;
+ unsigned int totsize, start, datasize;
+ pthread_mutex_t mut;
+};
+#endif