-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDS_ByteQueue.h
More file actions
28 lines (25 loc) · 799 Bytes
/
DS_ByteQueue.h
File metadata and controls
28 lines (25 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef __BYTE_QUEUE_H
#define __BYTE_QUEUE_H
/// The namespace DataStructures was only added to avoid compiler errors for commonly named data structures
/// As these data structures are stand-alone, you can use them outside of HexNet for your own projects if you wish.
namespace DataStructures
{
class ByteQueue
{
public:
ByteQueue();
~ByteQueue();
ByteQueue& operator = (const ByteQueue& other);
void WriteBytes(const char *in, unsigned length);
bool ReadBytes(char *out, unsigned length, bool peek);
unsigned GetBytesWritten(void) const;
void IncrementReadOffset(unsigned length);
void Clear(void);
void Print(void);
void ReadAllBytes(char* dst, int length, bool peek = false);
protected:
char *data;
unsigned readOffset, writeOffset, lengthAllocated;
};
}
#endif