X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fdata.h;h=6158abeabdc8f48f4b8d32ae52eb36d3e507e3c6;hb=a671f27ecb900f91bf32b8b13edb678009e319c1;hp=e8d887f516f4a717303881e9758d80ec02ffaf3b;hpb=01d1e74d5b4cefd75d9ff4a5a2a404a71a225712;p=matches%2FMCTX3420.git diff --git a/server/data.h b/server/data.h index e8d887f..6158abe 100644 --- a/server/data.h +++ b/server/data.h @@ -6,7 +6,8 @@ #ifndef _DATAPOINT_H #define _DATAPOINT_H -#define DATA_BUFSIZ 10 // Size to use for DataPoint buffers (TODO: Optimise) +/** Size to use for DataPoint buffers (TODO: Optimise) **/ +#define DATA_BUFSIZ 10 #include "common.h" @@ -23,8 +24,8 @@ typedef struct /** Enum of output format types for DataPoints **/ typedef enum { - JSON, // JSON data - TSV // Tab seperated vector + JSON, /** JSON data */ + TSV /** Tab seperated vector */ } DataFormat; /** @@ -34,10 +35,10 @@ typedef enum */ typedef struct { - FILE * file; // file pointer - int num_points; // Number of DataPoints in the file - char * filename; // Name of the file - pthread_mutex_t mutex; // Mutex around num_points + FILE * file; /** file pointer */ + int num_points; /** Number of DataPoints in the file */ + char * filename; /** Name of the file */ + pthread_mutex_t mutex; /** Mutex around num_points */ } DataFile; @@ -49,6 +50,7 @@ extern int Data_Read(DataFile * df, DataPoint * buffer, int index, int amount); extern void Data_PrintByIndexes(DataFile * df, int start_index, int end_index, DataFormat format); // Print data buffer extern void Data_PrintByTimes(DataFile * df, double start_time, double end_time, DataFormat format); // Print data between time values extern int Data_FindByTime(DataFile * df, double time_stamp, DataPoint * closest); // Find index of DataPoint with the closest timestamp to that given +extern double Data_Calibrate(double value, double x[], double y[], int size); extern void Data_Handler(DataFile * df, FCGIValue * start, FCGIValue * end, DataFormat format, double current_time); // Helper; given FCGI params print data extern DataFormat Data_GetFormat(FCGIValue * fmt); // Helper; convert human readable format string to DataFormat