![]() |
Public Member Functions | |
(id) | - initWithMaxCapacity: |
(int) | - push:withLen: |
(int) | - pop:withMaxLen: |
(int) | - pop: |
(BOOL) | - peek:withIndex: |
(int) | - peekRange:withIndex:withCount: |
(byte) | - computeChecksum:withCount: |
(int) | - size |
(int) | - capacity |
(int) | - available |
(BOOL) | - full |
(BOOL) | - empty |
(int) | - flush |
(NSString *) | - toString |
ByteQueue is a fast circular byte buffer, for pushing and poping bytes quickly. Typically would be used to prcessing IDBLUE responses.
- (int) available |
Get the number of bytes that can be added before the queue is full
- (int) capacity |
Get the maximum number of bytes that can be held in the queue
- (BOOL) empty |
Whether the queue is empty or not
- (int) flush |
Brings the ringbuffer back to the default state.
- (BOOL) full |
Whether the queue is full or not
- (id) initWithMaxCapacity: | (int) | capacity |
- (BOOL) peek: | (byte*) | val | |
withIndex: | (int) | index | |
Get the value in the queue at the specified index.
val | The location of the byte that will be assigned the value |
index | The index in the queue to retrieve the value of |
- (int) peekRange: | (byte*) | dest | |
withIndex: | (int) | index | |
withCount: | (int) | count | |
- (int) pop: | (int) | toRemove |
Pop the given number of bytes from the ByteQueue
toRemove | The number of bytes to remove |
- (int) pop: | (byte*) | dest | |
withMaxLen: | (int) | maxlen | |
Pop maxlen bytes from the ring buffer into the dest array. Dest must be an initialized buffer of at least maxlen bytes.
dest | An initialized buffer of at least maxlen bytes. |
maxlen | The number of bytes requested from the ring buffer. |
- (int) push: | (byte*) | data | |
withLen: | (int) | len | |
Push len bytes from data into the ring buffer. If the buffer has insufficient capacity to continue writing, write up to the amount of space available.
data | Pointer to an initialized data buffer of at least length len |
len | The length of the data buffer to write |
- (int) size |
Get the number of bytes held in the queue.
- (NSString *) toString |
Get the hex string representation of the ByteQueue