refactor: iec80000 refectored vor V2

This commit is contained in:
Mateusz Pusz
2022-11-07 16:34:02 -10:00
parent f462109aa3
commit 5054f45a4a
10 changed files with 186 additions and 776 deletions

View File

@@ -23,9 +23,7 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
add_units_module( add_units_module(
isq-iec80000 isq-iec80000 DEPENDENCIES mp-units::si
DEPENDENCIES mp-units::si HEADERS include/units/iec80000/binary_prefixes.h include/units/iec80000/dimensions.h
HEADERS include/units/isq/iec80000/binary_prefixes.h include/units/isq/iec80000/iec80000.h include/units/iec80000/iec80000.h include/units/iec80000/unit_symbols.h include/units/iec80000/units.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
) )

View File

@@ -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 <units/prefix.h>
namespace units::iec80000 {
// clang-format off
template<PrefixableUnit auto U> struct kibi_ : prefixed_unit<"Ki", mag_power<2, 10>, U> {};
template<PrefixableUnit auto U> struct mebi_ : prefixed_unit<"Mi", mag_power<2, 20>, U> {};
template<PrefixableUnit auto U> struct gibi_ : prefixed_unit<"Gi", mag_power<2, 30>, U> {};
template<PrefixableUnit auto U> struct tebi_ : prefixed_unit<"Ti", mag_power<2, 40>, U> {};
template<PrefixableUnit auto U> struct pebi_ : prefixed_unit<"Pi", mag_power<2, 50>, U> {};
template<PrefixableUnit auto U> struct exbi_ : prefixed_unit<"Ei", mag_power<2, 60>, U> {};
template<PrefixableUnit auto U> struct zebi_ : prefixed_unit<"Zi", mag_power<2, 70>, U> {};
template<PrefixableUnit auto U> struct yobi_ : prefixed_unit<"Yi", mag_power<2, 80>, U> {};
template<PrefixableUnit auto U> inline constexpr kibi_<U> kibi;
template<PrefixableUnit auto U> inline constexpr mebi_<U> mebi;
template<PrefixableUnit auto U> inline constexpr gibi_<U> gibi;
template<PrefixableUnit auto U> inline constexpr tebi_<U> tebi;
template<PrefixableUnit auto U> inline constexpr pebi_<U> pebi;
template<PrefixableUnit auto U> inline constexpr exbi_<U> exbi;
template<PrefixableUnit auto U> inline constexpr zebi_<U> zebi;
template<PrefixableUnit auto U> inline constexpr yobi_<U> yobi;
// clang-format on
} // namespace units::iec80000

View File

@@ -22,17 +22,17 @@
#pragma once #pragma once
#include <units/prefix.h> #include <units/dimension.h>
#include <units/isq/base_dimensions.h>
namespace units::isq::iec80000 { namespace units::iec80000 {
struct kibi : prefix<kibi, "Ki", pow<10>(mag<2>())> {}; // clang-format off
struct mebi : prefix<mebi, "Mi", pow<20>(mag<2>())> {}; inline constexpr struct storage_capacity : base_dimension<"M"> {} storage_capacity;
struct gibi : prefix<gibi, "Gi", pow<30>(mag<2>())> {}; inline constexpr struct traffic_intensity : base_dimension<"A"> {} traffic_intensity;
struct tebi : prefix<tebi, "Ti", pow<40>(mag<2>())> {}; // clang-format on
struct pebi : prefix<pebi, "Pi", pow<50>(mag<2>())> {};
struct exbi : prefix<exbi, "Ei", pow<60>(mag<2>())> {};
struct zebi : prefix<zebi, "Zi", pow<70>(mag<2>())> {};
struct yobi : prefix<yobi, "Yi", pow<80>(mag<2>())> {};
} // namespace units::isq::iec80000 DERIVED_DIMENSION(transfer_rate, decltype(storage_capacity / si::time));
DERIVED_DIMENSION(modulation_rate, decltype(1 / si::time));
} // namespace units::iec80000

View File

