major folder reorganisation, R pkg is now epclust/ at first level. Experimental usage...
[epclust.git] / old_C_code / stage1 / src / Util / utils.h
diff --git a/old_C_code/stage1/src/Util/utils.h b/old_C_code/stage1/src/Util/utils.h
new file mode 100644 (file)
index 0000000..3cb5cd1
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef PPAM_UTIL_UTILS_H
+#define PPAM_UTIL_UTILS_H
+
+#include "Util/types.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+#define CURVES_PER_REQUEST 50
+
+void free_work(Work_t* work);
+
+void free_result(Result_t* result);
+
+char readInt(FILE* stream, int64_t* integer);
+
+char readReal(FILE* stream, float* real);
+
+// convert n-bytes binary integers to uint32_t
+uint32_t bInt_to_uint(Byte* pInteger);
+
+// serialize integers with a portable bytes order
+void write_int(uint32_t integer, Byte* buffer);
+
+float bReal_to_float(Byte* pFloat);
+
+void write_real(float x, Byte* buffer);
+
+// Expected size of a Work message in bytes:
+uint32_t get_packedWork_length(uint32_t nbSeriesInChunk);
+
+// Expected size of a Result message in bytes: (uint32_t is on 4 bytes)
+uint32_t get_packedResult_length(uint32_t nbClusters);
+
+// get metadata: nbSeries
+uint32_t get_nbSeries(const char* ifileName);
+
+// get metadata: tsLength
+uint32_t get_tsLength(const char* ifileName);
+
+#endif