19#include "comms/details/tag.h"
21COMMS_MSVC_WARNING_PUSH
22COMMS_MSVC_WARNING_DISABLE(4100)
23COMMS_MSVC_WARNING_DISABLE(4127)
34template <
typename TField>
35using ScalingRatioOf =
typename TField::ScalingRatio;
37template <
typename TField,
typename TConvRatio>
38using FullUnitsRatioOf =
39 typename std::ratio_divide<
40 typename std::ratio_multiply<
41 ScalingRatioOf<TField>,
42 typename TField::UnitsRatio
48struct UnitsValueConverter
50 template <
typename TRet,
typename TConvRatio,
typename TField>
51 static TRet getValue(
const TField& field)
53 using Ratio = FullUnitsRatioOf<TField, TConvRatio>;
54 using Tag = RatioTag<TField, TConvRatio>;
55 return getValueInternal<TRet, Ratio>(field, Tag());
58 template <
typename TConvRatio,
typename TField,
typename TVal>
59 static void setValue(TField& field, TVal&& value)
61 using Ratio = FullUnitsRatioOf<TField, TConvRatio>;
62 using Tag = RatioTag<TField, TConvRatio>;
63 return setValueInternal<Ratio>(field, std::forward<TVal>(value), Tag());
67 template <
typename...>
68 using HasConversionTag = comms::details::tag::Tag1<>;
70 template <
typename...>
71 using NoConversionTag = comms::details::tag::Tag2<>;
73 template <
typename...>
74 using ConvertToFpTag = comms::details::tag::Tag3<>;
76 template <
typename...>
77 using ConvertToIntTag = comms::details::tag::Tag4<>;
79 template <
typename TField,
typename TConvRatio>
81 typename comms::util::LazyShallowConditional<
82 std::is_same<FullUnitsRatioOf<TField, TConvRatio>, std::ratio<1, 1> >::value
88 template <
typename TRet>
90 typename comms::util::LazyShallowConditional<
91 std::is_floating_point<TRet>::value
97 template <
typename TRet,
typename TRatio,
typename TField,
typename... TParams>
98 static TRet getValueInternal(
const TField& field, NoConversionTag<TParams...>)
100 return static_cast<TRet
>(field.value());
103 template <
typename TRet,
typename TRatio,
typename TField,
typename... TParams>
104 static TRet getValueInternal(
const TField& field, HasConversionTag<TParams...>)
106 using Tag = TypeTag<TRet>;
107 return getValueInternal<TRet, TRatio>(field, Tag());
110 template <
typename TRet,
typename TRatio,
typename TField,
typename... TParams>
111 static TRet getValueInternal(
const TField& field, ConvertToFpTag<TParams...>)
113 static_assert(std::is_floating_point<TRet>::value,
114 "TRet is expected to be floating point type");
115 return static_cast<TRet
>(field.value()) * (
static_cast<TRet
>(TRatio::num) /
static_cast<TRet
>(TRatio::den));
118 template <
typename TRet,
typename TRatio,
typename TField,
typename... TParams>
119 static TRet getValueInternal(
const TField& field, ConvertToIntTag<TParams...>)
121 static_assert(std::is_integral<TRet>::value,
122 "TRet is expected to be integral type");
124 using FieldType =
typename std::decay<
decltype(field)>::type;
125 using ValueType =
typename FieldType::ValueType;
128 std::is_integral<ValueType>::value ||
129 std::is_floating_point<ValueType>::value ||
130 std::is_enum<ValueType>::value,
131 "Unexpected field in units conversion");
135 std::is_floating_point<ValueType>::value
138 std::is_same<ValueType, float>::value
144 std::is_signed<TRet>::value
153 (
static_cast<CastType
>(field.value()) * TRatio::num) / TRatio::den);
156 template <
typename TRatio,
typename TField,
typename TVal,
typename... TParams>
157 static void setValueInternal(TField& field, TVal&& value, NoConversionTag<TParams...>)
159 using FieldType =
typename std::decay<
decltype(field)>::type;
160 using ValueType =
typename FieldType::ValueType;
161 field.value() =
static_cast<ValueType
>(value);
164 template <
typename TRatio,
typename TField,
typename TVal,
typename... TParams>
165 static void setValueInternal(TField& field, TVal&& value, HasConversionTag<TParams...>)
167 using Tag = TypeTag<
typename std::decay<
decltype(value)>::type>;
168 setValueInternal<TRatio>(field, std::forward<TVal>(value), Tag());
171 template <
typename TRatio,
typename TField,
typename TVal,
typename... TParams>
172 static void setValueInternal(TField& field, TVal&& value, ConvertToIntTag<TParams...>)
174 using FieldType =
typename std::decay<
decltype(field)>::type;
175 using ValueType =
typename FieldType::ValueType;
178 std::is_integral<ValueType>::value ||
179 std::is_floating_point<ValueType>::value ||
180 std::is_enum<ValueType>::value,
181 "Unexpected field in units conversion");
185 std::is_floating_point<ValueType>::value
188 std::is_same<ValueType, float>::value
194 std::is_signed<
typename std::decay<
decltype(value)>::type>::value
202 static_cast<ValueType
>(
203 (
static_cast<CastType
>(value) * TRatio::den) /
static_cast<CastType
>(TRatio::num));
206 template <
typename TRatio,
typename TField,
typename TVal,
typename... TParams>
207 static void setValueInternal(TField& field, TVal&& value, ConvertToFpTag<TParams...>)
209 using DecayedType =
typename std::decay<
decltype(value)>::type;
210 using FieldType =
typename std::decay<
decltype(field)>::type;
211 using ValueType =
typename FieldType::ValueType;
213 auto epsilon = DecayedType(0);
214 if ((TRatio::num < TRatio::den) && std::is_integral<ValueType>::value) {
215 epsilon =
static_cast<DecayedType
>(TRatio::num) /
static_cast<DecayedType
>(TRatio::den + 1);
218 if (epsilon < DecayedType(0)) {
222 if (value < DecayedType(0)) {
227 static_cast<ValueType
>(
228 ((value + epsilon) *
static_cast<DecayedType
>(TRatio::den)) /
static_cast<DecayedType
>(TRatio::num));
233template <
typename TField,
typename TType>
234constexpr bool hasExpectedUnits()
236 return std::is_same<typename TField::UnitsType, TType>::value;
239template <
typename TRet,
typename TConvRatio,
typename TField>
240TRet getTime(
const TField& field)
243 "The field is expected to contain \"time\" units.");
244 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
247template <
typename TConvRatio,
typename TField,
typename TVal>
248void setTime(TField& field, TVal&& val)
251 "The field is expected to contain \"time\" units.");
252 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
255template <
typename TRet,
typename TConvRatio,
typename TField>
256TRet getDistance(
const TField& field)
259 "The field is expected to contain \"distance\" units.");
260 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
263template <
typename TConvRatio,
typename TField,
typename TVal>
264void setDistance(TField& field, TVal&& val)
267 "The field is expected to contain \"distance\" units.");
268 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
271template <
typename TRet,
typename TConvRatio,
typename TField>
272TRet getSpeed(
const TField& field)
275 "The field is expected to contain \"speed\" units.");
276 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
279template <
typename TConvRatio,
typename TField,
typename TVal>
280void setSpeed(TField& field, TVal&& val)
283 "The field is expected to contain \"speed\" units.");
284 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
287template <
typename TRet,
typename TConvRatio,
typename TField>
288TRet getFrequency(
const TField& field)
291 "The field is expected to contain \"frequency\" units.");
292 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
295template <
typename TConvRatio,
typename TField,
typename TVal>
296void setFrequency(TField& field, TVal&& val)
299 "The field is expected to contain \"frequency\" units.");
300 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
306 static constexpr T Value =
static_cast<T
>(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899L);
309template <
typename...>
310struct AngleValueConverter
312 template <
typename TRet,
typename TConvRatio,
typename TField>
313 static TRet getValue(
const TField& field)
315 using FieldType =
typename std::decay<
decltype(field)>::type;
316 static_assert(details::hasExpectedUnits<FieldType, comms::traits::units::Angle>(),
317 "The field is expected to contain \"angle\" units.");
319 using Tag = GetTag<FieldType, TConvRatio>;
320 return getValueInternal<TRet, TConvRatio>(field, Tag());
323 template <
typename TConvRatio,
typename TField,
typename TVal>
324 static void setValue(TField& field, TVal&& val)
326 using FieldType =
typename std::decay<
decltype(field)>::type;
327 static_assert(details::hasExpectedUnits<FieldType, comms::traits::units::Angle>(),
328 "The field is expected to contain \"angle\" units.");
330 using Tag = SetTag<FieldType, TConvRatio>;
331 setValueInternal<TConvRatio>(field, std::forward<TVal>(val), Tag());
335 template <
typename... TParams>
336 using SameUnitsTag = comms::details::tag::Tag1<>;
338 template <
typename... TParams>
339 using DegreesToRadiansTag = comms::details::tag::Tag2<>;
341 template <
typename... TParams>
342 using RadiansToDegreesTag = comms::details::tag::Tag3<>;
344 template <
typename TConvRatio>
346 typename comms::util::LazyShallowConditional<
347 std::is_same<TConvRatio, typename comms::traits::units::RadiansRatio>::value
353 template <
typename TConvRatio>
355 typename comms::util::LazyShallowConditional<
356 std::is_same<TConvRatio, typename comms::traits::units::RadiansRatio>::value
362 template <
typename TField,
typename TConvRatio>
364 typename comms::util::LazyShallowConditional<
365 std::is_same<TConvRatio, typename TField::UnitsRatio>::value
372 template <
typename TField,
typename TConvRatio>
374 typename comms::util::LazyShallowConditional<
375 std::is_same<TConvRatio, typename TField::UnitsRatio>::value
382 template <
typename TRet,
typename TConvRatio,
typename TField,
typename... TParams>
383 static TRet getValueInternal(
const TField& field, SameUnitsTag<TParams...>)
385 return field.template getScaled<TRet>();
388 template <
typename TRet,
typename TConvRatio,
typename TField,
typename... TParams>
389 static TRet getValueInternal(
const TField& field, DegreesToRadiansTag<TParams...>)
391 using FieldType =
typename std::decay<
decltype(field)>::type;
392 static_assert(std::is_same<typename FieldType::UnitsRatio, comms::traits::units::DegreesRatio>::value,
393 "The field is expected to contain degrees.");
395 return PI<TRet>::Value * UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
398 template <
typename TRet,
typename TConvRatio,
typename TField,
typename... TParams>
399 static TRet getValueInternal(
const TField& field, RadiansToDegreesTag<TParams...>)
401 using FieldType =
typename std::decay<
decltype(field)>::type;
402 static_assert(std::is_same<typename FieldType::UnitsRatio, comms::traits::units::RadiansRatio>::value,
403 "The field is expected to contain radians.");
405 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field) / PI<TRet>::Value;
408 template <
typename TConvRatio,
typename TField,
typename TVal,
typename... TParams>
409 static void setValueInternal(TField& field, TVal&& val, SameUnitsTag<TParams...>)
411 field.setScaled(std::forward<TVal>(val));
414 template <
typename TConvRatio,
typename TField,
typename TVal,
typename... TParams>
415 static void setValueInternal(TField& field, TVal&& val, DegreesToRadiansTag<TParams...>)
417 using FieldType =
typename std::decay<
decltype(field)>::type;
418 static_assert(std::is_same<typename FieldType::UnitsRatio, comms::traits::units::RadiansRatio>::value,
419 "The field is expected to contain radians.");
421 using ValueType =
typename std::decay<
decltype(val)>::type;
424 std::is_floating_point<ValueType>::value
430 UnitsValueConverter<>::setValue<TConvRatio>(field, val * PI<PiType>::Value);
433 template <
typename TConvRatio,
typename TField,
typename TVal,
typename... TParams>
434 static void setValueInternal(TField& field, TVal&& val, RadiansToDegreesTag<TParams...>)
436 using FieldType =
typename std::decay<
decltype(field)>::type;
437 static_assert(std::is_same<typename FieldType::UnitsRatio, comms::traits::units::DegreesRatio>::value,
438 "The field is expected to contain degrees.");
440 using ValueType =
typename std::decay<
decltype(val)>::type;
443 std::is_floating_point<ValueType>::value
449 UnitsValueConverter<>::setValue<TConvRatio>(field,
static_cast<PiType
>(val) / PI<PiType>::Value);
453template <
typename TRet,
typename TConvRatio,
typename TField>
454TRet getAngle(
const TField& field)
456 return AngleValueConverter<>::getValue<TRet, TConvRatio>(field);
459template <
typename TConvRatio,
typename TField,
typename TVal>
460void setAngle(TField& field, TVal&& val)
462 AngleValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
465template <
typename TRet,
typename TConvRatio,
typename TField>
466TRet getCurrent(
const TField& field)
469 "The field is expected to contain \"current\" units.");
470 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
473template <
typename TConvRatio,
typename TField,
typename TVal>
474void setCurrent(TField& field, TVal&& val)
477 "The field is expected to contain \"current\" units.");
478 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
481template <
typename TRet,
typename TConvRatio,
typename TField>
482TRet getVoltage(
const TField& field)
485 "The field is expected to contain \"voltage\" units.");
486 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
489template <
typename TConvRatio,
typename TField,
typename TVal>
490void setVoltage(TField& field, TVal&& val)
493 "The field is expected to contain \"voltage\" units.");
494 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
497template <
typename TRet,
typename TConvRatio,
typename TField>
498TRet getMemory(
const TField& field)
501 "The field is expected to contain \"memory\" units.");
502 return UnitsValueConverter<>::getValue<TRet, TConvRatio>(field);
505template <
typename TConvRatio,
typename TField,
typename TVal>
506void setMemory(TField& field, TVal&& val)
509 "The field is expected to contain \"memory\" units.");
510 UnitsValueConverter<>::setValue<TConvRatio>(field, std::forward<TVal>(val));
525template <
typename TRet,
typename TField>
528 return details::getTime<TRet, comms::traits::units::NanosecondsRatio>(field);
541template <
typename TField,
typename TVal>
544 details::setTime<comms::traits::units::NanosecondsRatio>(field, std::forward<TVal>(val));
549template <
typename TField>
553 TField::hasUnits() &&
554 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
555 std::is_same<typename TField::UnitsRatio, comms::traits::units::NanosecondsRatio>::value;
562template <
typename TField>
565 return isNanoseconds<
typename std::decay<
decltype(field)>::type>();
578template <
typename TRet,
typename TField>
581 return details::getTime<TRet, comms::traits::units::MicrosecondsRatio>(field);
594template <
typename TField,
typename TVal>
597 details::setTime<comms::traits::units::MicrosecondsRatio>(field, std::forward<TVal>(val));
602template <
typename TField>
606 TField::hasUnits() &&
607 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
608 std::is_same<typename TField::UnitsRatio, comms::traits::units::MicrosecondsRatio>::value;
615template <
typename TField>
618 return isMicroseconds<
typename std::decay<
decltype(field)>::type>();
631template <
typename TRet,
typename TField>
634 return details::getTime<TRet, comms::traits::units::MillisecondsRatio>(field);
647template <
typename TField,
typename TVal>
650 details::setTime<comms::traits::units::MillisecondsRatio>(field, std::forward<TVal>(val));
655template <
typename TField>
659 TField::hasUnits() &&
660 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
661 std::is_same<typename TField::UnitsRatio, comms::traits::units::MillisecondsRatio>::value;
668template <
typename TField>
671 return isMilliseconds<
typename std::decay<
decltype(field)>::type>();
684template <
typename TRet,
typename TField>
687 return details::getTime<TRet, comms::traits::units::SecondsRatio>(field);
700template <
typename TField,
typename TVal>
703 details::setTime<comms::traits::units::SecondsRatio>(field, std::forward<TVal>(val));
708template <
typename TField>
712 TField::hasUnits() &&
713 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
714 std::is_same<typename TField::UnitsRatio, comms::traits::units::SecondsRatio>::value;
721template <
typename TField>
724 return isSeconds<
typename std::decay<
decltype(field)>::type>();
737template <
typename TRet,
typename TField>
740 return details::getTime<TRet, comms::traits::units::MinutesRatio>(field);
753template <
typename TField,
typename TVal>
756 details::setTime<comms::traits::units::MinutesRatio>(field, std::forward<TVal>(val));
761template <
typename TField>
765 TField::hasUnits() &&
766 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
767 std::is_same<typename TField::UnitsRatio, comms::traits::units::MinutesRatio>::value;
774template <
typename TField>
777 return isMinutes<
typename std::decay<
decltype(field)>::type>();
790template <
typename TRet,
typename TField>
793 return details::getTime<TRet, comms::traits::units::HoursRatio>(field);
806template <
typename TField,
typename TVal>
809 details::setTime<comms::traits::units::HoursRatio>(field, std::forward<TVal>(val));
814template <
typename TField>
818 TField::hasUnits() &&
819 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
820 std::is_same<typename TField::UnitsRatio, comms::traits::units::HoursRatio>::value;
827template <
typename TField>
830 return isHours<
typename std::decay<
decltype(field)>::type>();
843template <
typename TRet,
typename TField>
846 return details::getTime<TRet, comms::traits::units::DaysRatio>(field);
859template <
typename TField,
typename TVal>
862 details::setTime<comms::traits::units::DaysRatio>(field, std::forward<TVal>(val));
867template <
typename TField>
871 TField::hasUnits() &&
872 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
873 std::is_same<typename TField::UnitsRatio, comms::traits::units::DaysRatio>::value;
880template <
typename TField>
881constexpr bool isDays(
const TField& field)
883 return isDays<
typename std::decay<
decltype(field)>::type>();
896template <
typename TRet,
typename TField>
899 return details::getTime<TRet, comms::traits::units::WeeksRatio>(field);
912template <
typename TField,
typename TVal>
915 details::setTime<comms::traits::units::WeeksRatio>(field, std::forward<TVal>(val));
920template <
typename TField>
924 TField::hasUnits() &&
925 std::is_same<typename TField::UnitsType, comms::traits::units::Time>::value &&
926 std::is_same<typename TField::UnitsRatio, comms::traits::units::WeeksRatio>::value;
933template <
typename TField>
936 return isWeeks<
typename std::decay<
decltype(field)>::type>();
949template <
typename TRet,
typename TField>
952 return details::getDistance<TRet, comms::traits::units::NanometersRatio>(field);
965template <
typename TField,
typename TVal>
968 details::setDistance<comms::traits::units::NanometersRatio>(field, std::forward<TVal>(val));
973template <
typename TField>
977 TField::hasUnits() &&
978 std::is_same<typename TField::UnitsType, comms::traits::units::Distance>::value &&
979 std::is_same<typename TField::UnitsRatio, comms::traits::units::NanometersRatio>::value;
986template <
typename TField>
989 return isNanometers<
typename std::decay<
decltype(field)>::type>();
1002template <
typename TRet,
typename TField>
1005 return details::getDistance<TRet, comms::traits::units::MicrometersRatio>(field);
1018template <
typename TField,
typename TVal>
1021 details::setDistance<comms::traits::units::MicrometersRatio>(field, std::forward<TVal>(val));
1026template <
typename TField>
1030 TField::hasUnits() &&
1031 std::is_same<typename TField::UnitsType, comms::traits::units::Distance>::value &&
1032 std::is_same<typename TField::UnitsRatio, comms::traits::units::MicrometersRatio>::value;
1039template <
typename TField>
1042 return isMicrometers<
typename std::decay<
decltype(field)>::type>();
1055template <
typename TRet,
typename TField>
1058 return details::getDistance<TRet, comms::traits::units::MillimetersRatio>(field);
1071template <
typename TField,
typename TVal>
1074 details::setDistance<comms::traits::units::MillimetersRatio>(field, std::forward<TVal>(val));
1079template <
typename TField>
1083 TField::hasUnits() &&
1084 std::is_same<typename TField::UnitsType, comms::traits::units::Distance>::value &&
1085 std::is_same<typename TField::UnitsRatio, comms::traits::units::MillimetersRatio>::value;
1092template <
typename TField>
1095 return isMillimeters<
typename std::decay<
decltype(field)>::type>();
1108template <
typename TRet,
typename TField>
1111 return details::getDistance<TRet, comms::traits::units::CentimetersRatio>(field);
1124template <
typename TField,
typename TVal>
1127 details::setDistance<comms::traits::units::CentimetersRatio>(field, std::forward<TVal>(val));
1132template <
typename TField>
1136 TField::hasUnits() &&
1137 std::is_same<typename TField::UnitsType, comms::traits::units::Distance>::value &&
1138 std::is_same<typename TField::UnitsRatio, comms::traits::units::CentimetersRatio>::value;
1145template <
typename TField>
1148 return isCentimeters<
typename std::decay<
decltype(field)>::type>();
1161template <
typename TRet,
typename TField>
1164 return details::getDistance<TRet, comms::traits::units::MetersRatio>(field);
1177template <
typename TField,
typename TVal>
1180 details::setDistance<comms::traits::units::MetersRatio>(field, std::forward<TVal>(val));
1185template <
typename TField>
1189 TField::hasUnits() &&
1190 std::is_same<typename TField::UnitsType, comms::traits::units::Distance>::value &&
1191 std::is_same<typename TField::UnitsRatio, comms::traits::units::MetersRatio>::value;
1198template <
typename TField>
1201 return isMeters<
typename std::decay<
decltype(field)>::type>();
1214template <
typename TRet,
typename TField>
1217 return details::getDistance<TRet, comms::traits::units::KilometersRatio>(field);
1230template <
typename TField,
typename TVal>
1233 details::setDistance<comms::traits::units::KilometersRatio>(field, std::forward<TVal>(val));
1238template <
typename TField>
1242 TField::hasUnits() &&
1243 std::is_same<typename TField::UnitsType, comms::traits::units::Distance>::value &&
1244 std::is_same<typename TField::UnitsRatio, comms::traits::units::KilometersRatio>::value;
1251template <
typename TField>
1254 return isKilometers<
typename std::decay<
decltype(field)>::type>();
1267template <
typename TRet,
typename TField>
1270 return details::getSpeed<TRet, comms::traits::units::NanometersPerSecondRatio>(field);
1283template <
typename TField,
typename TVal>
1286 details::setSpeed<comms::traits::units::NanometersPerSecondRatio>(field, std::forward<TVal>(val));
1291template <
typename TField>
1295 TField::hasUnits() &&
1296 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1297 std::is_same<typename TField::UnitsRatio, comms::traits::units::NanometersPerSecondRatio>::value;
1304template <
typename TField>
1320template <
typename TRet,
typename TField>
1323 return details::getSpeed<TRet, comms::traits::units::MicrometersPerSecondRatio>(field);
1336template <
typename TField,
typename TVal>
1339 details::setSpeed<comms::traits::units::MicrometersPerSecondRatio>(field, std::forward<TVal>(val));
1344template <
typename TField>
1348 TField::hasUnits() &&
1349 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1350 std::is_same<typename TField::UnitsRatio, comms::traits::units::MicrometersPerSecondRatio>::value;
1357template <
typename TField>
1373template <
typename TRet,
typename TField>
1376 return details::getSpeed<TRet, comms::traits::units::MillimetersPerSecondRatio>(field);
1389template <
typename TField,
typename TVal>
1392 details::setSpeed<comms::traits::units::MillimetersPerSecondRatio>(field, std::forward<TVal>(val));
1397template <
typename TField>
1401 TField::hasUnits() &&
1402 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1403 std::is_same<typename TField::UnitsRatio, comms::traits::units::MillimetersPerSecondRatio>::value;
1410template <
typename TField>
1426template <
typename TRet,
typename TField>
1429 return details::getSpeed<TRet, comms::traits::units::CentimetersPerSecondRatio>(field);
1442template <
typename TField,
typename TVal>
1445 details::setSpeed<comms::traits::units::CentimetersPerSecondRatio>(field, std::forward<TVal>(val));
1450template <
typename TField>
1454 TField::hasUnits() &&
1455 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1456 std::is_same<typename TField::UnitsRatio, comms::traits::units::CentimetersPerSecondRatio>::value;
1463template <
typename TField>
1479template <
typename TRet,
typename TField>
1482 return details::getSpeed<TRet, comms::traits::units::MetersPerSecondRatio>(field);
1495template <
typename TField,
typename TVal>
1498 details::setSpeed<comms::traits::units::MetersPerSecondRatio>(field, std::forward<TVal>(val));
1503template <
typename TField>
1507 TField::hasUnits() &&
1508 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1509 std::is_same<typename TField::UnitsRatio, comms::traits::units::MetersPerSecondRatio>::value;
1516template <
typename TField>
1532template <
typename TRet,
typename TField>
1535 return details::getSpeed<TRet, comms::traits::units::KilometersPerSecondRatio>(field);
1548template <
typename TField,
typename TVal>
1551 details::setSpeed<comms::traits::units::KilometersPerSecondRatio>(field, std::forward<TVal>(val));
1556template <
typename TField>
1560 TField::hasUnits() &&
1561 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1562 std::is_same<typename TField::UnitsRatio, comms::traits::units::KilometersPerSecondRatio>::value;
1569template <
typename TField>
1585template <
typename TRet,
typename TField>
1588 return details::getSpeed<TRet, comms::traits::units::KilometersPerHourRatio>(field);
1601template <
typename TField,
typename TVal>
1604 details::setSpeed<comms::traits::units::KilometersPerHourRatio>(field, std::forward<TVal>(val));
1609template <
typename TField>
1613 TField::hasUnits() &&
1614 std::is_same<typename TField::UnitsType, comms::traits::units::Speed>::value &&
1615 std::is_same<typename TField::UnitsRatio, comms::traits::units::KilometersPerHourRatio>::value;
1622template <
typename TField>
1638template <
typename TRet,
typename TField>
1641 return details::getFrequency<TRet, comms::traits::units::HzRatio>(field);
1654template <
typename TField,
typename TVal>
1657 details::setFrequency<comms::traits::units::HzRatio>(field, std::forward<TVal>(val));
1662template <
typename TField>
1666 TField::hasUnits() &&
1667 std::is_same<typename TField::UnitsType, comms::traits::units::Frequency>::value &&
1668 std::is_same<typename TField::UnitsRatio, comms::traits::units::HzRatio>::value;
1675template <
typename TField>
1678 return isHertz<
typename std::decay<
decltype(field)>::type>();
1691template <
typename TRet,
typename TField>
1694 return details::getFrequency<TRet, comms::traits::units::KiloHzRatio>(field);
1707template <
typename TField,
typename TVal>
1710 details::setFrequency<comms::traits::units::KiloHzRatio>(field, std::forward<TVal>(val));
1715template <
typename TField>
1719 TField::hasUnits() &&
1720 std::is_same<typename TField::UnitsType, comms::traits::units::Frequency>::value &&
1721 std::is_same<typename TField::UnitsRatio, comms::traits::units::KiloHzRatio>::value;
1728template <
typename TField>
1731 return isKilohertz<
typename std::decay<
decltype(field)>::type>();
1744template <
typename TRet,
typename TField>
1747 return details::getFrequency<TRet, comms::traits::units::MegaHzRatio>(field);
1760template <
typename TField,
typename TVal>
1763 details::setFrequency<comms::traits::units::MegaHzRatio>(field, std::forward<TVal>(val));
1768template <
typename TField>
1772 TField::hasUnits() &&
1773 std::is_same<typename TField::UnitsType, comms::traits::units::Frequency>::value &&
1774 std::is_same<typename TField::UnitsRatio, comms::traits::units::MegaHzRatio>::value;
1781template <
typename TField>
1784 return isMegahertz<
typename std::decay<
decltype(field)>::type>();
1797template <
typename TRet,
typename TField>
1800 return details::getFrequency<TRet, comms::traits::units::GigaHzRatio>(field);
1813template <
typename TField,
typename TVal>
1816 details::setFrequency<comms::traits::units::GigaHzRatio>(field, std::forward<TVal>(val));
1821template <
typename TField>
1825 TField::hasUnits() &&
1826 std::is_same<typename TField::UnitsType, comms::traits::units::Frequency>::value &&
1827 std::is_same<typename TField::UnitsRatio, comms::traits::units::GigaHzRatio>::value;
1834template <
typename TField>
1837 return isGigahertz<
typename std::decay<
decltype(field)>::type>();
1850template <
typename TRet,
typename TField>
1853 return details::getAngle<TRet, comms::traits::units::DegreesRatio>(field);
1866template <
typename TField,
typename TVal>
1869 details::setAngle<comms::traits::units::DegreesRatio>(field, std::forward<TVal>(val));
1874template <
typename TField>
1878 TField::hasUnits() &&
1879 std::is_same<typename TField::UnitsType, comms::traits::units::Angle>::value &&
1880 std::is_same<typename TField::UnitsRatio, comms::traits::units::DegreesRatio>::value;
1887template <
typename TField>
1890 return isDegrees<
typename std::decay<
decltype(field)>::type>();
1903template <
typename TRet,
typename TField>
1906 return details::getAngle<TRet, comms::traits::units::RadiansRatio>(field);
1919template <
typename TField,
typename TVal>
1922 details::setAngle<comms::traits::units::RadiansRatio>(field, std::forward<TVal>(val));
1927template <
typename TField>
1931 TField::hasUnits() &&
1932 std::is_same<typename TField::UnitsType, comms::traits::units::Angle>::value &&
1933 std::is_same<typename TField::UnitsRatio, comms::traits::units::RadiansRatio>::value;
1940template <
typename TField>
1943 return isRadians<
typename std::decay<
decltype(field)>::type>();
1956template <
typename TRet,
typename TField>
1959 return details::getCurrent<TRet, comms::traits::units::NanoampsRatio>(field);
1972template <
typename TField,
typename TVal>
1975 details::setCurrent<comms::traits::units::NanoampsRatio>(field, std::forward<TVal>(val));
1980template <
typename TField>
1984 TField::hasUnits() &&
1985 std::is_same<typename TField::UnitsType, comms::traits::units::Current>::value &&
1986 std::is_same<typename TField::UnitsRatio, comms::traits::units::NanoampsRatio>::value;
1993template <
typename TField>
1996 return isNanoamps<
typename std::decay<
decltype(field)>::type>();
2009template <
typename TRet,
typename TField>
2012 return details::getCurrent<TRet, comms::traits::units::MicroampsRatio>(field);
2025template <
typename TField,
typename TVal>
2028 details::setCurrent<comms::traits::units::MicroampsRatio>(field, std::forward<TVal>(val));
2033template <
typename TField>
2037 TField::hasUnits() &&
2038 std::is_same<typename TField::UnitsType, comms::traits::units::Current>::value &&
2039 std::is_same<typename TField::UnitsRatio, comms::traits::units::MicroampsRatio>::value;
2046template <
typename TField>
2049 return isMicroamps<
typename std::decay<
decltype(field)>::type>();
2063template <
typename TRet,
typename TField>
2066 return details::getCurrent<TRet, comms::traits::units::MilliampsRatio>(field);
2079template <
typename TField,
typename TVal>
2082 details::setCurrent<comms::traits::units::MilliampsRatio>(field, std::forward<TVal>(val));
2087template <
typename TField>
2091 TField::hasUnits() &&
2092 std::is_same<typename TField::UnitsType, comms::traits::units::Current>::value &&
2093 std::is_same<typename TField::UnitsRatio, comms::traits::units::MilliampsRatio>::value;
2100template <
typename TField>
2103 return isMilliamps<
typename std::decay<
decltype(field)>::type>();
2116template <
typename TRet,
typename TField>
2119 return details::getCurrent<TRet, comms::traits::units::AmpsRatio>(field);
2132template <
typename TField,
typename TVal>
2135 details::setCurrent<comms::traits::units::AmpsRatio>(field, std::forward<TVal>(val));
2140template <
typename TField>
2144 TField::hasUnits() &&
2145 std::is_same<typename TField::UnitsType, comms::traits::units::Current>::value &&
2146 std::is_same<typename TField::UnitsRatio, comms::traits::units::AmpsRatio>::value;
2153template <
typename TField>
2156 return isAmps<
typename std::decay<
decltype(field)>::type>();
2169template <
typename TRet,
typename TField>
2172 return details::getCurrent<TRet, comms::traits::units::KiloampsRatio>(field);
2185template <
typename TField,
typename TVal>
2188 details::setCurrent<comms::traits::units::KiloampsRatio>(field, std::forward<TVal>(val));
2193template <
typename TField>
2197 TField::hasUnits() &&
2198 std::is_same<typename TField::UnitsType, comms::traits::units::Current>::value &&
2199 std::is_same<typename TField::UnitsRatio, comms::traits::units::KiloampsRatio>::value;
2206template <
typename TField>
2209 return isKiloamps<
typename std::decay<
decltype(field)>::type>();
2222template <
typename TRet,
typename TField>
2225 return details::getVoltage<TRet, comms::traits::units::NanovoltsRatio>(field);
2238template <
typename TField,
typename TVal>
2241 details::setVoltage<comms::traits::units::NanovoltsRatio>(field, std::forward<TVal>(val));
2246template <
typename TField>
2250 TField::hasUnits() &&
2251 std::is_same<typename TField::UnitsType, comms::traits::units::Voltage>::value &&
2252 std::is_same<typename TField::UnitsRatio, comms::traits::units::NanovoltsRatio>::value;
2259template <
typename TField>
2262 return isNanovolts<
typename std::decay<
decltype(field)>::type>();
2275template <
typename TRet,
typename TField>
2278 return details::getVoltage<TRet, comms::traits::units::MicrovoltsRatio>(field);
2291template <
typename TField,
typename TVal>
2294 details::setVoltage<comms::traits::units::MicrovoltsRatio>(field, std::forward<TVal>(val));
2299template <
typename TField>
2303 TField::hasUnits() &&
2304 std::is_same<typename TField::UnitsType, comms::traits::units::Voltage>::value &&
2305 std::is_same<typename TField::UnitsRatio, comms::traits::units::MicrovoltsRatio>::value;
2312template <
typename TField>
2315 return isMicrovolts<
typename std::decay<
decltype(field)>::type>();
2328template <
typename TRet,
typename TField>
2331 return details::getVoltage<TRet, comms::traits::units::MillivoltsRatio>(field);
2344template <
typename TField,
typename TVal>
2347 details::setVoltage<comms::traits::units::MillivoltsRatio>(field, std::forward<TVal>(val));
2352template <
typename TField>
2356 TField::hasUnits() &&
2357 std::is_same<typename TField::UnitsType, comms::traits::units::Voltage>::value &&
2358 std::is_same<typename TField::UnitsRatio, comms::traits::units::MillivoltsRatio>::value;
2365template <
typename TField>
2368 return isMillivolts<
typename std::decay<
decltype(field)>::type>();
2381template <
typename TRet,
typename TField>
2384 return details::getVoltage<TRet, comms::traits::units::VoltsRatio>(field);
2397template <
typename TField,
typename TVal>
2400 details::setVoltage<comms::traits::units::VoltsRatio>(field, std::forward<TVal>(val));
2405template <
typename TField>
2409 TField::hasUnits() &&
2410 std::is_same<typename TField::UnitsType, comms::traits::units::Voltage>::value &&
2411 std::is_same<typename TField::UnitsRatio, comms::traits::units::VoltsRatio>::value;
2418template <
typename TField>
2421 return isVolts<
typename std::decay<
decltype(field)>::type>();
2434template <
typename TRet,
typename TField>
2437 return details::getVoltage<TRet, comms::traits::units::KilovoltsRatio>(field);
2450template <
typename TField,
typename TVal>
2453 details::setVoltage<comms::traits::units::KilovoltsRatio>(field, std::forward<TVal>(val));
2458template <
typename TField>
2462 TField::hasUnits() &&
2463 std::is_same<typename TField::UnitsType, comms::traits::units::Voltage>::value &&
2464 std::is_same<typename TField::UnitsRatio, comms::traits::units::KilovoltsRatio>::value;
2471template <
typename TField>
2474 return isKilovolts<
typename std::decay<
decltype(field)>::type>();
2487template <
typename TRet,
typename TField>
2490 return details::getMemory<TRet, comms::traits::units::BytesRatio>(field);
2503template <
typename TField,
typename TVal>
2506 details::setMemory<comms::traits::units::BytesRatio>(field, std::forward<TVal>(val));
2511template <
typename TField>
2515 TField::hasUnits() &&
2516 std::is_same<typename TField::UnitsType, comms::traits::units::Memory>::value &&
2517 std::is_same<typename TField::UnitsRatio, comms::traits::units::BytesRatio>::value;
2524template <
typename TField>
2527 return isBytes<
typename std::decay<
decltype(field)>::type>();
2540template <
typename TRet,
typename TField>
2543 return details::getMemory<TRet, comms::traits::units::KilobytesRatio>(field);
2556template <
typename TField,
typename TVal>
2559 details::setMemory<comms::traits::units::KilobytesRatio>(field, std::forward<TVal>(val));
2564template <
typename TField>
2568 TField::hasUnits() &&
2569 std::is_same<typename TField::UnitsType, comms::traits::units::Memory>::value &&
2570 std::is_same<typename TField::UnitsRatio, comms::traits::units::KilobytesRatio>::value;
2577template <
typename TField>
2580 return isKilobytes<
typename std::decay<
decltype(field)>::type>();
2593template <
typename TRet,
typename TField>
2596 return details::getMemory<TRet, comms::traits::units::MegabytesRatio>(field);
2609template <
typename TField,
typename TVal>
2612 details::setMemory<comms::traits::units::MegabytesRatio>(field, std::forward<TVal>(val));
2617template <
typename TField>
2621 TField::hasUnits() &&
2622 std::is_same<typename TField::UnitsType, comms::traits::units::Memory>::value &&
2623 std::is_same<typename TField::UnitsRatio, comms::traits::units::MegabytesRatio>::value;
2630template <
typename TField>
2633 return isMegabytes<
typename std::decay<
decltype(field)>::type>();
2647template <
typename TRet,
typename TField>
2650 return details::getMemory<TRet, comms::traits::units::GigabytesRatio>(field);
2663template <
typename TField,
typename TVal>
2666 details::setMemory<comms::traits::units::GigabytesRatio>(field, std::forward<TVal>(val));
2671template <
typename TField>
2675 TField::hasUnits() &&
2676 std::is_same<typename TField::UnitsType, comms::traits::units::Memory>::value &&
2677 std::is_same<typename TField::UnitsRatio, comms::traits::units::GigabytesRatio>::value;
2684template <
typename TField>
2687 return isGigabytes<
typename std::decay<
decltype(field)>::type>();
2700template <
typename TRet,
typename TField>
2703 return details::getMemory<TRet, comms::traits::units::TerabytesRatio>(field);
2716template <
typename TField,
typename TVal>
2719 details::setMemory<comms::traits::units::TerabytesRatio>(field, std::forward<TVal>(val));
2724template <
typename TField>
2728 TField::hasUnits() &&
2729 std::is_same<typename TField::UnitsType, comms::traits::units::Memory>::value &&
2730 std::is_same<typename TField::UnitsRatio, comms::traits::units::TerabytesRatio>::value;
2737template <
typename TField>
2740 return isTerabytes<
typename std::decay<
decltype(field)>::type>();
2747COMMS_MSVC_WARNING_POP
Contains various compiler related definitions.
comms::option::def::FieldType< TMsg > FieldType
Same as comms::option::def::FieldType.
Definition options.h:1463
constexpr bool isMinutes()
Compile time check whether the field type holds minutes.
Definition units.h:762
TRet getNanovolts(const TField &field)
Retrieve field's value as nanovolts.
Definition units.h:2223
constexpr bool isMillimetersPerSecond()
Compile time check whether the field type holds millimeters per second.
Definition units.h:1398
TRet getMicrovolts(const TField &field)
Retrieve field's value as microvolts.
Definition units.h:2276
void setMicroamps(TField &field, TVal &&val)
Update field's value accordingly, while providing microamps value.
Definition units.h:2026
TRet getMilliseconds(const TField &field)
Retrieve field's value as milliseconds.
Definition units.h:632
constexpr bool isMegahertz()
Compile time check whether the field type holds megahertz.
Definition units.h:1769
void setBytes(TField &field, TVal &&val)
Update field's value accordingly, while providing bytes value.
Definition units.h:2504
void setMillimetersPerSecond(TField &field, TVal &&val)
Update field's value accordingly, while providing millimeters per second value.
Definition units.h:1390
TRet getGigabytes(const TField &field)
Retrieve field's value as gigabytes.
Definition units.h:2648
TRet getVolts(const TField &field)
Retrieve field's value as volts.
Definition units.h:2382
void setHours(TField &field, TVal &&val)
Update field's value accordingly, while providing hours value.
Definition units.h:807
void setMillivolts(TField &field, TVal &&val)
Update field's value accordingly, while providing millivolts value.
Definition units.h:2345
constexpr bool isMegabytes()
Compile time check whether the field type holds megabytes.
Definition units.h:2618
void setNanometersPerSecond(TField &field, TVal &&val)
Update field's value accordingly, while providing nanometers per second value.
Definition units.h:1284
TRet getCentimeters(const TField &field)
Retrieve field's value as centimeters.
Definition units.h:1109
constexpr bool isMeters()
Compile time check whether the field type holds meters.
Definition units.h:1186
constexpr bool isMillimeters()
Compile time check whether the field type holds millimeters.
Definition units.h:1080
TRet getMillivolts(const TField &field)
Retrieve field's value as millivolts.
Definition units.h:2329
TRet getHertz(const TField &field)
Retrieve field's value as hertz.
Definition units.h:1639
void setKilobytes(TField &field, TVal &&val)
Update field's value accordingly, while providing kilobytes value.
Definition units.h:2557
TRet getNanoamps(const TField &field)
Retrieve field's value as nanoamps.
Definition units.h:1957
constexpr bool isKilovolts()
Compile time check whether the field type holds kilovolts.
Definition units.h:2459
constexpr bool isCentimetersPerSecond()
Compile time check whether the field type holds centimeters per second.
Definition units.h:1451
constexpr bool isBytes()
Compile time check whether the field type holds bytes.
Definition units.h:2512
TRet getDays(const TField &field)
Retrieve field's value as days.
Definition units.h:844
constexpr bool isNanometers()
Compile time check whether the field type holds nanometers.
Definition units.h:974
void setWeeks(TField &field, TVal &&val)
Update field's value accordingly, while providing weeks value.
Definition units.h:913
TRet getMinutes(const TField &field)
Retrieve field's value as minutes.
Definition units.h:738
void setGigahertz(TField &field, TVal &&val)
Update field's value accordingly, while providing gigahertz value.
Definition units.h:1814
void setGigabytes(TField &field, TVal &&val)
Update field's value accordingly, while providing gigabytes value.
Definition units.h:2664
void setMicrometersPerSecond(TField &field, TVal &&val)
Update field's value accordingly, while providing micrometers per second value.
Definition units.h:1337
TRet getNanometersPerSecond(const TField &field)
Retrieve field's value as nanometers per second.
Definition units.h:1268
TRet getNanometers(const TField &field)
Retrieve field's value as nanometers.
Definition units.h:950
void setTerabytes(TField &field, TVal &&val)
Update field's value accordingly, while providing terabytes value.
Definition units.h:2717
TRet getMilliamps(const TField &field)
Retrieve field's value as milliamps.
Definition units.h:2064
TRet getMicroseconds(const TField &field)
Retrieve field's value as microseconds.
Definition units.h:579
TRet getMicrometers(const TField &field)
Retrieve field's value as micrometers.
Definition units.h:1003
constexpr bool isMicrometersPerSecond()
Compile time check whether the field type holds micrometers per second.
Definition units.h:1345
constexpr bool isKilometers()
Compile time check whether the field type holds kilometers.
Definition units.h:1239
constexpr bool isKilometersPerHour()
Compile time check whether the field type holds kilometers per hour.
Definition units.h:1610
TRet getMicroamps(const TField &field)
Retrieve field's value as microamps.
Definition units.h:2010
TRet getKiloamps(const TField &field)
Retrieve field's value as kiloamps.
Definition units.h:2170
constexpr bool isTerabytes()
Compile time check whether the field type holds terabytes.
Definition units.h:2725
void setMilliamps(TField &field, TVal &&val)
Update field's value accordingly, while providing milliamps value.
Definition units.h:2080
void setAmps(TField &field, TVal &&val)
Update field's value accordingly, while providing amps value.
Definition units.h:2133
TRet getKilohertz(const TField &field)
Retrieve field's value as kilohertz.
Definition units.h:1692
constexpr bool isMetersPerSecond()
Compile time check whether the field type holds meters per second.
Definition units.h:1504
constexpr bool isMicrometers()
Compile time check whether the field type holds micrometers.
Definition units.h:1027
void setDays(TField &field, TVal &&val)
Update field's value accordingly, while providing days value.
Definition units.h:860
constexpr bool isGigabytes()
Compile time check whether the field type holds gigabytes.
Definition units.h:2672
constexpr bool isVolts()
Compile time check whether the field type holds volts.
Definition units.h:2406
TRet getKilometersPerSecond(const TField &field)
Retrieve field's value as kilometers per second.
Definition units.h:1533
constexpr bool isHours()
Compile time check whether the field type holds hours.
Definition units.h:815
TRet getHours(const TField &field)
Retrieve field's value as hours.
Definition units.h:791
void setMetersPerSecond(TField &field, TVal &&val)
Update field's value accordingly, while providing meters per second value.
Definition units.h:1496
TRet getWeeks(const TField &field)
Retrieve field's value as weeks.
Definition units.h:897
TRet getNanoseconds(const TField &field)
Retrieve field's value as nanoseconds.
Definition units.h:526
constexpr bool isMicroamps()
Compile time check whether the field type holds microamps.
Definition units.h:2034
TRet getMeters(const TField &field)
Retrieve field's value as meters.
Definition units.h:1162
void setCentimeters(TField &field, TVal &&val)
Update field's value accordingly, while providing centimeters value.
Definition units.h:1125
void setKilovolts(TField &field, TVal &&val)
Update field's value accordingly, while providing kilovolts value.
Definition units.h:2451
void setMilliseconds(TField &field, TVal &&val)
Update field's value accordingly, while providing milliseconds value.
Definition units.h:648
constexpr bool isNanometersPerSecond()
Compile time check whether the field type holds nanometers per second.
Definition units.h:1292
TRet getKilometersPerHour(const TField &field)
Retrieve field's value as kilometers per hour.
Definition units.h:1586
void setSeconds(TField &field, TVal &&val)
Update field's value accordingly, while providing seconds value.
Definition units.h:701
void setMillimeters(TField &field, TVal &&val)
Update field's value accordingly, while providing millimeters value.
Definition units.h:1072
constexpr bool isMicrovolts()
Compile time check whether the field type holds microvolts.
Definition units.h:2300
constexpr bool isMicroseconds()
Compile time check whether the field type holds microseconds.
Definition units.h:603
TRet getTerabytes(const TField &field)
Retrieve field's value as terabytes.
Definition units.h:2701
constexpr bool isNanoamps()
Compile time check whether the field type holds nanoamps.
Definition units.h:1981
void setKilometers(TField &field, TVal &&val)
Update field's value accordingly, while providing kilometers value.
Definition units.h:1231
void setKiloamps(TField &field, TVal &&val)
Update field's value accordingly, while providing kiloamps value.
Definition units.h:2186
TRet getAmps(const TField &field)
Retrieve field's value as amps.
Definition units.h:2117
constexpr bool isMilliseconds()
Compile time check whether the field type holds milliseconds.
Definition units.h:656
constexpr bool isWeeks()
Compile time check whether the field type holds weeks.
Definition units.h:921
void setCentimetersPerSecond(TField &field, TVal &&val)
Update field's value accordingly, while providing centimeters per second value.
Definition units.h:1443
void setNanoamps(TField &field, TVal &&val)
Update field's value accordingly, while providing nanoamps value.
Definition units.h:1973
constexpr bool isKilohertz()
Compile time check whether the field type holds kilohertz.
Definition units.h:1716
constexpr bool isGigahertz()
Compile time check whether the field type holds gigahertz.
Definition units.h:1822
TRet getKilovolts(const TField &field)
Retrieve field's value as kilovolts.
Definition units.h:2435
TRet getBytes(const TField &field)
Retrieve field's value as bytes.
Definition units.h:2488
TRet getMetersPerSecond(const TField &field)
Retrieve field's value as meters per second.
Definition units.h:1480
void setMegahertz(TField &field, TVal &&val)
Update field's value accordingly, while providing megahertz value.
Definition units.h:1761
constexpr bool isNanoseconds()
Compile time check whether the field type holds nanoseconds.
Definition units.h:550
constexpr bool isKilobytes()
Compile time check whether the field type holds kilobytes.
Definition units.h:2565
void setHertz(TField &field, TVal &&val)
Update field's value accordingly, while providing hertz value.
Definition units.h:1655
TRet getMillimetersPerSecond(const TField &field)
Retrieve field's value as millimeters per second.
Definition units.h:1374
constexpr bool isMilliamps()
Compile time check whether the field type holds milliamps.
Definition units.h:2088
constexpr bool isKiloamps()
Compile time check whether the field type holds kiloamps.
Definition units.h:2194
TRet getKilobytes(const TField &field)
Retrieve field's value as kilobytes.
Definition units.h:2541
TRet getGigahertz(const TField &field)
Retrieve field's value as gigahertz.
Definition units.h:1798
void setMinutes(TField &field, TVal &&val)
Update field's value accordingly, while providing minutes value.
Definition units.h:754
void setDegrees(TField &field, TVal &&val)
Update field's value accordingly, while providing degrees value.
Definition units.h:1867
void setNanometers(TField &field, TVal &&val)
Update field's value accordingly, while providing nanometers value.
Definition units.h:966
void setMicroseconds(TField &field, TVal &&val)
Update field's value accordingly, while providing microseconds value.
Definition units.h:595
TRet getSeconds(const TField &field)
Retrieve field's value as seconds.
Definition units.h:685
void setMicrometers(TField &field, TVal &&val)
Update field's value accordingly, while providing micrometers value.
Definition units.h:1019
TRet getMicrometersPerSecond(const TField &field)
Retrieve field's value as micrometers per second.
Definition units.h:1321
void setMeters(TField &field, TVal &&val)
Update field's value accordingly, while providing meters value.
Definition units.h:1178
void setNanoseconds(TField &field, TVal &&val)
Update field's value accordingly, while providing nanoseconds value.
Definition units.h:542
void setRadians(TField &field, TVal &&val)
Update field's value accordingly, while providing radians value.
Definition units.h:1920
constexpr bool isDegrees()
Compile time check whether the field type holds degrees.
Definition units.h:1875
TRet getKilometers(const TField &field)
Retrieve field's value as kilometers.
Definition units.h:1215
TRet getCentimetersPerSecond(const TField &field)
Retrieve field's value as centimeters per second.
Definition units.h:1427
TRet getMegahertz(const TField &field)
Retrieve field's value as megahertz.
Definition units.h:1745
void setMegabytes(TField &field, TVal &&val)
Update field's value accordingly, while providing megabytes value.
Definition units.h:2610
void setKilometersPerSecond(TField &field, TVal &&val)
Update field's value accordingly, while providing kilometers per second value.
Definition units.h:1549
void setNanovolts(TField &field, TVal &&val)
Update field's value accordingly, while providing nanovolts value.
Definition units.h:2239
void setVolts(TField &field, TVal &&val)
Update field's value accordingly, while providing volts value.
Definition units.h:2398
constexpr bool isRadians()
Compile time check whether the field type holds radians.
Definition units.h:1928
constexpr bool isCentimeters()
Compile time check whether the field type holds centimeters.
Definition units.h:1133
void setKilometersPerHour(TField &field, TVal &&val)
Update field's value accordingly, while providing kilometers per hour value.
Definition units.h:1602
void setMicrovolts(TField &field, TVal &&val)
Update field's value accordingly, while providing microvolts value.
Definition units.h:2292
TRet getMegabytes(const TField &field)
Retrieve field's value as megabytes.
Definition units.h:2594
constexpr bool isDays()
Compile time check whether the field type holds days.
Definition units.h:868
constexpr bool isHertz()
Compile time check whether the field type holds hertz.
Definition units.h:1663
constexpr bool isSeconds()
Compile time check whether the field type holds seconds.
Definition units.h:709
void setKilohertz(TField &field, TVal &&val)
Update field's value accordingly, while providing kilohertz value.
Definition units.h:1708
constexpr bool isNanovolts()
Compile time check whether the field type holds nanovolts.
Definition units.h:2247
TRet getDegrees(const TField &field)
Retrieve field's value as degrees.
Definition units.h:1851
TRet getRadians(const TField &field)
Retrieve field's value as radians.
Definition units.h:1904
constexpr bool isMillivolts()
Compile time check whether the field type holds millivolts.
Definition units.h:2353
TRet getMillimeters(const TField &field)
Retrieve field's value as millimeters.
Definition units.h:1056
constexpr bool isAmps()
Compile time check whether the field type holds amps.
Definition units.h:2141
constexpr bool isKilometersPerSecond()
Compile time check whether the field type holds kilometers per second.
Definition units.h:1557
Main namespace for all classes / functions of COMMS library.
Tag class used to indicate electrical current value.
Definition traits.h:54
Tag class used to indicate distance value.
Definition traits.h:42
Tag class used to indicate frequency value.
Definition traits.h:48
Tag class used to indicate memory size value.
Definition traits.h:60
Tag class used to indicate speed value.
Definition traits.h:45
Tag class used to indicate time value.
Definition traits.h:39
Tag class used to indicate electrical voltage value.
Definition traits.h:57
Replacement to std::conditional.
Definition type_traits.h:28
This file contains all the classes necessary to properly define message traits.
Replacement to some types from standard type_traits.