@@ -271,23 +271,18 @@ namespace stf {
271
271
* Default formatter function used for ProtocolField objects
272
272
*/
273
273
template <typename Value>
274
- inline void defaultProtocolFieldFormatter (std::ostream& os, const char * name, const Value& data) {
274
+ inline std::enable_if_t <std::negation_v<type_utils::is_array_or_serializable_vector_like<Value>>>
275
+ defaultProtocolFieldFormatter (std::ostream& os, const char * name, const Value& data) {
275
276
format_utils::formatLabel (os, name);
276
277
format_utils::formatHex (os, data);
277
278
}
278
279
279
280
/* *
280
- * \typedef ProtocolFieldFormatter
281
- * Expected type of a ProtocolField formatter function
281
+ * Default formatter function used for ProtocolArrayField, ProtocolVectorField, and ProtocolPackedBitVectorField objects
282
282
*/
283
283
template <typename Value>
284
- using ProtocolFieldFormatter = decltype (&defaultProtocolFieldFormatter<Value>);
285
-
286
- /* *
287
- * Default formatter function used for ProtocolVectorField objects
288
- */
289
- template <typename VectorType>
290
- inline void defaultProtocolVectorFieldFormatter (std::ostream& os, const char * name, const VectorType& data) {
284
+ inline std::enable_if_t <type_utils::is_array_or_serializable_vector_like<Value>::value>
285
+ defaultProtocolFieldFormatter (std::ostream& os, const char * name, const Value& data) {
291
286
format_utils::formatLabel (os, name);
292
287
os << ' [' ;
293
288
if (!data.empty ()) {
@@ -304,12 +299,11 @@ namespace stf {
304
299
}
305
300
306
301
/* *
307
- * Default formatter function used for ProtocolArrayField objects
302
+ * \typedef ProtocolFieldFormatter
303
+ * Expected type of a ProtocolField formatter function
308
304
*/
309
- template <typename Value, size_t N>
310
- inline void defaultProtocolArrayFieldFormatter (std::ostream& os, const char * name, const std::array<Value, N>& data) {
311
- defaultProtocolVectorFieldFormatter (os, name, data);
312
- }
305
+ template <typename Value>
306
+ using ProtocolFieldFormatter = decltype (&defaultProtocolFieldFormatter<Value>);
313
307
314
308
/* *
315
309
* \class ProtocolField
@@ -396,7 +390,7 @@ namespace stf {
396
390
template <size_t Size ,
397
391
typename FieldType,
398
392
typename DataType,
399
- ProtocolFieldFormatter<std::array<DataType, Size >> Formatter = defaultProtocolArrayFieldFormatter >
393
+ ProtocolFieldFormatter<std::array<DataType, Size >> Formatter = defaultProtocolFieldFormatter<std::array<DataType, Size >> >
400
394
using ProtocolArrayField = ProtocolField<FieldType, std::array<DataType, Size >, Formatter>;
401
395
402
396
/* *
@@ -408,7 +402,7 @@ namespace stf {
408
402
typename DataType,
409
403
typename SizeType,
410
404
typename VectorType = SerializableVector<DataType, SizeType>,
411
- ProtocolFieldFormatter<VectorType> Formatter = defaultProtocolVectorFieldFormatter >
405
+ ProtocolFieldFormatter<VectorType> Formatter = defaultProtocolFieldFormatter<VectorType> >
412
406
class ProtocolVectorField : public ProtocolField <FieldType,
413
407
VectorType,
414
408
Formatter>
@@ -465,7 +459,7 @@ namespace stf {
465
459
template <typename FieldType,
466
460
typename DataType,
467
461
typename SizeType,
468
- ProtocolFieldFormatter<SerializablePackedBitVector<DataType, SizeType>> Formatter = defaultProtocolVectorFieldFormatter >
462
+ ProtocolFieldFormatter<SerializablePackedBitVector<DataType, SizeType>> Formatter = defaultProtocolFieldFormatter<SerializablePackedBitVector<DataType, SizeType>> >
469
463
using ProtocolPackedBitVectorField = ProtocolVectorField<FieldType, DataType, SizeType, SerializablePackedBitVector<DataType, SizeType>, Formatter>;
470
464
}
471
465
0 commit comments