2 #include "Util/types.h"
3 #include "Util/utils.h"
5 // serialize a Work_t object into a bytes string
6 void pack_work(Work_t
* work
, uint32_t nbSeriesInChunk
, Byte
* packedWork
)
10 while (work
->inputFileName
[index
] != 0)
12 packedWork
[index
] = work
->inputFileName
[index
];
15 // complete with zeros
16 while (index
< NCHAR_FNAME
)
17 packedWork
[index
++] = 0;
19 write_int(work
->nbSeries
, 4, packedWork
+ index
);
22 for (uint32_t i
= 0; i
< work
->nbSeries
; i
++)
24 write_int(work
->ranks
[i
], 4, packedWork
+ index
);
27 // complete with zeros
28 for (uint32_t i
= 0; i
< nbSeriesInChunk
- work
->nbSeries
; i
++)
30 write_int(0, 4, packedWork
+ index
);
34 write_int(work
->nbClusters
, 4, packedWork
+ index
);
36 write_int(work
->clustOnMedoids
, 4, packedWork
+ index
);
38 write_int(work
->p_for_dissims
, 4, packedWork
+ index
);
41 // serialize a Result_t object into a bytes string
42 void pack_result(Result_t
* result
, Byte
* packedResult
)
46 write_int(result
->nbClusters
, 4, packedResult
);
49 for (uint32_t i
= 0; i
< result
->nbClusters
; i
++)
51 write_int(result
->medoids_ID
[i
], 4, packedResult
+ index
);
55 for (uint32_t i
= 0; i
< result
->nbClusters
; i
++)
57 write_int(result
->medoids_ranks
[i
], 4, packedResult
+ index
);