diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2008-09-24 00:19:12 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2008-09-24 00:19:12 +0000 |
| commit | 17df4c2b9616c29865b0d893cc797d4938a660a2 (patch) | |
| tree | d31d62c5694279747909bbab2b8be93f01a7fb7b /src/fifo.h | |
| parent | 5230927c4f087cf2dcaac4fb9ed133c1ff3e2269 (diff) | |
| download | libbu++-17df4c2b9616c29865b0d893cc797d4938a660a2.tar.gz libbu++-17df4c2b9616c29865b0d893cc797d4938a660a2.tar.bz2 libbu++-17df4c2b9616c29865b0d893cc797d4938a660a2.tar.xz libbu++-17df4c2b9616c29865b0d893cc797d4938a660a2.zip | |
Wholly crap. Added the Fifo, fixed a bunch of bugs, made things more standard,
now I have a huge list of new functions to add. Also, we discovered that if
we add -W it produces more warnings, warnings about things that we'd like to
know about. I have a lot of work to go fixing that...
Diffstat (limited to 'src/fifo.h')
| -rw-r--r-- | src/fifo.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/fifo.h b/src/fifo.h new file mode 100644 index 0000000..4989839 --- /dev/null +++ b/src/fifo.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007-2008 Xagasoft, All rights reserved. | ||
| 3 | * | ||
| 4 | * This file is part of the libbu++ library and is released under the | ||
| 5 | * terms of the license contained in the file LICENSE. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef BU_FIFO_H | ||
| 9 | #define BU_FIFO_H | ||
| 10 | |||
| 11 | #include <stdint.h> | ||
| 12 | #include <sys/types.h> | ||
| 13 | #include <stdlib.h> | ||
| 14 | |||
| 15 | #include "bu/stream.h" | ||
| 16 | #include "bu/fstring.h" | ||
| 17 | |||
| 18 | namespace Bu | ||
| 19 | { | ||
| 20 | /** | ||
| 21 | * A fifo stream. | ||
| 22 | *@ingroup Streams | ||
| 23 | */ | ||
| 24 | class Fifo : public Bu::Stream | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc=-1 ); | ||
| 28 | virtual ~Fifo(); | ||
| 29 | |||
| 30 | virtual void close(); | ||
| 31 | virtual size_t read( void *pBuf, size_t nBytes ); | ||
| 32 | virtual size_t write( const void *pBuf, size_t nBytes ); | ||
| 33 | using Stream::write; | ||
| 34 | |||
| 35 | virtual long tell(); | ||
| 36 | virtual void seek( long offset ); | ||
| 37 | virtual void setPos( long pos ); | ||
| 38 | virtual void setPosEnd( long pos ); | ||
| 39 | virtual bool isEOS(); | ||
| 40 | virtual bool isOpen(); | ||
| 41 | |||
| 42 | virtual void flush(); | ||
| 43 | |||
| 44 | virtual bool canRead(); | ||
| 45 | virtual bool canWrite(); | ||
| 46 | |||
| 47 | virtual bool isReadable(); | ||
| 48 | virtual bool isWritable(); | ||
| 49 | virtual bool isSeekable(); | ||
| 50 | |||
| 51 | virtual bool isBlocking(); | ||
| 52 | virtual void setBlocking( bool bBlocking=true ); | ||
| 53 | |||
| 54 | enum { | ||
| 55 | Read = 0x01, | ||
| 56 | Write = 0x02, | ||
| 57 | Create = 0x04, | ||
| 58 | Delete = 0x08, | ||
| 59 | NonBlock = 0x10 | ||
| 60 | }; | ||
| 61 | |||
| 62 | private: | ||
| 63 | int iFlags; | ||
| 64 | int iIn; | ||
| 65 | int iOut; | ||
| 66 | }; | ||
| 67 | } | ||
| 68 | |||
| 69 | #endif | ||
