Add files via upload
authorFrançois Grondin <Francois.Grondin2@USherbrooke.ca>
Mon, 3 Jul 2017 19:16:30 +0000 (15:16 -0400)
committerGitHub <noreply@github.com>
Mon, 3 Jul 2017 19:16:30 +0000 (15:16 -0400)
src/connector/con_hops.c [new file with mode: 0644]
src/connector/con_hops.h [new file with mode: 0644]
src/connector/con_pots.c [new file with mode: 0644]
src/connector/con_pots.h [new file with mode: 0644]
src/connector/con_spectra.c [new file with mode: 0644]
src/connector/con_spectra.h [new file with mode: 0644]
src/connector/con_tracks.c [new file with mode: 0644]
src/connector/con_tracks.h [new file with mode: 0644]

diff --git a/src/connector/con_hops.c b/src/connector/con_hops.c
new file mode 100644 (file)
index 0000000..78279ad
--- /dev/null
@@ -0,0 +1,57 @@
+    
+    #include "con_hops.h"
+
+    con_hops_obj * con_hops_construct_zero(const unsigned int nOuts, const msg_hops_cfg * msg_hops_config) {
+
+        con_hops_obj * obj;
+        unsigned int iOut;
+
+        obj = (con_hops_obj *) malloc(sizeof(con_hops_obj));
+
+        obj->nOuts = nOuts;
+
+        obj->in = msg_hops_construct(msg_hops_config);
+
+        obj->outs = (msg_hops_obj **) malloc(sizeof(msg_hops_obj *) * nOuts);
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            obj->outs[iOut] = msg_hops_construct(msg_hops_config);
+        }
+
+        return obj;
+
+    }
+
+    void con_hops_destroy(con_hops_obj * obj) {
+
+        unsigned int iOut;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_hops_destroy(obj->outs[iOut]);
+        }
+        free((void *) obj->outs);
+
+        msg_hops_destroy(obj->in);
+
+        free((void *) obj);
+
+    }
+
+    int con_hops_process(con_hops_obj * obj) {
+
+        unsigned int iOut;
+        int rtnValue;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_hops_copy(obj->outs[iOut], obj->in);
+        }
+
+        if (msg_hops_isZero(obj->in) == 1) {
+            rtnValue = -1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
\ No newline at end of file
diff --git a/src/connector/con_hops.h b/src/connector/con_hops.h
new file mode 100644 (file)
index 0000000..8a5474c
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __ODAS_CONNECTOR_HOPS
+#define __ODAS_CONNECTOR_HOPS
+
+    #include "../message/msg_hops.h"
+
+    #include <stdlib.h>
+    #include <stdio.h>
+
+    typedef struct con_hops_obj {
+
+        msg_hops_obj * in;
+        msg_hops_obj ** outs;
+
+        unsigned int nOuts;
+
+    } con_hops_obj;
+
+    con_hops_obj * con_hops_construct_zero(const unsigned int nOuts, const msg_hops_cfg * msg_hops_config);
+
+    void con_hops_destroy(con_hops_obj * obj);
+
+    int con_hops_process(con_hops_obj * obj);
+
+#endif
\ No newline at end of file
diff --git a/src/connector/con_pots.c b/src/connector/con_pots.c
new file mode 100644 (file)
index 0000000..05ad4c1
--- /dev/null
@@ -0,0 +1,57 @@
+    
+    #include "con_pots.h"
+
+    con_pots_obj * con_pots_construct_zero(const unsigned int nOuts, const msg_pots_cfg * msg_pots_config) {
+
+        con_pots_obj * obj;
+        unsigned int iOut;
+
+        obj = (con_pots_obj *) malloc(sizeof(con_pots_obj));
+
+        obj->nOuts = nOuts;
+
+        obj->in = msg_pots_construct(msg_pots_config);
+
+        obj->outs = (msg_pots_obj **) malloc(sizeof(msg_pots_obj *) * nOuts);
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            obj->outs[iOut] = msg_pots_construct(msg_pots_config);
+        }
+
+        return obj;
+
+    }
+
+    void con_pots_destroy(con_pots_obj * obj) {
+
+        unsigned int iOut;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_pots_destroy(obj->outs[iOut]);
+        }
+        free((void *) obj->outs);
+
+        msg_pots_destroy(obj->in);
+
+        free((void *) obj);
+
+    }
+
+    int con_pots_process(con_pots_obj * obj) {
+
+        unsigned int iOut;
+        int rtnValue;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_pots_copy(obj->outs[iOut], obj->in);
+        }
+
+        if (msg_pots_isZero(obj->in) == 1) {
+            rtnValue = -1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
\ No newline at end of file
diff --git a/src/connector/con_pots.h b/src/connector/con_pots.h
new file mode 100644 (file)
index 0000000..fbea0a1
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __ODAS_CONNECTOR_POTS
+#define __ODAS_CONNECTOR_POTS
+
+    #include "../message/msg_pots.h"
+
+    #include <stdlib.h>
+    #include <stdio.h>
+
+    typedef struct con_pots_obj {
+
+        msg_pots_obj * in;
+        msg_pots_obj ** outs;
+
+        unsigned int nOuts;
+
+    } con_pots_obj;
+
+    con_pots_obj * con_pots_construct_zero(const unsigned int nOuts, const msg_pots_cfg * msg_pots_config);
+
+    void con_pots_destroy(con_pots_obj * obj);
+
+    int con_pots_process(con_pots_obj * obj);
+
+#endif
\ No newline at end of file
diff --git a/src/connector/con_spectra.c b/src/connector/con_spectra.c
new file mode 100644 (file)
index 0000000..ffb7470
--- /dev/null
@@ -0,0 +1,57 @@
+    
+    #include "con_spectra.h"
+
+    con_spectra_obj * con_spectra_construct_zero(const unsigned int nOuts, const msg_spectra_cfg * msg_spectra_config) {
+
+        con_spectra_obj * obj;
+        unsigned int iOut;
+
+        obj = (con_spectra_obj *) malloc(sizeof(con_spectra_obj));
+
+        obj->nOuts = nOuts;
+
+        obj->in = msg_spectra_construct(msg_spectra_config);
+
+        obj->outs = (msg_spectra_obj **) malloc(sizeof(msg_spectra_obj *) * nOuts);
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            obj->outs[iOut] = msg_spectra_construct(msg_spectra_config);
+        }
+
+        return obj;
+
+    }
+
+    void con_spectra_destroy(con_spectra_obj * obj) {
+
+        unsigned int iOut;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_spectra_destroy(obj->outs[iOut]);
+        }
+        free((void *) obj->outs);
+
+        msg_spectra_destroy(obj->in);
+
+        free((void *) obj);
+
+    }
+
+    int con_spectra_process(con_spectra_obj * obj) {
+
+        unsigned int iOut;
+        int rtnValue;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_spectra_copy(obj->outs[iOut], obj->in);
+        }
+
+        if (msg_spectra_isZero(obj->in) == 1) {
+            rtnValue = -1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
\ No newline at end of file
diff --git a/src/connector/con_spectra.h b/src/connector/con_spectra.h
new file mode 100644 (file)
index 0000000..379262e
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __ODAS_CONNECTOR_SPECTRA
+#define __ODAS_CONNECTOR_SPECTRA
+
+    #include "../message/msg_spectra.h"
+
+    #include <stdlib.h>
+    #include <stdio.h>
+
+    typedef struct con_spectra_obj {
+
+        msg_spectra_obj * in;
+        msg_spectra_obj ** outs;
+
+        unsigned int nOuts;
+
+    } con_spectra_obj;
+
+    con_spectra_obj * con_spectra_construct_zero(const unsigned int nOuts, const msg_spectra_cfg * msg_spectra_config);
+
+    void con_spectra_destroy(con_spectra_obj * obj);
+
+    int con_spectra_process(con_spectra_obj * obj);
+
+#endif
\ No newline at end of file
diff --git a/src/connector/con_tracks.c b/src/connector/con_tracks.c
new file mode 100644 (file)
index 0000000..46e2932
--- /dev/null
@@ -0,0 +1,57 @@
+    
+    #include "con_tracks.h"
+
+    con_tracks_obj * con_tracks_construct_zero(const unsigned int nOuts, const msg_tracks_cfg * msg_tracks_config) {
+
+        con_tracks_obj * obj;
+        unsigned int iOut;
+
+        obj = (con_tracks_obj *) malloc(sizeof(con_tracks_obj));
+
+        obj->nOuts = nOuts;
+
+        obj->in = msg_tracks_construct(msg_tracks_config);
+
+        obj->outs = (msg_tracks_obj **) malloc(sizeof(msg_tracks_obj *) * nOuts);
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            obj->outs[iOut] = msg_tracks_construct(msg_tracks_config);
+        }
+
+        return obj;        
+
+    }
+
+    void con_tracks_destroy(con_tracks_obj * obj) {
+
+        unsigned int iOut;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_tracks_destroy(obj->outs[iOut]);
+        }
+        free((void *) obj->outs);
+
+        msg_tracks_destroy(obj->in);
+
+        free((void *) obj);
+
+    }
+
+    int con_tracks_process(con_tracks_obj * obj) {
+
+        unsigned int iOut;
+        int rtnValue;
+
+        for (iOut = 0; iOut < obj->nOuts; iOut++) {
+            msg_tracks_copy(obj->outs[iOut], obj->in);
+        }
+
+        if (msg_tracks_isZero(obj->in) == 1) {
+            rtnValue = -1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
\ No newline at end of file
diff --git a/src/connector/con_tracks.h b/src/connector/con_tracks.h
new file mode 100644 (file)
index 0000000..bcd5a96
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __ODAS_CONNECTOR_TRACKS
+#define __ODAS_CONNECTOR_TRACKS
+
+    #include "../message/msg_tracks.h"
+
+    #include <stdlib.h>
+    #include <stdio.h>
+
+    typedef struct con_tracks_obj {
+
+        msg_tracks_obj * in;
+        msg_tracks_obj ** outs;
+
+        unsigned int nOuts;
+
+    } con_tracks_obj;
+
+    con_tracks_obj * con_tracks_construct_zero(const unsigned int nOuts, const msg_tracks_cfg * msg_tracks_config);
+
+    void con_tracks_destroy(con_tracks_obj * obj);
+
+    int con_tracks_process(con_tracks_obj * obj);
+
+#endif
\ No newline at end of file