@@ -23,8 +23,8 @@
#pragma once #pragma once
// IWYU pragma: begin_exports // IWYU pragma: begin_exports
#include <units/isq/iec80000/modulation_rate.h> #include <units/iec80000/binary_prefixes.h>
#include <units/isq/iec80000/storage_capacity.h> #include <units/iec80000/dimensions.h>
#include <units/isq/iec80000/traffic_intensity.h> #include <units/iec80000/unit_symbols.h>
#include <units/isq/iec80000/transfer_rate.h> #include <units/iec80000/units.h>
// IWYU pragma: end_exports // IWYU pragma: end_exports

View File

@@ -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 <units/iec80000/binary_prefixes.h>
#include <units/iec80000/units.h>
#include <units/si/prefixes.h>
namespace units::iec80000::unit_symbols {
// bit
inline constexpr auto kbit = si::kilo<bit>;
inline constexpr auto Mbit = si::mega<bit>;
inline constexpr auto Gbit = si::giga<bit>;
inline constexpr auto Tbit = si::tera<bit>;
inline constexpr auto Pbit = si::peta<bit>;
inline constexpr auto Ebit = si::exa<bit>;
inline constexpr auto Zbit = si::zetta<bit>;
inline constexpr auto Ybit = si::yotta<bit>;
inline constexpr auto Kibit = kibi<bit>;
inline constexpr auto Mibit = mebi<bit>;
inline constexpr auto Gibit = gibi<bit>;
inline constexpr auto Tibit = tebi<bit>;
inline constexpr auto Pibit = pebi<bit>;
inline constexpr auto Eibit = exbi<bit>;
// byte
inline constexpr auto B = byte;
inline constexpr auto kB = si::kilo<byte>;
inline constexpr auto MB = si::mega<byte>;
inline constexpr auto GB = si::giga<byte>;
inline constexpr auto TB = si::tera<byte>;
inline constexpr auto PB = si::peta<byte>;
inline constexpr auto EB = si::exa<byte>;
inline constexpr auto ZB = si::zetta<byte>;
inline constexpr auto YB = si::yotta<byte>;
inline constexpr auto KiB = kibi<byte>;
inline constexpr auto MiB = mebi<byte>;
inline constexpr auto GiB = gibi<byte>;
inline constexpr auto TiB = tebi<byte>;
inline constexpr auto PiB = pebi<byte>;
inline constexpr auto EiB = exbi<byte>;
// baud
inline constexpr auto Bd = baud;
inline constexpr auto kBd = si::kilo<baud>;
inline constexpr auto MBd = si::mega<baud>;
inline constexpr auto GBd = si::giga<baud>;
inline constexpr auto TBd = si::tera<baud>;
inline constexpr auto PBd = si::peta<baud>;
inline constexpr auto EBd = si::exa<baud>;
inline constexpr auto ZBd = si::zetta<baud>;
inline constexpr auto YBd = si::yotta<baud>;
// erlang
// TODO do we need prefixed versions of Erlang?
inline constexpr auto E = erlang;
} // namespace units::iec80000::unit_symbols

View File

@@ -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 <units/iec80000/dimensions.h>
#include <units/unit.h>
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

View File

