12#define defaultFilePath "C:\\data"
13#define defaultFileName "tsDataLog"
14#define defaultDataName "datapoint"
15#define fileNameLength 400
16#define defLogBufferSize 1000
17#define defHeaderBufSize 1000
18#define defDataBufSize 100
33 long*,
unsigned long*, \
34 long long*,
unsigned long long*, \
36 char*,
unsigned char*, \
63 std::vector<tsDataPointer> dataVector;
66 unsigned numHeaderLines;
68 bool canAddPreamble, canAddDataHeader, isLogggingStart;
126 void getFilePath(
char* pathDestination,
size_t pathDestinationLength);
143 template <
typename T>
unsigned trackDataPoint(T* dataPointer,
const std::string& dataName)
146 if (canAddDataHeader !=
true) {
149 if (isLogggingStart !=
false) {
152 if (dataPointer !=
nullptr) {
153 if (dataName.empty()) {
166 this->dataVector.push_back(newData);
167 this->dataVecLen = this->dataVector.size();
169 return this->dataVecLen;
The core class of the library is the tsLogger class. Multiple simultaneous class objects are supporte...
void appendToPreamble(std::string appendString)
Appends a line of text to the preamble block of the log file. Replaces new line characters with space...
unsigned trackDataPoint(T *dataPointer, const std::string &dataName)
Template member function that appends the data point to the list of tracked data.
void startLogger()
Starts the logger and locks out the ability to add preambles, headers and new data points.
void getFilePath(char *pathDestination, size_t pathDestinationLength)
Allows the user to read the file path of the log file.
size_t getNumDataPoints()
Returns the total number of data points being tracked for logging by the tsLogger class object.
void addDataHeader()
Add the data header (consisting of datapoint names separated by commas) to the header file....
void addPreamble()
Adds the preamble to the log file-can only be added once and only be called before the addDataHeader ...
void logData()
Logs the data points being tracked as a line in the log file.
tsLogger()
Default constructor of the tsLogger class. Uses default values to initialize all object properties.
Data pointer structure used to track datapoints, with datapoint name and pointer to data.
_tsLogFileType
The file-types supported by tsLogger. [BINARY support coming in the future].
std::variant< int *, unsigned int *, long *, unsigned long *, long long *, unsigned long long *, float *, double *, char *, unsigned char *, bool * > smartDataPtr
This varriant datatype governs the supported data points that can be tracked.
enum _tsLogFileType tsLogFileType
The file-types supported by tsLogger. [BINARY support coming in the future].