MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / ByteQueueNode

Class ByteQueueNode

src/cryptlib/queue.cpp:8–41  ·  view source on GitHub ↗

this class for use by ByteQueue only

Source from the content-addressed store, hash-verified

6
7// this class for use by ByteQueue only
8class ByteQueueNode
9{
10public:
11 ByteQueueNode(unsigned int maxSize);
12
13 unsigned int CurrentSize() const
14 {return tail-head;}
15 unsigned int UsedUp() const
16 {return (head==MaxSize());}
17
18 unsigned int Put(byte inByte);
19 unsigned int Put(const byte *inString, unsigned int length);
20
21 unsigned int Get(byte &outByte);
22 unsigned int Get(byte *outString, unsigned int getMax);
23
24 unsigned int Peek(byte &outByte) const;
25
26 void CopyTo(BufferedTransformation &target) const
27 {target.Put(buf+head, tail-head);}
28 void CopyTo(byte *target) const
29 {memcpy(target, buf+head, tail-head);}
30
31 byte operator[](unsigned int i) const
32 {return buf[i-head];}
33
34 ByteQueueNode *next;
35
36private:
37 unsigned int MaxSize() const {return buf.size;}
38
39 SecByteBlock buf;
40 unsigned int head, tail;
41};
42
43
44ByteQueueNode::ByteQueueNode(unsigned int maxSize)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected