This is a special queue for handling blobs that come in and go out in varying sizes. It is particulary designed for streaming things that must travel or be parsed in packets that may differ in size from how they are sent or transmitted.
|
| GBlobQueue () |
|
| ~GBlobQueue () |
|
const char * | dequeue (size_t len) |
| Returns a pointer to the specified number of bytes, and advances the queue by that amount. If less than the required amount is available, then it will buffer any remaining bytes and return NULL, and not advance the queue. (The idea is that you will enqueue some more bytes and then try again.) In most cases, this method will just return a pointer within the blob that was most recently enqueued, but it may return a pointer to its own buffer when breaks occur at unfortunate positions. (The internal buffer is guaranteed to grow no bigger than the largest value ever passed for len.) More...
|
|
void | enqueue (const char *pBlob, size_t len) |
| Adds some bytes to the queue. pBlob is assumed to remain valid until a call to dequeue returns NULL. More...
|
|
size_t | readyBytes () |
| Returns the number of bytes that are ready to go. If you pass this same number to dequeue, it is guaranteed to return a non-NULL value, and subsequent calls to dequeue are guaranteed to return NULL until you call enqueue to put something back into the queue. More...
|
|
const char* GClasses::GBlobQueue::dequeue |
( |
size_t |
len | ) |
|
Returns a pointer to the specified number of bytes, and advances the queue by that amount. If less than the required amount is available, then it will buffer any remaining bytes and return NULL, and not advance the queue. (The idea is that you will enqueue some more bytes and then try again.) In most cases, this method will just return a pointer within the blob that was most recently enqueued, but it may return a pointer to its own buffer when breaks occur at unfortunate positions. (The internal buffer is guaranteed to grow no bigger than the largest value ever passed for len.)