X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fdata.h;h=0573c2ee24ce1b1a6623575b43619a8152bdd031;hb=b76203e2a2b29a4e2f9e8db7ae399e6e32570715;hp=726af5c1244f519fe3877aa33283c6081231438b;hpb=8f94dbb551783aad414b57ba6da4596f19dc80a6;p=matches%2FMCTX3420.git diff --git a/server/data.h b/server/data.h index 726af5c..0573c2e 100644 --- a/server/data.h +++ b/server/data.h @@ -1,6 +1,6 @@ /** - * @file datapoint.h - * @purpose Declaration of data handling functions; saving, loading, displaying, selecting. + * @file data.h + * @brief Declaration of data handling functions; saving, loading, displaying, selecting. */ #ifndef _DATAPOINT_H @@ -34,10 +34,9 @@ typedef enum */ typedef struct { - FILE * read_file; // used for reading - FILE * write_file; // used for writing + FILE * file; // file pointer int num_points; // Number of DataPoints in the file - const char * filename; // Name of the file + char * filename; // Name of the file pthread_mutex_t mutex; // Mutex around num_points } DataFile; @@ -50,5 +49,12 @@ 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 + + +extern double Data_Callibrate(double value, double map[], int map_size); #endif //_DATAPOINT_H