Add a bunch of APNs
Fork of C027_Support by
Diff: Pipe.h
- Revision:
- 21:c4d64830bf02
- Parent:
- 13:e2446fcdc246
- Child:
- 40:295099ff5338
--- a/Pipe.h Mon Mar 24 07:38:05 2014 +0000 +++ b/Pipe.h Tue Apr 08 09:15:37 2014 +0000 @@ -25,6 +25,17 @@ if (_a) delete [] _a; } + void dump(void) + { + int o = _r; + printf("pipe: %d/%d ", size(), _s); + while (o != _w) { + T t = _b[o]; + printf("%0*X", sizeof(T)*2, t); + o = _inc(o); + } + printf("\n"); + } // writing thread bool writeable(void) // = not full { @@ -128,10 +139,12 @@ // the following functions are useful if you like to inspect or parse the buffer //! reset the parsing index and return the number of available elments - virtual int start(void) + virtual int set(int ix) { - _o = _r; - return size(); + int sz = size(); + ix = (ix > sz) ? sz : ix; + _o = _inc(_r, ix); + return sz - ix; } //! get the next element and increment virtual T next(void)