10
10
#include < variant>
11
11
12
12
#include < fmt/format.h>
13
+ #include < wpi/mutex.h>
14
+ #include < wpi/telemetry/TelemetryEntry.h>
13
15
14
- #include " wpi/mutex.h"
15
- #include " wpi/telemetry/TelemetryEntry.h"
16
- #include " wpi/DataLog.h"
16
+ #include " wpi/datalog/DataLog.h"
17
17
18
- using namespace wpi ;
18
+ using namespace wpi ::log ;
19
19
20
- class DataLogTelemetryBackend ::Entry : public TelemetryEntry {
20
+ class DataLogTelemetryBackend ::Entry : public wpi:: TelemetryEntry {
21
21
public:
22
- Entry (wpi::log:: DataLog& log, std::string_view prefix, std::string_view path)
22
+ Entry (DataLog& log, std::string_view prefix, std::string_view path)
23
23
: m_log{log}, m_path{fmt::format (" {}{}" , prefix, path)} {}
24
24
25
25
void KeepDuplicates () override { m_keepDuplicates = true ; }
@@ -70,30 +70,24 @@ class DataLogTelemetryBackend::Entry : public TelemetryEntry {
70
70
}
71
71
}
72
72
73
- void LogBoolean (bool value) override {
74
- Log<wpi::log::BooleanLogEntry>(value);
75
- }
73
+ void LogBoolean (bool value) override { Log<BooleanLogEntry>(value); }
76
74
77
- void LogInt64 (int64_t value) override {
78
- Log<wpi::log::IntegerLogEntry>(value);
79
- }
75
+ void LogInt64 (int64_t value) override { Log<IntegerLogEntry>(value); }
80
76
81
- void LogFloat (float value) override { Log<wpi::log:: FloatLogEntry>(value); }
77
+ void LogFloat (float value) override { Log<FloatLogEntry>(value); }
82
78
83
- void LogDouble (double value) override {
84
- Log<wpi::log::DoubleLogEntry>(value);
85
- }
79
+ void LogDouble (double value) override { Log<DoubleLogEntry>(value); }
86
80
87
81
void LogString (std::string_view value, std::string_view typeString) override {
88
- LogTypeString<wpi::log:: StringLogEntry>(value, typeString);
82
+ LogTypeString<StringLogEntry>(value, typeString);
89
83
}
90
84
91
85
void LogBooleanArray (std::span<const bool > value) override {
92
- Log<wpi::log:: BooleanArrayLogEntry>(value);
86
+ Log<BooleanArrayLogEntry>(value);
93
87
}
94
88
95
89
void LogBooleanArray (std::span<const int > value) override {
96
- Log<wpi::log:: BooleanArrayLogEntry>(value);
90
+ Log<BooleanArrayLogEntry>(value);
97
91
}
98
92
99
93
void LogInt16Array (std::span<const int16_t > value) override {
@@ -105,54 +99,52 @@ class DataLogTelemetryBackend::Entry : public TelemetryEntry {
105
99
}
106
100
107
101
void LogInt64Array (std::span<const int64_t > value) override {
108
- Log<wpi::log:: IntegerArrayLogEntry>(value);
102
+ Log<IntegerArrayLogEntry>(value);
109
103
}
110
104
111
105
void LogFloatArray (std::span<const float > value) override {
112
- Log<wpi::log:: FloatArrayLogEntry>(value);
106
+ Log<FloatArrayLogEntry>(value);
113
107
}
114
108
115
109
void LogDoubleArray (std::span<const double > value) override {
116
- Log<wpi::log:: DoubleArrayLogEntry>(value);
110
+ Log<DoubleArrayLogEntry>(value);
117
111
}
118
112
119
113
void LogStringArray (std::span<const std::string> value) override {
120
- Log<wpi::log:: StringArrayLogEntry>(value);
114
+ Log<StringArrayLogEntry>(value);
121
115
}
122
116
123
117
void LogStringArray (std::span<const std::string_view> value) override {
124
- Log<wpi::log:: StringArrayLogEntry>(value);
118
+ Log<StringArrayLogEntry>(value);
125
119
}
126
120
127
121
void LogRaw (std::span<const uint8_t > value,
128
122
std::string_view typeString) override {
129
- LogTypeString<wpi::log:: RawLogEntry>(value, typeString);
123
+ LogTypeString<RawLogEntry>(value, typeString);
130
124
}
131
125
132
126
private:
133
- wpi::log:: DataLog& m_log;
127
+ DataLog& m_log;
134
128
std::string m_path;
135
129
wpi::mutex m_mutex;
136
- std::variant<std::monostate, wpi::log::BooleanLogEntry,
137
- wpi::log::IntegerLogEntry, wpi::log::FloatLogEntry,
138
- wpi::log::DoubleLogEntry, wpi::log::StringLogEntry,
139
- wpi::log::BooleanArrayLogEntry, wpi::log::IntegerArrayLogEntry,
140
- wpi::log::FloatArrayLogEntry, wpi::log::DoubleArrayLogEntry,
141
- wpi::log::StringArrayLogEntry, wpi::log::RawLogEntry>
130
+ std::variant<std::monostate, BooleanLogEntry, IntegerLogEntry, FloatLogEntry,
131
+ DoubleLogEntry, StringLogEntry, BooleanArrayLogEntry,
132
+ IntegerArrayLogEntry, FloatArrayLogEntry, DoubleArrayLogEntry,
133
+ StringArrayLogEntry, RawLogEntry>
142
134
m_entry;
143
135
std::string m_typeString;
144
136
std::atomic_bool m_keepDuplicates{false };
145
137
wpi::StringMap<std::string> m_propertiesMap;
146
138
std::string m_properties = " {}" ;
147
139
};
148
140
149
- DataLogTelemetryBackend::DataLogTelemetryBackend (wpi::log:: DataLog& log,
141
+ DataLogTelemetryBackend::DataLogTelemetryBackend (DataLog& log,
150
142
std::string_view prefix)
151
143
: m_log{log}, m_prefix{prefix} {}
152
144
153
145
DataLogTelemetryBackend::~DataLogTelemetryBackend () = default ;
154
146
155
- TelemetryEntry& DataLogTelemetryBackend::GetEntry (std::string_view path) {
147
+ wpi:: TelemetryEntry& DataLogTelemetryBackend::GetEntry (std::string_view path) {
156
148
std::scoped_lock lock{m_mutex};
157
149
return m_entries.try_emplace (path, m_log, m_prefix, path).first ->second ;
158
150
}
0 commit comments