5 #ifndef CRYPTOPP_IMPORTS 12 static const
unsigned int s_maxAutoNodeSize = 16*1024;
25 inline size_t MaxSize()
const {
return buf.size();}
34 return (m_head==MaxSize());
42 inline size_t Put(
const byte *begin,
size_t length)
45 if (!begin || !length)
return length;
46 size_t l =
STDMIN(length, MaxSize()-m_tail);
47 if (buf+m_tail != begin)
48 memcpy(buf+m_tail, begin, l);
62 inline size_t Peek(
byte *target,
size_t copyMax)
const 64 size_t len =
STDMIN(copyMax, m_tail-m_head);
65 memcpy(target, buf+m_head, len);
71 size_t len = m_tail-m_head;
78 size_t len =
STDMIN(copyMax, m_tail-m_head);
85 size_t len = Peek(outByte);
90 inline size_t Get(
byte *outString,
size_t getMax)
92 size_t len = Peek(outString, getMax);
99 size_t len = m_tail-m_head;
107 size_t len =
UnsignedMin(m_tail-m_head, transferMax);
113 inline size_t Skip(
size_t skipMax)
115 size_t len =
STDMIN(skipMax, m_tail-m_head);
122 return buf[m_head+i];
135 , m_head(NULL), m_tail(NULL), m_lazyString(NULL), m_lazyLength(0), m_lazyStringModifiable(false)
196 size += current->CurrentSize();
228 while ((len=
m_tail->
Put(inString, length)) < length)
287 throw InvalidArgument(
"ByteQueue: size specified for UndoLazyPut is too large");
340 return (
size_t)
CopyTo(sink, peekMax);
347 lword bytesLeft = transferBytes;
349 bytesLeft -= current->TransferTo(target, bytesLeft, channel);
363 transferBytes -= bytesLeft;
369 size_t blockedBytes = walker.
TransferTo2(target, transferBytes, channel, blocking);
379 lword transferBytes = end-begin;
380 size_t blockedBytes = walker.
TransferTo2(target, transferBytes, channel, blocking);
381 begin += transferBytes;
447 Walker walker1(*
this), walker2(rhs);
450 while (walker1.Get(b1) && walker2.
Get(b2))
462 return (*current)[(size_t)i];
464 i -= current->CurrentSize();
510 return (
size_t)
CopyTo(sink, 1);
516 return (
size_t)
CopyTo(sink, peekMax);
521 lword bytesLeft = transferBytes;
522 size_t blockedBytes = 0;
526 size_t len = (size_t)
STDMIN(bytesLeft, (
lword)m_node->CurrentSize()-m_offset);
527 blockedBytes = target.
ChannelPut2(channel, m_node->buf+m_node->m_head+m_offset, len, 0, blocking);
541 m_node = m_node->next;
558 transferBytes -= bytesLeft;
566 lword transferBytes = end-begin;
567 size_t blockedBytes = walker.
TransferTo2(target, transferBytes, channel, blocking);
568 begin += transferBytes;
size_t Peek(byte *target, size_t copyMax) const
size_t Peek(byte &outByte) const
Peek a 8-bit byte.
An invalid argument was detected.
void swap(ByteQueue &rhs)
void LazyPutModifiable(byte *inString, size_t size)
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
ByteQueueNode(size_t maxSize)
size_t TransferTo(BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL)
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const
Copy bytes from this object to another BufferedTransformation.
#define NAMESPACE_BEGIN(x)
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
size_t Get(byte &outByte)
size_t Peek(byte &outByte) const
size_t Put(const byte *begin, size_t length)
size_t Get(byte &outByte)
Retrieve a 8-bit byte.
byte operator[](size_t i) const
concurrent_queue< JitTask > m_queue
size_t Get(byte *outString, size_t getMax)
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
Copy input to a memory buffer.
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
const byte * Spy(size_t &contiguousSize) const
Classes for an unlimited queue to store bytes.
ByteQueue(size_t nodeSize=0)
Construct a ByteQueue.
size_t TransferTo(BufferedTransformation &target, lword transferMax, const std::string &channel=DEFAULT_CHANNEL)
CRYPTOPP_DLL int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
void CopyFrom(const ByteQueue ©)
size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const
Copy bytes from this object to another BufferedTransformation.
const T1 UnsignedMin(const T1 &a, const T2 &b)
Safe comparison of values that could be neagtive and incorrectly promoted.
const T & STDMIN(const T &a, const T &b)
Replacement function for std::min.
#define CRYPTOPP_ASSERT(exp)
Data structure used to store byte strings.
byte operator[](lword i) const
Implementation of BufferedTransformation's attachment interface.
bool operator==(const ByteQueue &rhs) const
size_t CopyTo(BufferedTransformation &target, size_t copyMax, const std::string &channel=DEFAULT_CHANNEL) const
uint8_t const size_t const size
void * memcpy(void *a, const void *b, size_t c)
#define CRYPTOPP_UNUSED(x)
lword CurrentSize() const
size_t Skip(size_t skipMax)
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
void UndoLazyPut(size_t size)
const T & STDMAX(const T &a, const T &b)
Replacement function for std::max.
std::vector< char * > parameters
void LazyPut(const byte *inString, size_t size)
ByteQueue & operator=(const ByteQueue &rhs)
size_t CurrentSize() const
bool m_lazyStringModifiable
size_t Get(byte &outByte)
Retrieve a 8-bit byte.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Base class for bufferless filters.
Interface for retrieving values given their names.
size_t CopyTo(BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL) const
size_t Peek(byte &outByte) const
Peek a 8-bit byte.
void SetNodeSize(size_t nodeSize)