@@ -39,13 +39,13 @@ class InvalidArguments : public PowerGridError {
39
39
};
40
40
41
41
template <std::same_as<TypeValuePair>... Options>
42
- InvalidArguments (std::string const & method, std::string const & arguments) {
42
+ InvalidArguments (std::string_view method, std::string_view arguments) {
43
43
append_msg (std::format (" {} is not implemented for {}!\n " , method, arguments));
44
44
}
45
45
46
46
template <class ... Options>
47
47
requires (std::same_as<std::remove_cvref_t <Options>, TypeValuePair> && ...)
48
- InvalidArguments (std::string const & method, Options const &... options)
48
+ InvalidArguments (std::string_view method, Options const &... options)
49
49
: InvalidArguments{method, " the following combination of options" } {
50
50
(append_msg (std::format (" {}: {}\n " , options.name , options.value )), ...);
51
51
}
@@ -54,7 +54,7 @@ class InvalidArguments : public PowerGridError {
54
54
class MissingCaseForEnumError : public InvalidArguments {
55
55
public:
56
56
template <typename T>
57
- MissingCaseForEnumError (std::string const & method, T const & value)
57
+ MissingCaseForEnumError (std::string_view method, T const & value)
58
58
: InvalidArguments{method,
59
59
std::format (" {} #{}" , typeid (T).name (), detail::to_string (static_cast <IntS>(value)))} {}
60
60
};
@@ -97,7 +97,7 @@ class InvalidTransformerClock : public PowerGridError {
97
97
98
98
class SparseMatrixError : public PowerGridError {
99
99
public:
100
- SparseMatrixError (Idx err, std::string const & msg = " " ) {
100
+ SparseMatrixError (Idx err, std::string_view msg = " " ) {
101
101
append_msg (
102
102
std::format (" Sparse matrix error with error code #{} (possibly singular)\n " , detail::to_string (err)));
103
103
if (!msg.empty ()) {
@@ -117,7 +117,7 @@ class SparseMatrixError : public PowerGridError {
117
117
118
118
class NotObservableError : public PowerGridError {
119
119
public:
120
- NotObservableError (std::string const & msg = " " ) {
120
+ NotObservableError (std::string_view msg = " " ) {
121
121
append_msg (" Not enough measurements available for state estimation.\n " );
122
122
if (!msg.empty ()) {
123
123
append_msg (std::format (" {}\n " , msg));
@@ -137,7 +137,7 @@ class IterationDiverge : public PowerGridError {
137
137
138
138
class MaxIterationReached : public IterationDiverge {
139
139
public:
140
- MaxIterationReached (std::string const & msg = " " ) {
140
+ MaxIterationReached (std::string_view msg = " " ) {
141
141
append_msg (std::format (" Maximum number of iterations reached{}\n " , msg));
142
142
}
143
143
};
@@ -161,25 +161,25 @@ class Idx2DNotFound : public PowerGridError {
161
161
162
162
class InvalidMeasuredObject : public PowerGridError {
163
163
public:
164
- InvalidMeasuredObject (std::string const & object, std::string const & sensor) {
164
+ InvalidMeasuredObject (std::string_view object, std::string_view sensor) {
165
165
append_msg (std::format (" {} measurement is not supported for object of type {}" , sensor, object));
166
166
}
167
167
};
168
168
169
169
class InvalidMeasuredTerminalType : public PowerGridError {
170
170
public:
171
- InvalidMeasuredTerminalType (MeasuredTerminalType const terminal_type, std::string const & sensor) {
171
+ InvalidMeasuredTerminalType (MeasuredTerminalType const terminal_type, std::string_view sensor) {
172
172
append_msg (std::format (" {} measurement is not supported for object of type {}" , sensor,
173
173
detail::to_string (static_cast <IntS>(terminal_type))));
174
174
}
175
175
};
176
176
177
177
class InvalidRegulatedObject : public PowerGridError {
178
178
public:
179
- InvalidRegulatedObject (std::string const & object, std::string const & regulator) {
179
+ InvalidRegulatedObject (std::string_view object, std::string_view regulator) {
180
180
append_msg (std::format (" {} regulator is not supported for object of type {}" , regulator, object));
181
181
}
182
- InvalidRegulatedObject (ID id, std::string const & regulator) {
182
+ InvalidRegulatedObject (ID id, std::string_view regulator) {
183
183
append_msg (
184
184
std::format (" {} regulator is not supported for object with ID {}" , regulator, detail::to_string (id)));
185
185
}
@@ -203,7 +203,7 @@ class AutomaticTapCalculationError : public PowerGridError {
203
203
204
204
class AutomaticTapInputError : public PowerGridError {
205
205
public:
206
- AutomaticTapInputError (std::string const & msg) {
206
+ AutomaticTapInputError (std::string_view msg) {
207
207
append_msg (std::format (" Automatic tap changer has invalid configuration. {}" , msg));
208
208
}
209
209
};
@@ -215,14 +215,21 @@ class IDWrongType : public PowerGridError {
215
215
}
216
216
};
217
217
218
+ class ConflictingAngleMeasurementType : public PowerGridError {
219
+ public:
220
+ ConflictingAngleMeasurementType (std::string_view msg) {
221
+ append_msg (std::format (" Conflicting angle measurement type. {}" , msg));
222
+ }
223
+ };
224
+
218
225
class CalculationError : public PowerGridError {
219
226
public:
220
- explicit CalculationError (std::string const & msg) { append_msg (msg); }
227
+ explicit CalculationError (std::string_view msg) { append_msg (msg); }
221
228
};
222
229
223
230
class BatchCalculationError : public CalculationError {
224
231
public:
225
- BatchCalculationError (std::string const & msg, IdxVector failed_scenarios, std::vector<std::string> err_msgs)
232
+ BatchCalculationError (std::string_view msg, IdxVector failed_scenarios, std::vector<std::string> err_msgs)
226
233
: CalculationError(msg), failed_scenarios_{std::move (failed_scenarios)}, err_msgs_(std::move(err_msgs)) {}
227
234
228
235
IdxVector const & failed_scenarios () const { return failed_scenarios_; }
@@ -270,12 +277,12 @@ class InvalidShortCircuitPhaseOrType : public PowerGridError {
270
277
271
278
class SerializationError : public PowerGridError {
272
279
public:
273
- explicit SerializationError (std::string const & msg) { append_msg (msg); }
280
+ explicit SerializationError (std::string_view msg) { append_msg (msg); }
274
281
};
275
282
276
283
class DatasetError : public PowerGridError {
277
284
public:
278
- explicit DatasetError (std::string const & msg) { append_msg (std::format (" Dataset error: {}" , msg)); }
285
+ explicit DatasetError (std::string_view msg) { append_msg (std::format (" Dataset error: {}" , msg)); }
279
286
};
280
287
281
288
class ExperimentalFeature : public InvalidArguments {
@@ -289,7 +296,7 @@ class NotImplementedError : public PowerGridError {
289
296
290
297
class UnreachableHit : public PowerGridError {
291
298
public:
292
- UnreachableHit (std::string const & method, std::string const & reason_for_assumption) {
299
+ UnreachableHit (std::string_view method, std::string_view reason_for_assumption) {
293
300
append_msg (std::format (" Unreachable code hit when executing {}.\n The following assumption for unreachability "
294
301
" was not met: {}.\n This may be a bug in the library\n " ,
295
302
method, reason_for_assumption));
@@ -299,7 +306,7 @@ class UnreachableHit : public PowerGridError {
299
306
class TapSearchStrategyIncompatibleError : public InvalidArguments {
300
307
public:
301
308
template <typename T1, typename T2>
302
- TapSearchStrategyIncompatibleError (std::string const & method, T1 const & value1, T2 const & value2)
309
+ TapSearchStrategyIncompatibleError (std::string_view method, T1 const & value1, T2 const & value2)
303
310
: InvalidArguments{method, std::format (" {} #{} and {} #{}" , typeid (T1).name (),
304
311
detail::to_string (static_cast <IntS>(value1)), typeid (T2).name (),
305
312
detail::to_string (static_cast <IntS>(value2)))} {}
0 commit comments