dol: initial dol commit
[jump.git] / dol / examples / example5 / src / consumer.c
diff --git a/dol/examples/example5/src/consumer.c b/dol/examples/example5/src/consumer.c
new file mode 100644 (file)
index 0000000..376ecee
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+#include "consumer.h"
+
+void consumer_init(DOLProcess *p)
+{
+  ; //nothing to be done here
+}
+
+int consumer_fire(DOLProcess *p)
+{
+  CREATEPORTVAR(input_port);
+
+  for (p->local->index = 0; p->local->index < NUMBER_OF_FFT_POINTS;
+       p->local->index++) {
+    CREATEPORT(input_port, PORT_OUTPUT_COEFFICIENTS, 1,
+            p->local->index, NUMBER_OF_FFT_POINTS);
+    DOL_read((void*)input_port, &(p->local->coeffs[p->local->index]),
+        sizeof(ComplexNumber), p);
+    printf("%15s: coeff[%d]: %9f + j * %9f\n",
+           "output_consumer", p->local->index,
+           p->local->coeffs[p->local->index].real,
+           p->local->coeffs[p->local->index].imag);
+  }
+
+  DOL_detach(p);
+  return -1;
+}
+