diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
commit | 469bbcf0701e1eb8a6670c23145b0da87357e178 (patch) | |
tree | b5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/unstable/fifo.h | |
parent | ee1b79396076edc4e30aefb285fada03bb45e80d (diff) | |
download | libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2 libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip |
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'src/unstable/fifo.h')
-rw-r--r-- | src/unstable/fifo.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/unstable/fifo.h b/src/unstable/fifo.h new file mode 100644 index 0000000..18a70ba --- /dev/null +++ b/src/unstable/fifo.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 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/string.h" | ||
17 | #include "bu/exceptionbase.h" | ||
18 | |||
19 | namespace Bu | ||
20 | { | ||
21 | subExceptionDecl( FifoException ); | ||
22 | |||
23 | /** | ||
24 | * A fifo stream. | ||
25 | *@ingroup Streams | ||
26 | */ | ||
27 | class Fifo : public Bu::Stream | ||
28 | { | ||
29 | public: | ||
30 | Fifo( const Bu::String &sName, int iFlags, mode_t mAcc=-1 ); | ||
31 | virtual ~Fifo(); | ||
32 | |||
33 | virtual void close(); | ||
34 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | ||
35 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | ||
36 | using Stream::write; | ||
37 | |||
38 | virtual Bu::size tell(); | ||
39 | virtual void seek( Bu::size offset ); | ||
40 | virtual void setPos( Bu::size pos ); | ||
41 | virtual void setPosEnd( Bu::size pos ); | ||
42 | virtual bool isEos(); | ||
43 | virtual bool isOpen(); | ||
44 | |||
45 | virtual void flush(); | ||
46 | |||
47 | virtual bool canRead(); | ||
48 | virtual bool canWrite(); | ||
49 | |||
50 | virtual bool isReadable(); | ||
51 | virtual bool isWritable(); | ||
52 | virtual bool isSeekable(); | ||
53 | |||
54 | virtual bool isBlocking(); | ||
55 | virtual void setBlocking( bool bBlocking=true ); | ||
56 | |||
57 | enum { | ||
58 | Read = 0x01, | ||
59 | Write = 0x02, | ||
60 | Create = 0x04, | ||
61 | Delete = 0x08, | ||
62 | NonBlock = 0x10 | ||
63 | }; | ||
64 | |||
65 | private: | ||
66 | int iFlags; | ||
67 | int iIn; | ||
68 | int iOut; | ||
69 | }; | ||
70 | } | ||
71 | |||
72 | #endif | ||