diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-09 16:25:22 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-09 16:25:22 +0000 |
commit | 74dd68ad611d15abf16a65c36a7cfd3f4492930a (patch) | |
tree | 843fed9ba6bb03253a01314afc3b1dfbb2dfd26c /src/gatsstream.h | |
parent | d9b407475ae3ebe434b29d9eabdd7d4416e17881 (diff) | |
download | libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.gz libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.bz2 libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.xz libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.zip |
Made the repo less libbu++-centric.
Diffstat (limited to 'src/gatsstream.h')
-rw-r--r-- | src/gatsstream.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/gatsstream.h b/src/gatsstream.h deleted file mode 100644 index 39719cf..0000000 --- a/src/gatsstream.h +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | #ifndef GATS_STREAM_H | ||
2 | #define GATS_STREAM_H | ||
3 | |||
4 | #include <bu/stream.h> | ||
5 | #include <bu/queuebuf.h> | ||
6 | |||
7 | namespace Gats | ||
8 | { | ||
9 | class Object; | ||
10 | |||
11 | class GatsStream | ||
12 | { | ||
13 | public: | ||
14 | GatsStream( Bu::Stream &rStream ); | ||
15 | virtual ~GatsStream(); | ||
16 | |||
17 | /** | ||
18 | * Read an object packet from the assosiated stream. This will make | ||
19 | * every effort to only read exactly enough data to describe one packet, | ||
20 | * in case you want to do other things with your stream. It will | ||
21 | * automatically skip NULL byte spacing between packets, which makes | ||
22 | * a convinient padding method for encrypted data streams. Since | ||
23 | * sizing information is available in the packet header exact amounts | ||
24 | * of data can be read, however this function doesn't assume that it | ||
25 | * can read the entire object in one operation. If it fails to read | ||
26 | * a complete packet in one call, it will keep the data it's read so | ||
27 | * far buffered and return NULL, ready for another attempt. You can | ||
28 | * use the function hasReadBuffer() to deterimne if readObject() | ||
29 | * has read part of an object packet or not. If readObject returns | ||
30 | * non-null then hasReadBuffer should return false on it's next call. | ||
31 | */ | ||
32 | Gats::Object *readObject(); | ||
33 | |||
34 | /** | ||
35 | * Write an object | ||
36 | */ | ||
37 | void writeObject( Gats::Object *pObject ); | ||
38 | |||
39 | /** | ||
40 | * Tells you if there is data still in the read buffer, i.e. that a | ||
41 | * packet is part way through being read. If readObject has returned | ||
42 | * non-null in the most recent call, this should always be false. | ||
43 | */ | ||
44 | bool hasReadBuffer() { return qbRead.getSize() > 0; } | ||
45 | int getReadBufferSize() { return qbRead.getSize(); } | ||
46 | |||
47 | private: | ||
48 | bool skipReadNulls(); | ||
49 | |||
50 | private: | ||
51 | Bu::Stream &rStream; | ||
52 | Bu::QueueBuf qbRead; | ||
53 | }; | ||
54 | }; | ||
55 | |||
56 | #endif | ||