queue.h

来自「300种常用加解密算法的源码C++实现。」· C头文件 代码 · 共 53 行

H
53
字号
// specification file for an unlimited queue for storing bytes

#ifndef CRYPTOPP_QUEUE_H
#define CRYPTOPP_QUEUE_H

#include "cryptlib.h"

NAMESPACE_BEGIN(CryptoPP)

// The queue is implemented as a linked list of arrays, but you don't need to
// know about that.  So just ignore this next line. :)
class ByteQueueNode;

class ByteQueue : public BufferedTransformation
{
public:
	ByteQueue(unsigned int nodeSize=256);
	ByteQueue(const ByteQueue &copy);
	~ByteQueue();

	// how many bytes currently stored
	unsigned long CurrentSize() const;
	unsigned long MaxRetrieveable()
		{return CurrentSize();}

	void Put(byte inByte);
	void Put(const byte *inString, unsigned int length);

	// both functions returns the number of bytes actually retrived
	unsigned int Get(byte &outByte);
	unsigned int Get(byte *outString, unsigned int getMax);

	unsigned int Peek(byte &outByte) const;

	void CopyTo(BufferedTransformation &target) const;
	void CopyTo(byte *target) const;

	ByteQueue & operator=(const ByteQueue &rhs);
	bool operator==(const ByteQueue &rhs) const;
	byte operator[](unsigned long i) const;

private:
	void CopyFrom(const ByteQueue &copy);
	void Destroy();

	unsigned int nodeSize;
	ByteQueueNode *head, *tail;
};

NAMESPACE_END

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?