rllib
1
|
#include <rlhistoryreader.h>
Public Member Functions | |
rlHistoryReader () | |
virtual | ~rlHistoryReader () |
int | read (const char *csvName, rlTime *start, rlTime *end) |
const char * | firstLine () |
const char * | nextLine () |
int | clean () |
int | cat (const char *csvName, FILE *fout) |
Public Attributes | |
int | debug |
Private Member Functions | |
int | openFile () |
int | pushLineToMemory (const char *line) |
Private Attributes | |
rlHistoryReaderLine * | first_line |
rlHistoryReaderLine * | current_line |
rlTime | time |
FILE * | fin |
int | current_file |
char * | csv_name |
char * | csv_file_name |
This class reads tab separated text including time stamp from 10 csv files Use it together with rlHistoryLogger.
Example usage within pvbrowser slot function:
#include "rlhistoryreader.h"
typedef struct // (todo: define your data structure here) { rlHistoryReader hist; } DATA;
...snip...
static int slotButtonEvent(PARAM *p, int id, DATA *d) { if(p == NULL || id == 0 || d == NULL) return -1; if(id == buttonShowPlot) { rlTime tStart, tDiff, tEnd; tStart.year = 2009; tStart.month = 8; tStart.day = 29; tStart.hour = 0;
tDiff.hour = 24;
tEnd = tStart + tDiff;
printf("start=%s diff=%s end=%s\n",tStart.getTimeString(), tDiff.getTimeString(), tEnd.getTimeString());
if(d->hist.read("test", &tStart, &tEnd) < 0) { printf("could not read test csv file\n"); return 0; } const char *line = d->hist.firstLine(); while(*line != '\0') { printf("line=%s", line); const char *values = strchr(line,''); if(values != NULL) { float val1, val2; sscanf(values,"\t%f\t%f", &val1, &val2); printf("val1=%f val2=%f\n", val1, val2); //// fill your buffer for plotting here } line = d->hist.nextLine(); } //// display your xy-graphic from the filled buffer here } return 0; }
Definition at line 86 of file rlhistoryreader.h.
rlHistoryReader::rlHistoryReader | ( | ) |
Definition at line 22 of file rlhistoryreader.cpp.
|
virtual |
Definition at line 32 of file rlhistoryreader.cpp.
int rlHistoryReader::cat | ( | const char * | csvName, |
FILE * | fout | ||
) |
Definition at line 187 of file rlhistoryreader.cpp.
int rlHistoryReader::clean | ( | ) |
Definition at line 88 of file rlhistoryreader.cpp.
const char * rlHistoryReader::firstLine | ( | ) |
Definition at line 172 of file rlhistoryreader.cpp.
const char * rlHistoryReader::nextLine | ( | ) |
Definition at line 179 of file rlhistoryreader.cpp.
|
private |
Definition at line 110 of file rlhistoryreader.cpp.
|
private |
Definition at line 149 of file rlhistoryreader.cpp.
Definition at line 41 of file rlhistoryreader.cpp.
|
private |
Definition at line 104 of file rlhistoryreader.h.
|
private |
Definition at line 104 of file rlhistoryreader.h.
|
private |
Definition at line 103 of file rlhistoryreader.h.
|
private |
Definition at line 100 of file rlhistoryreader.h.
int rlHistoryReader::debug |
Definition at line 96 of file rlhistoryreader.h.
|
private |
Definition at line 102 of file rlhistoryreader.h.
|
private |
Definition at line 100 of file rlhistoryreader.h.
|
private |
Definition at line 101 of file rlhistoryreader.h.