Add files via upload
authorFrançois Grondin <Francois.Grondin2@USherbrooke.ca>
Mon, 3 Jul 2017 19:14:26 +0000 (15:14 -0400)
committerGitHub <noreply@github.com>
Mon, 3 Jul 2017 19:14:26 +0000 (15:14 -0400)
src/asink/asnk_hops.c [new file with mode: 0644]
src/asink/asnk_hops.h [new file with mode: 0644]
src/asink/asnk_pots.c [new file with mode: 0644]
src/asink/asnk_pots.h [new file with mode: 0644]
src/asink/asnk_spectra.c [new file with mode: 0644]
src/asink/asnk_spectra.h [new file with mode: 0644]
src/asink/asnk_tracks.c [new file with mode: 0644]
src/asink/asnk_tracks.h [new file with mode: 0644]

diff --git a/src/asink/asnk_hops.c b/src/asink/asnk_hops.c
new file mode 100644 (file)
index 0000000..9988b0e
--- /dev/null
@@ -0,0 +1,70 @@
+    
+    #include "asnk_hops.h"
+
+    asnk_hops_obj * asnk_hops_construct(const snk_hops_cfg * snk_hops_config, const msg_hops_cfg * msg_hops_config) {
+
+        asnk_hops_obj * obj;
+
+        obj = (asnk_hops_obj *) malloc(sizeof(asnk_hops_obj));
+
+        obj->snk_hops = snk_hops_construct(snk_hops_config, msg_hops_config);
+        obj->in = (amsg_hops_obj *) NULL;
+
+        obj->thread = thread_construct(&asnk_hops_thread, (void *) obj);
+
+        return obj;
+
+    }
+
+    void asnk_hops_destroy(asnk_hops_obj * obj) {
+
+        snk_hops_destroy(obj->snk_hops);
+        thread_destroy(obj->thread);
+
+        free((void *) obj);
+
+    }
+
+    void asnk_hops_connect(asnk_hops_obj * obj, amsg_hops_obj * in) {
+
+        obj->in = in;
+
+    }
+
+    void asnk_hops_disconnect(asnk_hops_obj * obj) {
+
+        obj->in = (amsg_hops_obj *) NULL;
+
+    }
+
+    void * asnk_hops_thread(void * ptr) {
+
+        asnk_hops_obj * obj;
+        msg_hops_obj * msg_hops_in;
+        int rtnValue;
+
+        obj = (asnk_hops_obj *) ptr;
+
+        // Open the sink
+        snk_hops_open(obj->snk_hops);
+
+        while(1) {
+
+            // Pop a message, process, and push back
+            msg_hops_in = amsg_hops_filled_pop(obj->in);
+            snk_hops_connect(obj->snk_hops, msg_hops_in);
+            rtnValue = snk_hops_process(obj->snk_hops);
+            snk_hops_disconnect(obj->snk_hops);
+            amsg_hops_empty_push(obj->in, msg_hops_in);
+
+            // If this is the last frame, rtnValue = -1
+            if (rtnValue == -1) {
+                break;
+            }
+
+        }
+
+        // Close the sink
+        snk_hops_close(obj->snk_hops);
+
+    }
\ No newline at end of file
diff --git a/src/asink/asnk_hops.h b/src/asink/asnk_hops.h
new file mode 100644 (file)
index 0000000..0f23071
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __ODAS_ASINK_HOPS
+#define __ODAS_ASINK_HOPS
+
+    #include "../amessage/amsg_hops.h"
+    #include "../sink/snk_hops.h"
+    #include "../general/thread.h"
+
+    #include <stdlib.h>
+
+    typedef struct asnk_hops_obj {
+
+        snk_hops_obj * snk_hops;
+        amsg_hops_obj * in;
+        thread_obj * thread;
+
+    } asnk_hops_obj;
+
+    asnk_hops_obj * asnk_hops_construct(const snk_hops_cfg * snk_hops_config, const msg_hops_cfg * msg_hops_config);
+
+    void asnk_hops_destroy(asnk_hops_obj * obj);
+
+    void asnk_hops_connect(asnk_hops_obj * obj, amsg_hops_obj * in);
+
+    void asnk_hops_disconnect(asnk_hops_obj * obj);
+
+    void * asnk_hops_thread(void * ptr);
+
+#endif
\ No newline at end of file
diff --git a/src/asink/asnk_pots.c b/src/asink/asnk_pots.c
new file mode 100644 (file)
index 0000000..71d251d
--- /dev/null
@@ -0,0 +1,70 @@
+    
+    #include "asnk_pots.h"
+
+    asnk_pots_obj * asnk_pots_construct(const snk_pots_cfg * snk_pots_config, const msg_pots_cfg * msg_pots_config) {
+
+        asnk_pots_obj * obj;
+
+        obj = (asnk_pots_obj *) malloc(sizeof(asnk_pots_obj));
+
+        obj->snk_pots = snk_pots_construct(snk_pots_config, msg_pots_config);
+        obj->in = (amsg_pots_obj *) NULL;
+
+        obj->thread = thread_construct(&asnk_pots_thread, (void *) obj);
+
+        return obj;
+
+    }
+
+    void asnk_pots_destroy(asnk_pots_obj * obj) {
+
+        snk_pots_destroy(obj->snk_pots);
+        thread_destroy(obj->thread);
+
+        free((void *) obj);
+
+    }
+
+    void asnk_pots_connect(asnk_pots_obj * obj, amsg_pots_obj * in) {
+
+        obj->in = in;
+
+    }
+
+    void asnk_pots_disconnect(asnk_pots_obj * obj) {
+
+        obj->in = (amsg_pots_obj *) NULL;
+
+    }
+
+    void * asnk_pots_thread(void * ptr) {
+
+        asnk_pots_obj * obj;
+        msg_pots_obj * msg_pots_in;
+        int rtnValue;
+
+        obj = (asnk_pots_obj *) ptr;
+
+        // Open the sink
+        snk_pots_open(obj->snk_pots);
+
+        while(1) {
+
+            // Pop a message, process, and push back
+            msg_pots_in = amsg_pots_filled_pop(obj->in);
+            snk_pots_connect(obj->snk_pots, msg_pots_in);
+            rtnValue = snk_pots_process(obj->snk_pots);
+            snk_pots_disconnect(obj->snk_pots);
+            amsg_pots_empty_push(obj->in, msg_pots_in);
+
+            // If this is the last frame, rtnValue = -1
+            if (rtnValue == -1) {
+                break;
+            }
+
+        }
+
+        // Close the sink
+        snk_pots_close(obj->snk_pots);
+
+    }
\ No newline at end of file
diff --git a/src/asink/asnk_pots.h b/src/asink/asnk_pots.h
new file mode 100644 (file)
index 0000000..2e14e1f
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __ODAS_ASINK_POTS
+#define __ODAS_ASINK_POTS
+
+    #include "../amessage/amsg_pots.h"
+    #include "../sink/snk_pots.h"
+    #include "../general/thread.h"
+
+    #include <stdlib.h>
+
+    typedef struct asnk_pots_obj {
+
+        snk_pots_obj * snk_pots;
+        amsg_pots_obj * in;
+        thread_obj * thread;
+
+    } asnk_pots_obj;
+
+    asnk_pots_obj * asnk_pots_construct(const snk_pots_cfg * snk_pots_config, const msg_pots_cfg * msg_pots_config);
+
+    void asnk_pots_destroy(asnk_pots_obj * obj);
+
+    void asnk_pots_connect(asnk_pots_obj * obj, amsg_pots_obj * in);
+
+    void asnk_pots_disconnect(asnk_pots_obj * obj);
+
+    void * asnk_pots_thread(void * ptr);
+
+#endif
\ No newline at end of file
diff --git a/src/asink/asnk_spectra.c b/src/asink/asnk_spectra.c
new file mode 100644 (file)
index 0000000..db928fc
--- /dev/null
@@ -0,0 +1,70 @@
+    
+    #include "asnk_spectra.h"
+
+    asnk_spectra_obj * asnk_spectra_construct(const snk_spectra_cfg * snk_spectra_config, const msg_spectra_cfg * msg_spectra_config) {
+
+        asnk_spectra_obj * obj;
+
+        obj = (asnk_spectra_obj *) malloc(sizeof(asnk_spectra_obj));
+
+        obj->snk_spectra = snk_spectra_construct(snk_spectra_config, msg_spectra_config);
+        obj->in = (amsg_spectra_obj *) NULL;
+
+        obj->thread = thread_construct(&asnk_spectra_thread, (void *) obj);
+
+        return obj;
+
+    }
+
+    void asnk_spectra_destroy(asnk_spectra_obj * obj) {
+
+        snk_spectra_destroy(obj->snk_spectra);
+        thread_destroy(obj->thread);
+
+        free((void *) obj);
+
+    }
+
+    void asnk_spectra_connect(asnk_spectra_obj * obj, amsg_spectra_obj * in) {
+
+        obj->in = in;
+
+    }
+
+    void asnk_spectra_disconnect(asnk_spectra_obj * obj) {
+
+        obj->in = (amsg_spectra_obj *) NULL;
+
+    }
+
+    void * asnk_spectra_thread(void * ptr) {
+
+        asnk_spectra_obj * obj;
+        msg_spectra_obj * msg_spectra_in;
+        int rtnValue;
+
+        obj = (asnk_spectra_obj *) ptr;
+
+        // Open the sink
+        snk_spectra_open(obj->snk_spectra);
+
+        while(1) {
+
+            // Pop a message, process, and push back
+            msg_spectra_in = amsg_spectra_filled_pop(obj->in);
+            snk_spectra_connect(obj->snk_spectra, msg_spectra_in);
+            rtnValue = snk_spectra_process(obj->snk_spectra);
+            snk_spectra_disconnect(obj->snk_spectra);
+            amsg_spectra_empty_push(obj->in, msg_spectra_in);
+
+            // If this is the last frame, rtnValue = -1
+            if (rtnValue == -1) {
+                break;
+            }
+
+        }
+
+        // Close the sink
+        snk_spectra_close(obj->snk_spectra);
+
+    }
\ No newline at end of file
diff --git a/src/asink/asnk_spectra.h b/src/asink/asnk_spectra.h
new file mode 100644 (file)
index 0000000..89e39a9
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __ODAS_ASINK_SPECTRA
+#define __ODAS_ASINK_SPECTRA
+
+    #include "../amessage/amsg_spectra.h"
+    #include "../sink/snk_spectra.h"
+    #include "../general/thread.h"
+
+    #include <stdlib.h>
+
+    typedef struct asnk_spectra_obj {
+
+        snk_spectra_obj * snk_spectra;
+        amsg_spectra_obj * in;
+        thread_obj * thread;
+
+    } asnk_spectra_obj;
+
+    asnk_spectra_obj * asnk_spectra_construct(const snk_spectra_cfg * snk_spectra_config, const msg_spectra_cfg * msg_spectra_config);
+
+    void asnk_spectra_destroy(asnk_spectra_obj * obj);
+
+    void asnk_spectra_connect(asnk_spectra_obj * obj, amsg_spectra_obj * in);
+
+    void asnk_spectra_disconnect(asnk_spectra_obj * obj);
+
+    void * asnk_spectra_thread(void * ptr);
+
+#endif
\ No newline at end of file
diff --git a/src/asink/asnk_tracks.c b/src/asink/asnk_tracks.c
new file mode 100644 (file)
index 0000000..a9fc3c6
--- /dev/null
@@ -0,0 +1,70 @@
+    
+    #include "asnk_tracks.h"
+
+    asnk_tracks_obj * asnk_tracks_construct(const snk_tracks_cfg * snk_tracks_config, const msg_tracks_cfg * msg_tracks_config) {
+
+        asnk_tracks_obj * obj;
+
+        obj = (asnk_tracks_obj *) malloc(sizeof(asnk_tracks_obj));
+
+        obj->snk_tracks = snk_tracks_construct(snk_tracks_config, msg_tracks_config);
+        obj->in = (amsg_tracks_obj *) NULL;
+
+        obj->thread = thread_construct(&asnk_tracks_thread, (void *) obj);
+
+        return obj;
+
+    }
+
+    void asnk_tracks_destroy(asnk_tracks_obj * obj) {
+
+        snk_tracks_destroy(obj->snk_tracks);
+        thread_destroy(obj->thread);
+
+        free((void *) obj);
+
+    }
+
+    void asnk_tracks_connect(asnk_tracks_obj * obj, amsg_tracks_obj * in) {
+
+        obj->in = in;
+
+    }
+
+    void asnk_tracks_disconnect(asnk_tracks_obj * obj) {
+
+        obj->in = (amsg_tracks_obj *) NULL;
+
+    }
+
+    void * asnk_tracks_thread(void * ptr) {
+
+        asnk_tracks_obj * obj;
+        msg_tracks_obj * msg_tracks_in;
+        int rtnValue;
+
+        obj = (asnk_tracks_obj *) ptr;
+
+        // Open the sink
+        snk_tracks_open(obj->snk_tracks);
+
+        while(1) {
+
+            // Pop a message, process, and push back
+            msg_tracks_in = amsg_tracks_filled_pop(obj->in);
+            snk_tracks_connect(obj->snk_tracks, msg_tracks_in);
+            rtnValue = snk_tracks_process(obj->snk_tracks);
+            snk_tracks_disconnect(obj->snk_tracks);
+            amsg_tracks_empty_push(obj->in, msg_tracks_in);
+
+            // If this is the last frame, rtnValue = -1
+            if (rtnValue == -1) {
+                break;
+            }
+
+        }
+
+        // Close the sink
+        snk_tracks_close(obj->snk_tracks);
+
+    }
\ No newline at end of file
diff --git a/src/asink/asnk_tracks.h b/src/asink/asnk_tracks.h
new file mode 100644 (file)
index 0000000..8acb0ef
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __ODAS_ASINK_TRACKS
+#define __ODAS_ASINK_TRACKS
+
+    #include "../amessage/amsg_tracks.h"
+    #include "../sink/snk_tracks.h"
+    #include "../general/thread.h"
+
+    #include <stdlib.h>
+
+    typedef struct asnk_tracks_obj {
+
+        snk_tracks_obj * snk_tracks;
+        amsg_tracks_obj * in;
+        thread_obj * thread;
+
+    } asnk_tracks_obj;
+
+    asnk_tracks_obj * asnk_tracks_construct(const snk_tracks_cfg * snk_tracks_config, const msg_tracks_cfg * msg_tracks_config);
+
+    void asnk_tracks_destroy(asnk_tracks_obj * obj);
+
+    void asnk_tracks_connect(asnk_tracks_obj * obj, amsg_tracks_obj * in);
+
+    void asnk_tracks_disconnect(asnk_tracks_obj * obj);
+
+    void * asnk_tracks_thread(void * ptr);
+
+#endif
\ No newline at end of file