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.
Dependencies: fll mbed-rtos mbed
Diff: fll.cpp
- Revision:
- 5:130721ce29f7
- Parent:
- 4:9ee673ca05ad
- Child:
- 6:d0348b7a2f05
--- a/fll.cpp Sat Feb 14 06:49:42 2015 +0000
+++ b/fll.cpp Sat Feb 14 07:25:27 2015 +0000
@@ -23,7 +23,6 @@
// TODO: without loop
button_t Source::await()
{
-
if (size == 0) {
return 0;
}
@@ -32,16 +31,22 @@
}
// ----
-// Flow
+// Pipe
// ----
-button_t Flow::await()
+Pipe::Pipe(Source **srcs, int srcs_size) : Source(NULL, 0, 1) {
+ sources = srcs;
+ sources_size = srcs_size;
+}
+
+button_t Pipe::await()
{
- std::vector<button_t> bs;
- for (int k = 0; k < sources.size(); k++) {
- button_t b = sources[k]->await();
- bs.push_back(b);
+ button_t *bs = (button_t*) malloc(sizeof(button_t) * sources_size);
+ for (int i = 0; i < sources_size; i++) {
+ bs[i] = sources[i]->await();
}
- return fold(bs);
+ button_t b = fold(bs, sources_size);
+ free(bs);
+ return b;
}
