From: François Grondin Date: Mon, 3 Jul 2017 19:08:10 +0000 (-0400) Subject: Add files via upload X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=1842b4299ee127fe550a544993bec0f03e843241;p=yn%2Fyn-odas.git Add files via upload --- diff --git a/src/aconnector/acon_hops.c b/src/aconnector/acon_hops.c new file mode 100644 index 0000000..cc5ba6b --- /dev/null +++ b/src/aconnector/acon_hops.c @@ -0,0 +1,85 @@ + + #include "acon_hops.h" + + acon_hops_obj * acon_hops_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_hops_cfg * msg_hops_config) { + + acon_hops_obj * obj; + unsigned int iOut; + + obj = (acon_hops_obj *) malloc(sizeof(acon_hops_obj)); + + obj->in = amsg_hops_construct(nMessages, msg_hops_config); + + obj->outs = (amsg_hops_obj **) malloc(sizeof(amsg_hops_obj *) * nOuts); + for (iOut = 0; iOut < nOuts; iOut++) { + obj->outs[iOut] = amsg_hops_construct(nMessages, msg_hops_config); + } + + obj->con_hops = con_hops_construct_zero(nOuts, msg_hops_config); + + obj->thread = thread_construct(&acon_hops_thread, (void *) obj); + + return obj; + + } + + void acon_hops_destroy(acon_hops_obj * obj) { + + unsigned int iOut; + unsigned int nOuts; + + nOuts = obj->con_hops->nOuts; + + thread_destroy(obj->thread); + + con_hops_destroy(obj->con_hops); + + for (iOut = 0; iOut < nOuts; iOut++) { + amsg_hops_destroy(obj->outs[iOut]); + } + free((void *) obj->outs); + + amsg_hops_destroy(obj->in); + + free((void *) obj); + + + } + + void * acon_hops_thread(void * ptr) { + + msg_hops_obj * msg_hops_in; + msg_hops_obj * msg_hops_out; + + acon_hops_obj * obj; + unsigned int iOut; + unsigned int nOuts; + int rtnValue; + + obj = (acon_hops_obj *) ptr; + + nOuts = obj->con_hops->nOuts; + + while(1) { + + msg_hops_in = amsg_hops_filled_pop(obj->in); + msg_hops_copy(obj->con_hops->in, msg_hops_in); + amsg_hops_empty_push(obj->in, msg_hops_in); + + rtnValue = con_hops_process(obj->con_hops); + + for (iOut = 0; iOut < nOuts; iOut++) { + + msg_hops_out = amsg_hops_empty_pop(obj->outs[iOut]); + msg_hops_copy(msg_hops_out, obj->con_hops->outs[iOut]); + amsg_hops_filled_push(obj->outs[iOut], msg_hops_out); + + } + + if (rtnValue == -1) { + break; + } + + } + + } \ No newline at end of file diff --git a/src/aconnector/acon_hops.h b/src/aconnector/acon_hops.h new file mode 100644 index 0000000..965849e --- /dev/null +++ b/src/aconnector/acon_hops.h @@ -0,0 +1,27 @@ +#ifndef __ODAS_ACONNECTOR_HOPS +#define __ODAS_ACONNECTOR_HOPS + + #include "../connector/con_hops.h" + #include "../amessage/amsg_hops.h" + #include "../message/msg_hops.h" + #include "../general/thread.h" + + #include + #include + + typedef struct acon_hops_obj { + + amsg_hops_obj * in; + amsg_hops_obj ** outs; + con_hops_obj * con_hops; + thread_obj * thread; + + } acon_hops_obj; + + acon_hops_obj * acon_hops_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_hops_cfg * msg_hops_config); + + void acon_hops_destroy(acon_hops_obj * obj); + + void * acon_hops_thread(void * ptr); + +#endif \ No newline at end of file diff --git a/src/aconnector/acon_pots.c b/src/aconnector/acon_pots.c new file mode 100644 index 0000000..2da99ae --- /dev/null +++ b/src/aconnector/acon_pots.c @@ -0,0 +1,85 @@ + + #include "acon_pots.h" + + acon_pots_obj * acon_pots_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_pots_cfg * msg_pots_config) { + + acon_pots_obj * obj; + unsigned int iOut; + + obj = (acon_pots_obj *) malloc(sizeof(acon_pots_obj)); + + obj->in = amsg_pots_construct(nMessages, msg_pots_config); + + obj->outs = (amsg_pots_obj **) malloc(sizeof(amsg_pots_obj *) * nOuts); + for (iOut = 0; iOut < nOuts; iOut++) { + obj->outs[iOut] = amsg_pots_construct(nMessages, msg_pots_config); + } + + obj->con_pots = con_pots_construct_zero(nOuts, msg_pots_config); + + obj->thread = thread_construct(&acon_pots_thread, (void *) obj); + + return obj; + + } + + void acon_pots_destroy(acon_pots_obj * obj) { + + unsigned int iOut; + unsigned int nOuts; + + nOuts = obj->con_pots->nOuts; + + thread_destroy(obj->thread); + + con_pots_destroy(obj->con_pots); + + for (iOut = 0; iOut < nOuts; iOut++) { + amsg_pots_destroy(obj->outs[iOut]); + } + free((void *) obj->outs); + + amsg_pots_destroy(obj->in); + + free((void *) obj); + + + } + + void * acon_pots_thread(void * ptr) { + + msg_pots_obj * msg_pots_in; + msg_pots_obj * msg_pots_out; + + acon_pots_obj * obj; + unsigned int iOut; + unsigned int nOuts; + int rtnValue; + + obj = (acon_pots_obj *) ptr; + + nOuts = obj->con_pots->nOuts; + + while(1) { + + msg_pots_in = amsg_pots_filled_pop(obj->in); + msg_pots_copy(obj->con_pots->in, msg_pots_in); + amsg_pots_empty_push(obj->in, msg_pots_in); + + rtnValue = con_pots_process(obj->con_pots); + + for (iOut = 0; iOut < nOuts; iOut++) { + + msg_pots_out = amsg_pots_empty_pop(obj->outs[iOut]); + msg_pots_copy(msg_pots_out, obj->con_pots->outs[iOut]); + amsg_pots_filled_push(obj->outs[iOut], msg_pots_out); + + } + + if (rtnValue == -1) { + break; + } + + } + + } \ No newline at end of file diff --git a/src/aconnector/acon_pots.h b/src/aconnector/acon_pots.h new file mode 100644 index 0000000..13268ba --- /dev/null +++ b/src/aconnector/acon_pots.h @@ -0,0 +1,27 @@ +#ifndef __ODAS_ACONNECTOR_POTS +#define __ODAS_ACONNECTOR_POTS + + #include "../connector/con_pots.h" + #include "../amessage/amsg_pots.h" + #include "../message/msg_pots.h" + #include "../general/thread.h" + + #include + #include + + typedef struct acon_pots_obj { + + amsg_pots_obj * in; + amsg_pots_obj ** outs; + con_pots_obj * con_pots; + thread_obj * thread; + + } acon_pots_obj; + + acon_pots_obj * acon_pots_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_pots_cfg * msg_pots_config); + + void acon_pots_destroy(acon_pots_obj * obj); + + void * acon_pots_thread(void * ptr); + +#endif \ No newline at end of file diff --git a/src/aconnector/acon_spectra.c b/src/aconnector/acon_spectra.c new file mode 100644 index 0000000..f424ae4 --- /dev/null +++ b/src/aconnector/acon_spectra.c @@ -0,0 +1,85 @@ + + #include "acon_spectra.h" + + acon_spectra_obj * acon_spectra_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_spectra_cfg * msg_spectra_config) { + + acon_spectra_obj * obj; + unsigned int iOut; + + obj = (acon_spectra_obj *) malloc(sizeof(acon_spectra_obj)); + + obj->in = amsg_spectra_construct(nMessages, msg_spectra_config); + + obj->outs = (amsg_spectra_obj **) malloc(sizeof(amsg_spectra_obj *) * nOuts); + for (iOut = 0; iOut < nOuts; iOut++) { + obj->outs[iOut] = amsg_spectra_construct(nMessages, msg_spectra_config); + } + + obj->con_spectra = con_spectra_construct_zero(nOuts, msg_spectra_config); + + obj->thread = thread_construct(&acon_spectra_thread, (void *) obj); + + return obj; + + } + + void acon_spectra_destroy(acon_spectra_obj * obj) { + + unsigned int iOut; + unsigned int nOuts; + + nOuts = obj->con_spectra->nOuts; + + thread_destroy(obj->thread); + + con_spectra_destroy(obj->con_spectra); + + for (iOut = 0; iOut < nOuts; iOut++) { + amsg_spectra_destroy(obj->outs[iOut]); + } + free((void *) obj->outs); + + amsg_spectra_destroy(obj->in); + + free((void *) obj); + + + } + + void * acon_spectra_thread(void * ptr) { + + msg_spectra_obj * msg_spectra_in; + msg_spectra_obj * msg_spectra_out; + + acon_spectra_obj * obj; + unsigned int iOut; + unsigned int nOuts; + int rtnValue; + + obj = (acon_spectra_obj *) ptr; + + nOuts = obj->con_spectra->nOuts; + + while(1) { + + msg_spectra_in = amsg_spectra_filled_pop(obj->in); + msg_spectra_copy(obj->con_spectra->in, msg_spectra_in); + amsg_spectra_empty_push(obj->in, msg_spectra_in); + + rtnValue = con_spectra_process(obj->con_spectra); + + for (iOut = 0; iOut < nOuts; iOut++) { + + msg_spectra_out = amsg_spectra_empty_pop(obj->outs[iOut]); + msg_spectra_copy(msg_spectra_out, obj->con_spectra->outs[iOut]); + amsg_spectra_filled_push(obj->outs[iOut], msg_spectra_out); + + } + + if (rtnValue == -1) { + break; + } + + } + + } \ No newline at end of file diff --git a/src/aconnector/acon_spectra.h b/src/aconnector/acon_spectra.h new file mode 100644 index 0000000..ed05177 --- /dev/null +++ b/src/aconnector/acon_spectra.h @@ -0,0 +1,27 @@ +#ifndef __ODAS_ACONNECTOR_SPECTRA +#define __ODAS_ACONNECTOR_SPECTRA + + #include "../connector/con_spectra.h" + #include "../amessage/amsg_spectra.h" + #include "../message/msg_spectra.h" + #include "../general/thread.h" + + #include + #include + + typedef struct acon_spectra_obj { + + amsg_spectra_obj * in; + amsg_spectra_obj ** outs; + con_spectra_obj * con_spectra; + thread_obj * thread; + + } acon_spectra_obj; + + acon_spectra_obj * acon_spectra_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_spectra_cfg * msg_spectra_config); + + void acon_spectra_destroy(acon_spectra_obj * obj); + + void * acon_spectra_thread(void * ptr); + +#endif \ No newline at end of file diff --git a/src/aconnector/acon_tracks.c b/src/aconnector/acon_tracks.c new file mode 100644 index 0000000..192012b --- /dev/null +++ b/src/aconnector/acon_tracks.c @@ -0,0 +1,85 @@ + + #include "acon_tracks.h" + + acon_tracks_obj * acon_tracks_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_tracks_cfg * msg_tracks_config) { + + acon_tracks_obj * obj; + unsigned int iOut; + + obj = (acon_tracks_obj *) malloc(sizeof(acon_tracks_obj)); + + obj->in = amsg_tracks_construct(nMessages, msg_tracks_config); + + obj->outs = (amsg_tracks_obj **) malloc(sizeof(amsg_tracks_obj *) * nOuts); + for (iOut = 0; iOut < nOuts; iOut++) { + obj->outs[iOut] = amsg_tracks_construct(nMessages, msg_tracks_config); + } + + obj->con_tracks = con_tracks_construct_zero(nOuts, msg_tracks_config); + + obj->thread = thread_construct(&acon_tracks_thread, (void *) obj); + + return obj; + + } + + void acon_tracks_destroy(acon_tracks_obj * obj) { + + unsigned int iOut; + unsigned int nOuts; + + nOuts = obj->con_tracks->nOuts; + + thread_destroy(obj->thread); + + con_tracks_destroy(obj->con_tracks); + + for (iOut = 0; iOut < nOuts; iOut++) { + amsg_tracks_destroy(obj->outs[iOut]); + } + free((void *) obj->outs); + + amsg_tracks_destroy(obj->in); + + free((void *) obj); + + + } + + void * acon_tracks_thread(void * ptr) { + + msg_tracks_obj * msg_tracks_in; + msg_tracks_obj * msg_tracks_out; + + acon_tracks_obj * obj; + unsigned int iOut; + unsigned int nOuts; + int rtnValue; + + obj = (acon_tracks_obj *) ptr; + + nOuts = obj->con_tracks->nOuts; + + while(1) { + + msg_tracks_in = amsg_tracks_filled_pop(obj->in); + msg_tracks_copy(obj->con_tracks->in, msg_tracks_in); + amsg_tracks_empty_push(obj->in, msg_tracks_in); + + rtnValue = con_tracks_process(obj->con_tracks); + + for (iOut = 0; iOut < nOuts; iOut++) { + + msg_tracks_out = amsg_tracks_empty_pop(obj->outs[iOut]); + msg_tracks_copy(msg_tracks_out, obj->con_tracks->outs[iOut]); + amsg_tracks_filled_push(obj->outs[iOut], msg_tracks_out); + + } + + if (rtnValue == -1) { + break; + } + + } + + } \ No newline at end of file diff --git a/src/aconnector/acon_tracks.h b/src/aconnector/acon_tracks.h new file mode 100644 index 0000000..471b867 --- /dev/null +++ b/src/aconnector/acon_tracks.h @@ -0,0 +1,27 @@ +#ifndef __ODAS_ACONNECTOR_TRACKS +#define __ODAS_ACONNECTOR_TRACKS + + #include "../connector/con_tracks.h" + #include "../amessage/amsg_tracks.h" + #include "../message/msg_tracks.h" + #include "../general/thread.h" + + #include + #include + + typedef struct acon_tracks_obj { + + amsg_tracks_obj * in; + amsg_tracks_obj ** outs; + con_tracks_obj * con_tracks; + thread_obj * thread; + + } acon_tracks_obj; + + acon_tracks_obj * acon_tracks_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_tracks_cfg * msg_tracks_config); + + void acon_tracks_destroy(acon_tracks_obj * obj); + + void * acon_tracks_thread(void * ptr); + +#endif \ No newline at end of file