13 #ifndef LOGGER_TWIRRELOGGER_H_
14 #define LOGGER_TWIRRELOGGER_H_
16 #include "../Core/Actuator.h"
17 #include "../Core/Sensor.h"
34 TwirreLogger(
const std::string & logpath,
const std::string & binpath);
37 void logActuators(std::map<std::string, Actuator*>& actuators);
38 void logSensors(std::map<std::string, Sensor*>& sensors);
39 void logSensorEvent(
Sensor * sensor, std::map<std::string, Value *> sensorValues);
40 void manualSensorEvent(std::string sensorName,
const std::vector<std::pair<std::string, std::string>> & values);
41 void logActuatorEvent(
Actuator * actuator, std::map<std::string, Parameter *> actuatorParameters);
44 void onDevicelistChanged(
void);
47 uint64_t getTimestamp(
void);
50 void setMaxArraySize(
size_t max);
53 std::shared_ptr<std::ofstream> _logfile;
54 std::shared_ptr<std::ofstream> _binfile;
55 std::chrono::time_point<std::chrono::steady_clock> _tp_start;
57 size_t _binaryDataOffset = 0;
58 size_t _maxArraySize = std::numeric_limits<size_t>::max();
61 std::string logDeviceValues(
const std::map<std::string, T *> & values);
63 void logString(
const std::string & str);
64 void logBinArrayValue(
Value * val);
67 std::vector<std::string> _logQueue;
68 std::vector<char> _binQueue;
69 std::size_t _binQueueSize = 0;
70 std::mutex _logfileMutex;
71 std::mutex _binfileMutex;
72 std::condition_variable _logfileCV;
73 std::condition_variable _binfileCV;
74 std::thread * _logfileThread;
75 std::thread * _binfileThread;
77 bool _runLogfileThread =
false;
78 bool _runBinfileThread =
false;
80 void logfileThreadMain();
81 void binfileThreadMain();
Definition: TwirreLogger.h:31
Actuator is the base class for all 'actuator'-type devices.
Definition: Actuator.h:41