summaryrefslogtreecommitdiffstats
path: root/src/ufo-roof-buffer.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 09:16:57 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 09:16:57 +0100
commit3d93df54d024f49895db6277e873dccd10b5baec (patch)
treec664797c69e4b4680d04aee7669da03e452e0c5d /src/ufo-roof-buffer.h
downloadufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.tar.gz
ufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.tar.bz2
ufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.tar.xz
ufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.zip
The first test (file file-base simmulation)
Diffstat (limited to 'src/ufo-roof-buffer.h')
-rw-r--r--src/ufo-roof-buffer.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ufo-roof-buffer.h b/src/ufo-roof-buffer.h
new file mode 100644
index 0000000..bb71791
--- /dev/null
+++ b/src/ufo-roof-buffer.h
@@ -0,0 +1,31 @@
+#ifndef __UFO_ROOF_BUFFER_H
+#define __UFO_ROOF_BUUFER_H
+
+#include <stdatomic.h>
+
+struct _UfoRoofBuffer {
+ guint current_id; // The ID of the first (active) dataset in the buffer
+
+ guint ring_size; // Number of datasets to buffer
+ void *ring_buffer; // The ring buffer
+ _Atomic int *n_fragments; // Number of completed fragments in each buffer
+ guint *stream_fragment; // Currently processed fragment in the stream (for ordered streams)
+// int *fragments; // Mark individual completed fragments (if we care for partial data)
+
+
+ guint dataset_size; // Size (in bytes) of a full dataset
+ guint fragment_size; // Size (in bytes) of a single fragment (we expect fixed-size fragments at the moment)
+
+ guint fragments_per_dataset; // Number of packets in dataset (used to compute when dataset is ready)
+ guint fragments_per_stream; // Number of packets in each of data streams (used to compute when dataset is ready)
+};
+
+typedef struct _UfoRoofBuffer UfoRoofBuffer;
+
+UfoRoofBuffer *ufo_roof_buffer_new(UfoRoofConfig *cfg, GError **error);
+void ufo_roof_buffer_free(UfoRoofBuffer *buf);
+
+gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, guint fragment_id, gconstpointer fragment, GError **error);
+gboolean ufo_roof_buffer_get_dataset(UfoRoofBuffer *buffer, gpointer output_buffer, GError **error);
+
+#endif