From 5054f45a4a502153428a833cb534597c2dab3217 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 7 Nov 2022 16:34:02 -1000 Subject: [PATCH] refactor: iec80000 refectored vor V2 --- .../{isq-iec80000 => iec80000}/CMakeLists.txt | 8 +- .../include/units/iec80000/binary_prefixes.h | 49 +++ .../include/units/iec80000/dimensions.h} | 22 +- .../include/units}/iec80000/iec80000.h | 8 +- .../include/units/iec80000/unit_symbols.h | 82 ++++ .../iec80000/include/units/iec80000/units.h | 37 ++ .../units/isq/iec80000/modulation_rate.h | 158 -------- .../units/isq/iec80000/storage_capacity.h | 373 ------------------ .../units/isq/iec80000/traffic_intensity.h | 87 ---- .../units/isq/iec80000/transfer_rate.h | 138 ------- 10 files changed, 186 insertions(+), 776 deletions(-) rename src/systems/{isq-iec80000 => iec80000}/CMakeLists.txt (77%) create mode 100644 src/systems/iec80000/include/units/iec80000/binary_prefixes.h rename src/systems/{isq-iec80000/include/units/isq/iec80000/binary_prefixes.h => iec80000/include/units/iec80000/dimensions.h} (68%) rename src/systems/{isq-iec80000/include/units/isq => iec80000/include/units}/iec80000/iec80000.h (86%) create mode 100644 src/systems/iec80000/include/units/iec80000/unit_symbols.h create mode 100644 src/systems/iec80000/include/units/iec80000/units.h delete mode 100644 src/systems/isq-iec80000/include/units/isq/iec80000/modulation_rate.h delete mode 100644 src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h delete mode 100644 src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h delete mode 100644 src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h diff --git a/src/systems/isq-iec80000/CMakeLists.txt b/src/systems/iec80000/CMakeLists.txt similarity index 77% rename from src/systems/isq-iec80000/CMakeLists.txt rename to src/systems/iec80000/CMakeLists.txt index b2caa696..fd76bda1 100644 --- a/src/systems/isq-iec80000/CMakeLists.txt +++ b/src/systems/iec80000/CMakeLists.txt @@ -23,9 +23,7 @@ cmake_minimum_required(VERSION 3.19) add_units_module( - isq-iec80000 - DEPENDENCIES mp-units::si - HEADERS include/units/isq/iec80000/binary_prefixes.h include/units/isq/iec80000/iec80000.h - include/units/isq/iec80000/modulation_rate.h include/units/isq/iec80000/storage_capacity.h - include/units/isq/iec80000/traffic_intensity.h include/units/isq/iec80000/transfer_rate.h + isq-iec80000 DEPENDENCIES mp-units::si + HEADERS include/units/iec80000/binary_prefixes.h include/units/iec80000/dimensions.h + include/units/iec80000/iec80000.h include/units/iec80000/unit_symbols.h include/units/iec80000/units.h ) diff --git a/src/systems/iec80000/include/units/iec80000/binary_prefixes.h b/src/systems/iec80000/include/units/iec80000/binary_prefixes.h new file mode 100644 index 00000000..12248554 --- /dev/null +++ b/src/systems/iec80000/include/units/iec80000/binary_prefixes.h @@ -0,0 +1,49 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::iec80000 { + +// clang-format off +template struct kibi_ : prefixed_unit<"Ki", mag_power<2, 10>, U> {}; +template struct mebi_ : prefixed_unit<"Mi", mag_power<2, 20>, U> {}; +template struct gibi_ : prefixed_unit<"Gi", mag_power<2, 30>, U> {}; +template struct tebi_ : prefixed_unit<"Ti", mag_power<2, 40>, U> {}; +template struct pebi_ : prefixed_unit<"Pi", mag_power<2, 50>, U> {}; +template struct exbi_ : prefixed_unit<"Ei", mag_power<2, 60>, U> {}; +template struct zebi_ : prefixed_unit<"Zi", mag_power<2, 70>, U> {}; +template struct yobi_ : prefixed_unit<"Yi", mag_power<2, 80>, U> {}; + +template inline constexpr kibi_ kibi; +template inline constexpr mebi_ mebi; +template inline constexpr gibi_ gibi; +template inline constexpr tebi_ tebi; +template inline constexpr pebi_ pebi; +template inline constexpr exbi_ exbi; +template inline constexpr zebi_ zebi; +template inline constexpr yobi_ yobi; +// clang-format on + +} // namespace units::iec80000 diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/binary_prefixes.h b/src/systems/iec80000/include/units/iec80000/dimensions.h similarity index 68% rename from src/systems/isq-iec80000/include/units/isq/iec80000/binary_prefixes.h rename to src/systems/iec80000/include/units/iec80000/dimensions.h index a9fe73dd..ed9ca6dc 100644 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/binary_prefixes.h +++ b/src/systems/iec80000/include/units/iec80000/dimensions.h @@ -22,17 +22,17 @@ #pragma once -#include +#include +#include -namespace units::isq::iec80000 { +namespace units::iec80000 { -struct kibi : prefix(mag<2>())> {}; -struct mebi : prefix(mag<2>())> {}; -struct gibi : prefix(mag<2>())> {}; -struct tebi : prefix(mag<2>())> {}; -struct pebi : prefix(mag<2>())> {}; -struct exbi : prefix(mag<2>())> {}; -struct zebi : prefix(mag<2>())> {}; -struct yobi : prefix(mag<2>())> {}; +// clang-format off +inline constexpr struct storage_capacity : base_dimension<"M"> {} storage_capacity; +inline constexpr struct traffic_intensity : base_dimension<"A"> {} traffic_intensity; +// clang-format on -} // namespace units::isq::iec80000 +DERIVED_DIMENSION(transfer_rate, decltype(storage_capacity / si::time)); +DERIVED_DIMENSION(modulation_rate, decltype(1 / si::time)); + +} // namespace units::iec80000 diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/iec80000.h b/src/systems/iec80000/include/units/iec80000/iec80000.h similarity index 86% rename from src/systems/isq-iec80000/include/units/isq/iec80000/iec80000.h rename to src/systems/iec80000/include/units/iec80000/iec80000.h index fd518fa4..fc52bc37 100644 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/iec80000.h +++ b/src/systems/iec80000/include/units/iec80000/iec80000.h @@ -23,8 +23,8 @@ #pragma once // IWYU pragma: begin_exports -#include -#include -#include -#include +#include +#include +#include +#include // IWYU pragma: end_exports diff --git a/src/systems/iec80000/include/units/iec80000/unit_symbols.h b/src/systems/iec80000/include/units/iec80000/unit_symbols.h new file mode 100644 index 00000000..e16f1693 --- /dev/null +++ b/src/systems/iec80000/include/units/iec80000/unit_symbols.h @@ -0,0 +1,82 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::iec80000::unit_symbols { + +// bit +inline constexpr auto kbit = si::kilo; +inline constexpr auto Mbit = si::mega; +inline constexpr auto Gbit = si::giga; +inline constexpr auto Tbit = si::tera; +inline constexpr auto Pbit = si::peta; +inline constexpr auto Ebit = si::exa; +inline constexpr auto Zbit = si::zetta; +inline constexpr auto Ybit = si::yotta; + +inline constexpr auto Kibit = kibi; +inline constexpr auto Mibit = mebi; +inline constexpr auto Gibit = gibi; +inline constexpr auto Tibit = tebi; +inline constexpr auto Pibit = pebi; +inline constexpr auto Eibit = exbi; + +// byte +inline constexpr auto B = byte; + +inline constexpr auto kB = si::kilo; +inline constexpr auto MB = si::mega; +inline constexpr auto GB = si::giga; +inline constexpr auto TB = si::tera; +inline constexpr auto PB = si::peta; +inline constexpr auto EB = si::exa; +inline constexpr auto ZB = si::zetta; +inline constexpr auto YB = si::yotta; + +inline constexpr auto KiB = kibi; +inline constexpr auto MiB = mebi; +inline constexpr auto GiB = gibi; +inline constexpr auto TiB = tebi; +inline constexpr auto PiB = pebi; +inline constexpr auto EiB = exbi; + +// baud +inline constexpr auto Bd = baud; +inline constexpr auto kBd = si::kilo; +inline constexpr auto MBd = si::mega; +inline constexpr auto GBd = si::giga; +inline constexpr auto TBd = si::tera; +inline constexpr auto PBd = si::peta; +inline constexpr auto EBd = si::exa; +inline constexpr auto ZBd = si::zetta; +inline constexpr auto YBd = si::yotta; + +// erlang +// TODO do we need prefixed versions of Erlang? +inline constexpr auto E = erlang; + +} // namespace units::iec80000::unit_symbols diff --git a/src/systems/iec80000/include/units/iec80000/units.h b/src/systems/iec80000/include/units/iec80000/units.h new file mode 100644 index 00000000..daa44350 --- /dev/null +++ b/src/systems/iec80000/include/units/iec80000/units.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::iec80000 { + +// clang-format off +inline constexpr struct erlang : named_unit<"E", traffic_intensity> {} erlang; +inline constexpr struct bit : named_unit<"bit", storage_capacity> {} bit; +inline constexpr struct byte : named_unit<"B", mag<8> * bit> {} byte; +inline constexpr struct baud : named_unit<"Bd", 1 / si::second> {} baud; +// clang-format on + +} // namespace units::iec80000 diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/modulation_rate.h b/src/systems/isq-iec80000/include/units/isq/iec80000/modulation_rate.h deleted file mode 100644 index 40bf6d24..00000000 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/modulation_rate.h +++ /dev/null @@ -1,158 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018 Mateusz Pusz -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include -#include -#include - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -namespace units::isq::iec80000 { - -struct baud : alias_unit {}; -struct kilobaud : prefixed_alias_unit {}; -struct megabaud : prefixed_alias_unit {}; -struct gigabaud : prefixed_alias_unit {}; -struct terabaud : prefixed_alias_unit {}; -struct petabaud : prefixed_alias_unit {}; -struct exabaud : prefixed_alias_unit {}; -struct zettabaud : prefixed_alias_unit {}; -struct yottabaud : prefixed_alias_unit {}; - -// TODO alias_dimension -using dim_modulation_rate = si::dim_frequency; - -template U, Representation Rep = double> -using modulation_rate = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -constexpr auto operator"" _q_Bd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_kBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_MBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_GBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_TBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_PBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_EBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_ZBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} -constexpr auto operator"" _q_YBd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return modulation_rate(static_cast(l)); -} - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace modulation_rate_references { - -inline constexpr auto Bd = reference{}; -inline constexpr auto kBd = reference{}; -inline constexpr auto MBd = reference{}; -inline constexpr auto GBd = reference{}; -inline constexpr auto TBd = reference{}; -inline constexpr auto PBd = reference{}; -inline constexpr auto EBd = reference{}; -inline constexpr auto ZBd = reference{}; -inline constexpr auto YBd = reference{}; - -} // namespace modulation_rate_references - -namespace references { - -using namespace modulation_rate_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::iec80000 - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::iec80000::inline modulation_rate { - -template -using Bd = units::isq::iec80000::modulation_rate; -template -using kBd = units::isq::iec80000::modulation_rate; -template -using MBd = units::isq::iec80000::modulation_rate; -template -using GBd = units::isq::iec80000::modulation_rate; -template -using TBd = units::isq::iec80000::modulation_rate; -template -using PBd = units::isq::iec80000::modulation_rate; -template -using EBd = units::isq::iec80000::modulation_rate; -template -using ZBd = units::isq::iec80000::modulation_rate; -template -using YBd = units::isq::iec80000::modulation_rate; - -} // namespace units::aliases::isq::iec80000::inline modulation_rate - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h b/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h deleted file mode 100644 index 2ca2f0d7..00000000 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h +++ /dev/null @@ -1,373 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018 Mateusz Pusz -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include -#include -#include -#include - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -namespace units::isq::iec80000 { - -struct bit : named_unit {}; - -struct kilobit : prefixed_unit {}; -struct megabit : prefixed_unit {}; -struct gigabit : prefixed_unit {}; -struct terabit : prefixed_unit {}; -struct petabit : prefixed_unit {}; -struct exabit : prefixed_unit {}; -struct zettabit : prefixed_unit {}; -struct yottabit : prefixed_unit {}; - -struct kibibit : prefixed_unit {}; -struct mebibit : prefixed_unit {}; -struct gibibit : prefixed_unit {}; -struct tebibit : prefixed_unit {}; -struct pebibit : prefixed_unit {}; -struct exbibit : prefixed_unit {}; - -struct byte : named_scaled_unit(), bit> {}; - -struct kilobyte : prefixed_unit {}; -struct megabyte : prefixed_unit {}; -struct gigabyte : prefixed_unit {}; -struct terabyte : prefixed_unit {}; -struct petabyte : prefixed_unit {}; -struct exabyte : prefixed_unit {}; -struct zettabyte : prefixed_unit {}; -struct yottabyte : prefixed_unit {}; - -struct kibibyte : prefixed_unit {}; -struct mebibyte : prefixed_unit {}; -struct gibibyte : prefixed_unit {}; -struct tebibyte : prefixed_unit {}; -struct pebibyte : prefixed_unit {}; -// struct exbibyte : prefixed_unit {}; - -struct dim_storage_capacity : base_dimension<"M", byte> {}; - -template -concept StorageCapacity = QuantityOf; - -template U, Representation Rep = double> -using storage_capacity = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// bits -constexpr auto operator"" _q_bit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} - -constexpr auto operator"" _q_kbit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Mbit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Gbit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Tbit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Pbit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Ebit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Zbit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Ybit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} - -constexpr auto operator"" _q_Kibit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Mibit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Gibit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Tibit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Pibit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_Eibit(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} - -// bytes -constexpr auto operator"" _q_B(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} - -constexpr auto operator"" _q_kB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_MB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_GB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_TB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_PB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_EB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_ZB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_YB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} - -constexpr auto operator"" _q_KiB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_MiB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_GiB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_TiB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -constexpr auto operator"" _q_PiB(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return storage_capacity(static_cast(l)); -} -// constexpr auto operator"" _q_EiB(unsigned long long l) { gsl_ExpectsAudit(std::in_range(l)); return -// storage_capacity(static_cast(l)); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace storage_capacity_references { - -// bits -inline constexpr auto bit = reference{}; - -inline constexpr auto kbit = reference{}; -inline constexpr auto Mbit = reference{}; -inline constexpr auto Gbit = reference{}; -inline constexpr auto Tbit = reference{}; -inline constexpr auto Pbit = reference{}; -inline constexpr auto Ebit = reference{}; -inline constexpr auto Zbit = reference{}; -inline constexpr auto Ybit = reference{}; - -inline constexpr auto Kibit = reference{}; -inline constexpr auto Mibit = reference{}; -inline constexpr auto Gibit = reference{}; -inline constexpr auto Tibit = reference{}; -inline constexpr auto Pibit = reference{}; -inline constexpr auto Eibit = reference{}; - -// bytes -inline constexpr auto B = reference{}; - -inline constexpr auto kB = reference{}; -inline constexpr auto MB = reference{}; -inline constexpr auto GB = reference{}; -inline constexpr auto TB = reference{}; -inline constexpr auto PB = reference{}; -inline constexpr auto EB = reference{}; -inline constexpr auto ZB = reference{}; -inline constexpr auto YB = reference{}; - -inline constexpr auto KiB = reference{}; -inline constexpr auto MiB = reference{}; -inline constexpr auto GiB = reference{}; -inline constexpr auto TiB = reference{}; -inline constexpr auto PiB = reference{}; -// inline constexpr auto EiB = reference{}; - -} // namespace storage_capacity_references - -namespace references { - -using namespace storage_capacity_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::iec80000 - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::iec80000::inline storage_capacity { - -// bits -template -using bit = units::isq::iec80000::storage_capacity; - -template -using kbit = units::isq::iec80000::storage_capacity; -template -using Mbit = units::isq::iec80000::storage_capacity; -template -using Gbit = units::isq::iec80000::storage_capacity; -template -using Tbit = units::isq::iec80000::storage_capacity; -template -using Pbit = units::isq::iec80000::storage_capacity; -template -using Ebit = units::isq::iec80000::storage_capacity; -template -using Zbit = units::isq::iec80000::storage_capacity; -template -using Ybit = units::isq::iec80000::storage_capacity; - -template -using Kibit = units::isq::iec80000::storage_capacity; -template -using Mibit = units::isq::iec80000::storage_capacity; -template -using Gibit = units::isq::iec80000::storage_capacity; -template -using Tibit = units::isq::iec80000::storage_capacity; -template -using Pibit = units::isq::iec80000::storage_capacity; -template -using Eibit = units::isq::iec80000::storage_capacity; - -// bytes -template -using B = units::isq::iec80000::storage_capacity; - -template -using kB = units::isq::iec80000::storage_capacity; -template -using MB = units::isq::iec80000::storage_capacity; -template -using GB = units::isq::iec80000::storage_capacity; -template -using TB = units::isq::iec80000::storage_capacity; -template -using PB = units::isq::iec80000::storage_capacity; -template -using EB = units::isq::iec80000::storage_capacity; -template -using ZB = units::isq::iec80000::storage_capacity; -template -using YB = units::isq::iec80000::storage_capacity; - -template -using KiB = units::isq::iec80000::storage_capacity; -template -using MiB = units::isq::iec80000::storage_capacity; -template -using GiB = units::isq::iec80000::storage_capacity; -template -using TiB = units::isq::iec80000::storage_capacity; -template -using PiB = units::isq::iec80000::storage_capacity; -// template using EiB = -// units::isq::iec80000::storage_capacity; - -} // namespace units::aliases::isq::iec80000::inline storage_capacity - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h b/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h deleted file mode 100644 index 03a31646..00000000 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h +++ /dev/null @@ -1,87 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018 Mateusz Pusz -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include -#include - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -namespace units::isq::iec80000 { - -struct erlang : named_unit {}; - -struct dim_traffic_intensity : base_dimension<"A", erlang> {}; - -template -concept TrafficIntensity = QuantityOf; - -template U, Representation Rep = double> -using traffic_intensity = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -constexpr auto operator"" _q_E(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return traffic_intensity(static_cast(l)); -} - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace traffic_intensity_references { - -inline constexpr auto E = reference{}; - -} // namespace traffic_intensity_references - -namespace references { - -using namespace traffic_intensity_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::iec80000 - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::iec80000::inline traffic_intensity { - -template -using E = units::isq::iec80000::traffic_intensity; - -} // namespace units::aliases::isq::iec80000::inline traffic_intensity - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h b/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h deleted file mode 100644 index 54a02d7e..00000000 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h +++ /dev/null @@ -1,138 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018 Mateusz Pusz -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include -#include -#include -#include - -// IWYU pragma: begin_exports -#include -#include -// IWYU pragma: end_exports - -namespace units::isq::iec80000 { - -struct byte_per_second : derived_unit {}; -struct dim_transfer_rate : - derived_dimension, - exponent> {}; - -struct kilobyte_per_second : derived_scaled_unit {}; -struct megabyte_per_second : derived_scaled_unit {}; -struct gigabyte_per_second : derived_scaled_unit {}; -struct terabyte_per_second : derived_scaled_unit {}; -struct petabyte_per_second : derived_scaled_unit {}; -struct exabyte_per_second : derived_scaled_unit {}; -struct zettabyte_per_second : derived_scaled_unit {}; -struct yottabyte_per_second : derived_scaled_unit {}; - -template -concept TransferRate = QuantityOf; - -template U, Representation Rep = double> -using transfer_rate = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -constexpr auto operator"" _q_B_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_kB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_MB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_GB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_TB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_PB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_EB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_ZB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} -constexpr auto operator"" _q_YB_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return transfer_rate(static_cast(l)); -} - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -} // namespace units::isq::iec80000 - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::iec80000::inline transfer_rate { - -template -using B_per_s = units::isq::iec80000::transfer_rate; -template -using kB_per_s = units::isq::iec80000::transfer_rate; -template -using MB_per_s = units::isq::iec80000::transfer_rate; -template -using GB_per_s = units::isq::iec80000::transfer_rate; -template -using TB_per_s = units::isq::iec80000::transfer_rate; -template -using PB_per_s = units::isq::iec80000::transfer_rate; -template -using EB_per_s = units::isq::iec80000::transfer_rate; -template -using ZB_per_s = units::isq::iec80000::transfer_rate; -template -using YB_per_s = units::isq::iec80000::transfer_rate; - -} // namespace units::aliases::isq::iec80000::inline transfer_rate - -#endif // UNITS_NO_ALIASES