@@ -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 <units/isq/si/frequency.h>
#include <units/isq/si/prefixes.h>
#include <units/unit.h>
// IWYU pragma: begin_exports
#include <units/quantity.h>
#include <units/reference.h>
#include <units/symbol_text.h>
// IWYU pragma: end_exports
namespace units::isq::iec80000 {
struct baud : alias_unit<si::hertz, "Bd"> {};
struct kilobaud : prefixed_alias_unit<si::kilohertz, si::kilo, baud> {};
struct megabaud : prefixed_alias_unit<si::megahertz, si::mega, baud> {};
struct gigabaud : prefixed_alias_unit<si::gigahertz, si::giga, baud> {};
struct terabaud : prefixed_alias_unit<si::terahertz, si::tera, baud> {};
struct petabaud : prefixed_alias_unit<si::petahertz, si::peta, baud> {};
struct exabaud : prefixed_alias_unit<si::exahertz, si::exa, baud> {};
struct zettabaud : prefixed_alias_unit<si::zettahertz, si::zetta, baud> {};
struct yottabaud : prefixed_alias_unit<si::yottahertz, si::yotta, baud> {};
// TODO alias_dimension
using dim_modulation_rate = si::dim_frequency;
template<UnitOf<dim_modulation_rate> U, Representation Rep = double>
using modulation_rate = quantity<dim_modulation_rate, U, Rep>;
#ifndef UNITS_NO_LITERALS
inline namespace literals {
constexpr auto operator"" _q_Bd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<baud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_kBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<kilobaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_MBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<megabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_GBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<gigabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_TBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<terabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_PBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<petabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_EBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<exabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_ZBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<zettabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_YBd(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return modulation_rate<yottabaud, std::int64_t>(static_cast<std::int64_t>(l));
}
} // namespace literals
#endif // UNITS_NO_LITERALS
#ifndef UNITS_NO_REFERENCES
namespace modulation_rate_references {
inline constexpr auto Bd = reference<dim_modulation_rate, baud>{};
inline constexpr auto kBd = reference<dim_modulation_rate, kilobaud>{};
inline constexpr auto MBd = reference<dim_modulation_rate, megabaud>{};
inline constexpr auto GBd = reference<dim_modulation_rate, gigabaud>{};
inline constexpr auto TBd = reference<dim_modulation_rate, terabaud>{};
inline constexpr auto PBd = reference<dim_modulation_rate, petabaud>{};
inline constexpr auto EBd = reference<dim_modulation_rate, exabaud>{};
inline constexpr auto ZBd = reference<dim_modulation_rate, zettabaud>{};
inline constexpr auto YBd = reference<dim_modulation_rate, yottabaud>{};
} // 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<Representation Rep = double>
using Bd = units::isq::iec80000::modulation_rate<units::isq::iec80000::baud, Rep>;
template<Representation Rep = double>
using kBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::kilobaud, Rep>;
template<Representation Rep = double>
using MBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::megabaud, Rep>;
template<Representation Rep = double>
using GBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::gigabaud, Rep>;
template<Representation Rep = double>
using TBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::terabaud, Rep>;
template<Representation Rep = double>
using PBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::petabaud, Rep>;
template<Representation Rep = double>
using EBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::exabaud, Rep>;
template<Representation Rep = double>
using ZBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::zettabaud, Rep>;
template<Representation Rep = double>
using YBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::yottabaud, Rep>;
} // namespace units::aliases::isq::iec80000::inline modulation_rate
#endif // UNITS_NO_ALIASES

View File

