3 * @purpose Declaration of data handling functions; saving, loading, displaying, selecting.
9 #define DATA_BUFSIZ 10 // Size to use for DataPoint buffers (TODO: Optimise)
14 /** Structure to represent a time, value DataPoint **/
17 /** Time at which data was taken **/
23 /** Enum of output format types for DataPoints **/
27 TSV // Tab seperated vector
31 * Structure to represent a collection of data.
32 * All operations involving this structure are thread safe.
33 * NOTE: It is essentially a wrapper around a binary file.
37 FILE * file; // file pointer
38 int num_points; // Number of DataPoints in the file
39 char * filename; // Name of the file
40 pthread_mutex_t mutex; // Mutex around num_points
44 extern void Data_Init(DataFile * df); // One off initialisation of DataFile
45 extern void Data_Open(DataFile * df, const char * filename); // Open data file
46 extern void Data_Close(DataFile * df);
47 extern void Data_Save(DataFile * df, DataPoint * buffer, int amount); // Save data to file
48 extern int Data_Read(DataFile * df, DataPoint * buffer, int index, int amount); // Retrieve data from file
49 extern void Data_PrintByIndexes(DataFile * df, int start_index, int end_index, DataFormat format); // Print data buffer
50 extern void Data_PrintByTimes(DataFile * df, double start_time, double end_time, DataFormat format); // Print data between time values
51 extern int Data_FindByTime(DataFile * df, double time_stamp, DataPoint * closest); // Find index of DataPoint with the closest timestamp to that given