Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Pipe.h
- Revision:
- 21:c4d64830bf02
- Parent:
- 13:e2446fcdc246
- Child:
- 40:295099ff5338
diff -r 2b5d097ca15d -r c4d64830bf02 Pipe.h
--- 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)