![]() |
00001 00002 // Copyright © 2013 Cathexis Innovations Inc. All rights reserved. 00003 00004 #import <Foundation/Foundation.h> 00005 #import "IDBlue.h" 00006 00008 typedef enum _BufferState { 00009 BS_BufferEmpty, 00010 BS_BufferNormal, 00011 BS_BufferFull 00012 } BufferState; 00013 00018 @interface ByteQueue : NSObject { 00019 00020 @private 00021 byte* _data; 00022 int _capacity; 00023 int _size; 00024 00029 byte* _pStart; 00030 00035 byte* _pEnd; 00036 00037 BufferState _state; 00038 } 00039 00045 -(id) initWithMaxCapacity: (int) capacity; 00046 00056 -(int) push: (byte*) data withLen: (int) len; 00057 00066 -(int) pop: (byte*) dest withMaxLen: (int) maxlen; 00067 00073 -(int) pop: (int) toRemove; 00074 00082 -(BOOL) peek: (byte*) val withIndex: (int) index; 00083 00092 -(int) peekRange: (byte*) dest withIndex: (int) index withCount: (int) count; 00093 00094 -(byte) computeChecksum: (int) index withCount: (int) count; 00095 00099 -(int) size; 00100 00104 -(int) capacity; 00105 00109 -(int) available; 00110 00114 -(BOOL) full; 00115 00119 -(BOOL) empty; 00120 00127 -(int) flush; 00128 00133 -(NSString*) toString; 00134 @end