[2c47b73] | 1 | /** |
---|
| 2 | * @file TightDataPointStorageI.h |
---|
| 3 | * @author Sheng Di and Dingwen Tao |
---|
| 4 | * @date Aug, 2017 |
---|
| 5 | * @brief Header file for the tight data point storage (TDPS). |
---|
| 6 | * (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory. |
---|
| 7 | * See COPYRIGHT in top-level directory. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #ifndef _TightDataPointStorageI_H |
---|
| 11 | #define _TightDataPointStorageI_H |
---|
| 12 | |
---|
| 13 | #ifdef __cplusplus |
---|
| 14 | extern "C" { |
---|
| 15 | #endif |
---|
| 16 | |
---|
| 17 | #include <stdio.h> |
---|
| 18 | |
---|
| 19 | typedef struct TightDataPointStorageI |
---|
| 20 | { |
---|
| 21 | size_t dataSeriesLength; |
---|
| 22 | int allSameData; |
---|
| 23 | double realPrecision; //it's used as the pwrErrBoundRatio when errBoundMode==PW_REL |
---|
| 24 | size_t exactDataNum; |
---|
| 25 | long minValue; |
---|
| 26 | int exactByteSize; |
---|
| 27 | int dataTypeSize; //the size of data type, e.g., it's 4 when data type is int32_t |
---|
| 28 | |
---|
| 29 | int stateNum; |
---|
| 30 | int allNodes; |
---|
| 31 | |
---|
| 32 | unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) |
---|
| 33 | size_t typeArray_size; |
---|
| 34 | |
---|
| 35 | unsigned char* exactDataBytes; |
---|
| 36 | size_t exactDataBytes_size; |
---|
| 37 | |
---|
| 38 | unsigned int intervals; //quantization_intervals |
---|
| 39 | |
---|
| 40 | unsigned char isLossless; //a mark to denote whether it's lossless compression (1 is yes, 0 is no) |
---|
| 41 | |
---|
| 42 | } TightDataPointStorageI; |
---|
| 43 | |
---|
| 44 | int computeRightShiftBits(int exactByteSize, int dataType); |
---|
| 45 | int convertDataTypeSizeCode(int dataTypeSizeCode); |
---|
| 46 | int convertDataTypeSize(int dataTypeSize); |
---|
| 47 | |
---|
| 48 | void new_TightDataPointStorageI_Empty(TightDataPointStorageI **self); |
---|
| 49 | int new_TightDataPointStorageI_fromFlatBytes(TightDataPointStorageI **self, unsigned char* flatBytes, size_t flatBytesLength); |
---|
| 50 | void new_TightDataPointStorageI(TightDataPointStorageI **self, |
---|
| 51 | size_t dataSeriesLength, size_t exactDataNum, int byteSize, |
---|
| 52 | int* type, unsigned char* exactDataBytes, size_t exactDataBytes_size, |
---|
| 53 | double realPrecision, long minValue, int intervals, int dataType); |
---|
| 54 | |
---|
| 55 | void convertTDPStoBytes_int(TightDataPointStorageI* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte); |
---|
| 56 | void convertTDPStoFlatBytes_int(TightDataPointStorageI *tdps, unsigned char** bytes, size_t *size); |
---|
| 57 | void convertTDPStoFlatBytes_int_args(TightDataPointStorageI *tdps, unsigned char* bytes, size_t *size); |
---|
| 58 | void free_TightDataPointStorageI(TightDataPointStorageI *tdps); |
---|
| 59 | void free_TightDataPointStorageI2(TightDataPointStorageI *tdps); |
---|
| 60 | |
---|
| 61 | #ifdef __cplusplus |
---|
| 62 | } |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | #endif /* ----- #ifndef _TightDataPointStorageI_H ----- */ |
---|