summaryrefslogtreecommitdiff
path: root/src/queuebuf.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
committerMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
commit469bbcf0701e1eb8a6670c23145b0da87357e178 (patch)
treeb5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/queuebuf.h
parentee1b79396076edc4e30aefb285fada03bb45e80d (diff)
downloadlibbu++-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/queuebuf.h')
-rw-r--r--src/queuebuf.h66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/queuebuf.h b/src/queuebuf.h
deleted file mode 100644
index 929ca35..0000000
--- a/src/queuebuf.h
+++ /dev/null
@@ -1,66 +0,0 @@
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_QUEUE_BUF_H
9#define BU_QUEUE_BUF_H
10
11#include "bu/stream.h"
12
13namespace Bu
14{
15 /**
16 * A queuing buffer stream class. All data written to this class is
17 * appended to it, there is no stored position. All data read is read
18 * from the begining and then thrown away. It operates by using a linked
19 * list of small buffers, and deallocating or reusing them when it can.
20 */
21 class QueueBuf : public Bu::Stream
22 {
23 public:
24 QueueBuf( int iBlockSize=256 );
25 virtual ~QueueBuf();
26
27 virtual void close();
28 virtual Bu::size read( void *pBuf, Bu::size nBytes );
29 virtual Bu::size peek( void *pBuf, Bu::size nBytes );
30 virtual Bu::size peek( void *pBuf, Bu::size nBytes, Bu::size nSkip );
31 virtual Bu::size write( const void *pBuf, Bu::size nBytes );
32 virtual Bu::size tell();
33 virtual void seek( Bu::size offset );
34 virtual void setPos( Bu::size pos );
35 virtual void setPosEnd( Bu::size pos );
36 virtual bool isEos();
37 virtual bool isOpen();
38 virtual void flush();
39 virtual bool canRead();
40 virtual bool canWrite();
41 virtual bool isReadable();
42 virtual bool isWritable();
43 virtual bool isSeekable();
44 virtual bool isBlocking();
45 virtual void setBlocking( bool bBlocking=true );
46 virtual void setSize( Bu::size iSize );
47
48 virtual size getSize() const;
49 virtual size getBlockSize() const;
50 virtual Bu::String getLocation() const;
51
52 private:
53 void addBlock();
54 void removeBlock();
55
56 private:
57 int iBlockSize;
58 int iReadOffset;
59 int iWriteOffset;
60 Bu::size iTotalSize;
61 typedef Bu::List<char *> BlockList;
62 BlockList lBlocks;
63 };
64};
65
66#endif