@@ -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 <units/base_dimension.h>
#include <units/isq/iec80000/binary_prefixes.h>
#include <units/isq/si/prefixes.h>
#include <units/unit.h>
// IWYU pragma: begin_exports
#include <units/quantity.h>
#include <units/reference.h>
#include <units/symbol_text.h>
// IWYU pragma: end_exports
namespace units::isq::iec80000 {
struct bit : named_unit<bit, "bit"> {};
struct kilobit : prefixed_unit<kilobit, si::kilo, bit> {};
struct megabit : prefixed_unit<megabit, si::mega, bit> {};
struct gigabit : prefixed_unit<gigabit, si::giga, bit> {};
struct terabit : prefixed_unit<terabit, si::tera, bit> {};
struct petabit : prefixed_unit<petabit, si::peta, bit> {};
struct exabit : prefixed_unit<exabit, si::exa, bit> {};
struct zettabit : prefixed_unit<zettabit, si::zetta, bit> {};
struct yottabit : prefixed_unit<yottabit, si::yotta, bit> {};
struct kibibit : prefixed_unit<kibibit, kibi, bit> {};
struct mebibit : prefixed_unit<mebibit, mebi, bit> {};
struct gibibit : prefixed_unit<gibibit, gibi, bit> {};
struct tebibit : prefixed_unit<tebibit, tebi, bit> {};
struct pebibit : prefixed_unit<pebibit, pebi, bit> {};
struct exbibit : prefixed_unit<exbibit, exbi, bit> {};
struct byte : named_scaled_unit<byte, "B", mag<8>(), bit> {};
struct kilobyte : prefixed_unit<kilobyte, si::kilo, byte> {};
struct megabyte : prefixed_unit<megabyte, si::mega, byte> {};
struct gigabyte : prefixed_unit<gigabyte, si::giga, byte> {};
struct terabyte : prefixed_unit<terabyte, si::tera, byte> {};
struct petabyte : prefixed_unit<petabyte, si::peta, byte> {};
struct exabyte : prefixed_unit<exabyte, si::exa, byte> {};
struct zettabyte : prefixed_unit<zettabyte, si::zetta, byte> {};
struct yottabyte : prefixed_unit<yottabyte, si::yotta, byte> {};
struct kibibyte : prefixed_unit<kibibyte, kibi, byte> {};
struct mebibyte : prefixed_unit<mebibyte, mebi, byte> {};
struct gibibyte : prefixed_unit<gibibyte, gibi, byte> {};
struct tebibyte : prefixed_unit<tebibyte, tebi, byte> {};
struct pebibyte : prefixed_unit<pebibyte, pebi, byte> {};
// struct exbibyte : prefixed_unit<exbibyte, exbi, byte> {};
struct dim_storage_capacity : base_dimension<"M", byte> {};
template<typename T>
concept StorageCapacity = QuantityOf<T, dim_storage_capacity>;
template<UnitOf<dim_storage_capacity> U, Representation Rep = double>
using storage_capacity = quantity<dim_storage_capacity, U, Rep>;
#ifndef UNITS_NO_LITERALS
inline namespace literals {
// bits
constexpr auto operator"" _q_bit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<bit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_kbit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<kilobit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Mbit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<megabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Gbit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<gigabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Tbit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<terabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Pbit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<petabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Ebit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<exabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Zbit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<zettabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Ybit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<yottabit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Kibit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<kibibit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Mibit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<mebibit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Gibit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<gibibit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Tibit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<tebibit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Pibit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<pebibit, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_Eibit(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<exbibit, std::int64_t>(static_cast<std::int64_t>(l));
}
// bytes
constexpr auto operator"" _q_B(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<byte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_kB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<kilobyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_MB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<megabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_GB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<gigabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_TB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<terabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_PB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<petabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_EB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<exabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_ZB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<zettabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_YB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<yottabyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_KiB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<kibibyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_MiB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<mebibyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_GiB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<gibibyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_TiB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<tebibyte, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_PiB(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return storage_capacity<pebibyte, std::int64_t>(static_cast<std::int64_t>(l));
}
// constexpr auto operator"" _q_EiB(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return
// storage_capacity<exbibyte, std::int64_t>(static_cast<std::int64_t>(l)); }
} // namespace literals
#endif // UNITS_NO_LITERALS
#ifndef UNITS_NO_REFERENCES
namespace storage_capacity_references {
// bits
inline constexpr auto bit = reference<dim_storage_capacity, iec80000::bit>{};
inline constexpr auto kbit = reference<dim_storage_capacity, kilobit>{};
inline constexpr auto Mbit = reference<dim_storage_capacity, megabit>{};
inline constexpr auto Gbit = reference<dim_storage_capacity, gigabit>{};
inline constexpr auto Tbit = reference<dim_storage_capacity, terabit>{};
inline constexpr auto Pbit = reference<dim_storage_capacity, petabit>{};
inline constexpr auto Ebit = reference<dim_storage_capacity, exabit>{};
inline constexpr auto Zbit = reference<dim_storage_capacity, zettabit>{};
inline constexpr auto Ybit = reference<dim_storage_capacity, yottabit>{};
inline constexpr auto Kibit = reference<dim_storage_capacity, kibibit>{};
inline constexpr auto Mibit = reference<dim_storage_capacity, mebibit>{};
inline constexpr auto Gibit = reference<dim_storage_capacity, gibibit>{};
inline constexpr auto Tibit = reference<dim_storage_capacity, tebibit>{};
inline constexpr auto Pibit = reference<dim_storage_capacity, pebibit>{};
inline constexpr auto Eibit = reference<dim_storage_capacity, exbibit>{};
// bytes
inline constexpr auto B = reference<dim_storage_capacity, byte>{};
inline constexpr auto kB = reference<dim_storage_capacity, kilobyte>{};
inline constexpr auto MB = reference<dim_storage_capacity, megabyte>{};
inline constexpr auto GB = reference<dim_storage_capacity, gigabyte>{};
inline constexpr auto TB = reference<dim_storage_capacity, terabyte>{};
inline constexpr auto PB = reference<dim_storage_capacity, petabyte>{};
inline constexpr auto EB = reference<dim_storage_capacity, exabyte>{};
inline constexpr auto ZB = reference<dim_storage_capacity, zettabyte>{};
inline constexpr auto YB = reference<dim_storage_capacity, yottabyte>{};
inline constexpr auto KiB = reference<dim_storage_capacity, kibibyte>{};
inline constexpr auto MiB = reference<dim_storage_capacity, mebibyte>{};
inline constexpr auto GiB = reference<dim_storage_capacity, gibibyte>{};
inline constexpr auto TiB = reference<dim_storage_capacity, tebibyte>{};
inline constexpr auto PiB = reference<dim_storage_capacity, pebibyte>{};
// inline constexpr auto EiB = reference<dim_storage_capacity, exbibyte>{};
} // 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<Representation Rep = double>
using bit = units::isq::iec80000::storage_capacity<units::isq::iec80000::bit, Rep>;
template<Representation Rep = double>
using kbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::kilobit, Rep>;
template<Representation Rep = double>
using Mbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::megabit, Rep>;
template<Representation Rep = double>
using Gbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::gigabit, Rep>;
template<Representation Rep = double>
using Tbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::terabit, Rep>;
template<Representation Rep = double>
using Pbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::petabit, Rep>;
template<Representation Rep = double>
using Ebit = units::isq::iec80000::storage_capacity<units::isq::iec80000::exabit, Rep>;
template<Representation Rep = double>
using Zbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::zettabit, Rep>;
template<Representation Rep = double>
using Ybit = units::isq::iec80000::storage_capacity<units::isq::iec80000::yottabit, Rep>;
template<Representation Rep = double>
using Kibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::kibibit, Rep>;
template<Representation Rep = double>
using Mibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::mebibit, Rep>;
template<Representation Rep = double>
using Gibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::gibibit, Rep>;
template<Representation Rep = double>
using Tibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::tebibit, Rep>;
template<Representation Rep = double>
using Pibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::pebibit, Rep>;
template<Representation Rep = double>
using Eibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::exbibit, Rep>;
// bytes
template<Representation Rep = double>
using B = units::isq::iec80000::storage_capacity<units::isq::iec80000::byte, Rep>;
template<Representation Rep = double>
using kB = units::isq::iec80000::storage_capacity<units::isq::iec80000::kilobyte, Rep>;
template<Representation Rep = double>
using MB = units::isq::iec80000::storage_capacity<units::isq::iec80000::megabyte, Rep>;
template<Representation Rep = double>
using GB = units::isq::iec80000::storage_capacity<units::isq::iec80000::gigabyte, Rep>;
template<Representation Rep = double>
using TB = units::isq::iec80000::storage_capacity<units::isq::iec80000::terabyte, Rep>;
template<Representation Rep = double>
using PB = units::isq::iec80000::storage_capacity<units::isq::iec80000::petabyte, Rep>;
template<Representation Rep = double>
using EB = units::isq::iec80000::storage_capacity<units::isq::iec80000::exabyte, Rep>;
template<Representation Rep = double>
using ZB = units::isq::iec80000::storage_capacity<units::isq::iec80000::zettabyte, Rep>;
template<Representation Rep = double>
using YB = units::isq::iec80000::storage_capacity<units::isq::iec80000::yottabyte, Rep>;
template<Representation Rep = double>
using KiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::kibibyte, Rep>;
template<Representation Rep = double>
using MiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::mebibyte, Rep>;
template<Representation Rep = double>
using GiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::gibibyte, Rep>;
template<Representation Rep = double>
using TiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::tebibyte, Rep>;
template<Representation Rep = double>
using PiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::pebibyte, Rep>;
// template<Representation Rep = double> using EiB =
// units::isq::iec80000::storage_capacity<units::isq::iec80000::exbibyte, Rep>;
} // namespace units::aliases::isq::iec80000::inline storage_capacity
#endif // UNITS_NO_ALIASES

View File

@@ -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 <units/base_dimension.h>
#include <units/unit.h>
// IWYU pragma: begin_exports
#include <units/quantity.h>
#include <units/reference.h>
#include <units/symbol_text.h>
// IWYU pragma: end_exports
namespace units::isq::iec80000 {
struct erlang : named_unit<erlang, "E"> {};
struct dim_traffic_intensity : base_dimension<"A", erlang> {};
template<typename T>
concept TrafficIntensity = QuantityOf<T, dim_traffic_intensity>;
template<UnitOf<dim_traffic_intensity> U, Representation Rep = double>
using traffic_intensity = quantity<dim_traffic_intensity, U, Rep>;
#ifndef UNITS_NO_LITERALS
inline namespace literals {
constexpr auto operator"" _q_E(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return traffic_intensity<erlang, std::int64_t>(static_cast<std::int64_t>(l));
}
} // namespace literals
#endif // UNITS_NO_LITERALS
#ifndef UNITS_NO_REFERENCES
namespace traffic_intensity_references {
inline constexpr auto E = reference<dim_traffic_intensity, erlang>{};
} // 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<Representation Rep = double>
using E = units::isq::iec80000::traffic_intensity<units::isq::iec80000::erlang, Rep>;
} // namespace units::aliases::isq::iec80000::inline traffic_intensity
#endif // UNITS_NO_ALIASES

View File

@@ -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 <units/derived_dimension.h>
#include <units/isq/iec80000/storage_capacity.h>
#include <units/isq/si/time.h>
#include <units/unit.h>
// IWYU pragma: begin_exports
#include <units/quantity.h>
#include <units/symbol_text.h>
// IWYU pragma: end_exports
namespace units::isq::iec80000 {
struct byte_per_second : derived_unit<byte_per_second> {};
struct dim_transfer_rate :
derived_dimension<dim_transfer_rate, byte_per_second, exponent<dim_storage_capacity, 1>,
exponent<si::dim_time, -1>> {};
struct kilobyte_per_second : derived_scaled_unit<kilobyte_per_second, dim_transfer_rate, kilobyte, si::second> {};
struct megabyte_per_second : derived_scaled_unit<megabyte_per_second, dim_transfer_rate, megabyte, si::second> {};
struct gigabyte_per_second : derived_scaled_unit<gigabyte_per_second, dim_transfer_rate, gigabyte, si::second> {};
struct terabyte_per_second : derived_scaled_unit<terabyte_per_second, dim_transfer_rate, terabyte, si::second> {};
struct petabyte_per_second : derived_scaled_unit<petabyte_per_second, dim_transfer_rate, petabyte, si::second> {};
struct exabyte_per_second : derived_scaled_unit<exabyte_per_second, dim_transfer_rate, exabyte, si::second> {};
struct zettabyte_per_second : derived_scaled_unit<zettabyte_per_second, dim_transfer_rate, zettabyte, si::second> {};
struct yottabyte_per_second : derived_scaled_unit<yottabyte_per_second, dim_transfer_rate, yottabyte, si::second> {};
template<typename T>
concept TransferRate = QuantityOf<T, dim_transfer_rate>;
template<UnitOf<dim_transfer_rate> U, Representation Rep = double>
using transfer_rate = quantity<dim_transfer_rate, U, Rep>;
#ifndef UNITS_NO_LITERALS
inline namespace literals {
constexpr auto operator"" _q_B_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<byte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_kB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<kilobyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_MB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<megabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_GB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<gigabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_TB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<terabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_PB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<petabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_EB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<exabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_ZB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<zettabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
constexpr auto operator"" _q_YB_per_s(unsigned long long l)
{
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
return transfer_rate<yottabyte_per_second, std::int64_t>(static_cast<std::int64_t>(l));
}
} // namespace literals
#endif // UNITS_NO_LITERALS
} // namespace units::isq::iec80000
#ifndef UNITS_NO_ALIASES
namespace units::aliases::isq::iec80000::inline transfer_rate {
template<Representation Rep = double>
using B_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::byte_per_second, Rep>;
template<Representation Rep = double>
using kB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::kilobyte_per_second, Rep>;
template<Representation Rep = double>
using MB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::megabyte_per_second, Rep>;
template<Representation Rep = double>
using GB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::gigabyte_per_second, Rep>;
template<Representation Rep = double>
using TB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::terabyte_per_second, Rep>;
template<Representation Rep = double>
using PB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::petabyte_per_second, Rep>;
template<Representation Rep = double>
using EB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::exabyte_per_second, Rep>;
template<Representation Rep = double>
using ZB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::zettabyte_per_second, Rep>;
template<Representation Rep = double>
using YB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::yottabyte_per_second, Rep>;
} // namespace units::aliases::isq::iec80000::inline transfer_rate
#endif // UNITS_NO_ALIASES