Merge branches 'master' and 'mob' of http://repo.or.cz/r/scuttle
[scuttle.git] / include / bytequeue.h
blobe489f0c6caec89763164399b37ac37375f7c3cb4
2 #ifndef _BYTEQUEUE_H_
3 #define _BYTEQUEUE_H_
5 #include <common.h>
7 #ifndef BYTEQUEUE_DEFAULT_BLOCK_SIZE
8 #define BYTEQUEUE_DEFAULT_BLOCK_SIZE 1024
9 //consider changing to 4096
10 #endif
12 class ByteQueue
14 char*d;
15 uint32_t s, rs;
16 public:
17 ByteQueue();
18 ~ByteQueue();
20 uint32_t size()
22 return s;
24 uint32_t append (const char*data, uint32_t size);
25 uint32_t append (const ByteQueue& queue);
26 char* data()
28 return d;
30 void clean()
32 s = rs = 0;
33 if (d) free (d);
34 d = NULL;
41 #endif