diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-03-22 20:12:50 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-22 20:12:50 +0000 |
commit | 47627be8e85b2169ab3d9f34b8819cacb083b5bf (patch) | |
tree | d1a321b51c602f09039472918bb27618749ac461 /src/conduit.h | |
parent | 88004d87d513dcba767b1dae1e5199a89b22ce36 (diff) | |
download | libbu++-47627be8e85b2169ab3d9f34b8819cacb083b5bf.tar.gz libbu++-47627be8e85b2169ab3d9f34b8819cacb083b5bf.tar.bz2 libbu++-47627be8e85b2169ab3d9f34b8819cacb083b5bf.tar.xz libbu++-47627be8e85b2169ab3d9f34b8819cacb083b5bf.zip |
Bu::Conduit now works exactly as it was advertised some time ago, it uses
Bu::QueueBuf and creates a really slick blocking inter-thread I/O system.
Diffstat (limited to 'src/conduit.h')
-rw-r--r-- | src/conduit.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/conduit.h b/src/conduit.h index cc88667..72b8d52 100644 --- a/src/conduit.h +++ b/src/conduit.h | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | #include "bu/stream.h" | 11 | #include "bu/stream.h" |
12 | #include "bu/string.h" | 12 | #include "bu/string.h" |
13 | #include "bu/queuebuf.h" | ||
14 | #include "bu/itomutex.h" | ||
15 | #include "bu/itocondition.h" | ||
13 | 16 | ||
14 | namespace Bu | 17 | namespace Bu |
15 | { | 18 | { |
@@ -20,6 +23,41 @@ namespace Bu | |||
20 | */ | 23 | */ |
21 | class Conduit : public Stream | 24 | class Conduit : public Stream |
22 | { | 25 | { |
26 | public: | ||
27 | Conduit( int iBlockSize=256 ); | ||
28 | virtual ~Conduit(); | ||
29 | |||
30 | virtual void close(); | ||
31 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | ||
32 | virtual Bu::size peek( void *pBuf, Bu::size nBytes ); | ||
33 | virtual Bu::size peek( void *pBuf, Bu::size nBytes, Bu::size nSkip ); | ||
34 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | ||
35 | virtual Bu::size tell(); | ||
36 | virtual void seek( Bu::size offset ); | ||
37 | virtual void setPos( Bu::size pos ); | ||
38 | virtual void setPosEnd( Bu::size pos ); | ||
39 | virtual bool isEos(); | ||
40 | virtual bool isOpen(); | ||
41 | virtual void flush(); | ||
42 | virtual bool canRead(); | ||
43 | virtual bool canWrite(); | ||
44 | virtual bool isReadable(); | ||
45 | virtual bool isWritable(); | ||
46 | virtual bool isSeekable(); | ||
47 | virtual bool isBlocking(); | ||
48 | virtual void setBlocking( bool bBlocking=true ); | ||
49 | virtual void setSize( Bu::size iSize ); | ||
50 | |||
51 | virtual size getSize() const; | ||
52 | virtual size getBlockSize() const; | ||
53 | virtual Bu::String getLocation() const; | ||
54 | |||
55 | private: | ||
56 | QueueBuf qb; | ||
57 | mutable ItoMutex im; | ||
58 | ItoCondition cBlock; | ||
59 | bool bBlocking; | ||
60 | bool bOpen; | ||
23 | }; | 61 | }; |
24 | } | 62 | } |
25 | 63 | ||