15 #ifndef LARDATAALG_UTILITIES_QUANTITIES_DATASIZE_H 16 #define LARDATAALG_UTILITIES_QUANTITIES_DATASIZE_H 22 #include <string_view> 34 static constexpr
auto symbol =
"B"sv;
35 static constexpr
auto name =
"byte"sv;
44 using kibi = std::ratio<(1LL << 10)>;
47 using mebi = std::ratio<(1LL << 20)>;
50 using gibi = std::ratio<(1LL << 30)>;
53 using tebi = std::ratio<(1LL << 40)>;
56 using pebi = std::ratio<(1LL << 50)>;
59 using exbi = std::ratio<(1LL << 60)>;
83 template <
typename R,
typename T =
unsigned long long int>
90 template <
typename T =
unsigned long long int>
94 template <
typename T =
unsigned long long int>
107 template <
typename T =
unsigned long long int>
111 template <
typename T =
unsigned long long int>
124 template <
typename T =
unsigned long long int>
128 template <
typename T =
unsigned long long int>
141 template <
typename T =
unsigned long long int>
145 template <
typename T =
unsigned long long int>
158 template <
typename T =
unsigned long long int>
162 template <
typename T =
unsigned long long int>
175 template <
typename T =
unsigned long long int>
179 template <
typename T =
unsigned long long int>
192 template <
typename T =
unsigned long long int>
196 template <
typename T =
unsigned long long int>
224 namespace datasize_literals {
228 constexpr
byte operator""_B (
long double v)
229 {
return byte{
static_cast<unsigned long long int>(v) }; }
230 constexpr
byte operator""_B (
unsigned long long int v)
231 {
return byte{ v }; }
237 {
return kibibyte{
static_cast<unsigned long long int>(v) }; }
238 constexpr
kibibyte operator""_kiB (
unsigned long long int v)
245 {
return mebibyte{
static_cast<unsigned long long int>(v) }; }
246 constexpr
mebibyte operator""_MiB (
unsigned long long int v)
253 {
return gibibyte{
static_cast<unsigned long long int>(v) }; }
254 constexpr
gibibyte operator""_GiB (
unsigned long long int v)
261 {
return tebibyte{
static_cast<unsigned long long int>(v) }; }
262 constexpr
tebibyte operator""_TiB (
unsigned long long int v)
269 {
return pebibyte{
static_cast<unsigned long long int>(v) }; }
270 constexpr
pebibyte operator""_PiB (
unsigned long long int v)
277 {
return exbibyte{
static_cast<unsigned long long int>(v) }; }
278 constexpr
exbibyte operator""_EiB (
unsigned long long int v)
301 static constexpr
auto symbol() {
return "ki"sv; }
304 static constexpr
auto name() {
return "kibi"sv; }
314 static constexpr
auto symbol() {
return "Mi"sv; }
317 static constexpr
auto name() {
return "mebi"sv; }
327 static constexpr
auto symbol() {
return "Gi"sv; }
330 static constexpr
auto name() {
return "gibi"sv; }
340 static constexpr
auto symbol() {
return "Ti"sv; }
343 static constexpr
auto name() {
return "tebi"sv; }
353 static constexpr
auto symbol() {
return "Pi"sv; }
356 static constexpr
auto name() {
return "pebi"sv; }
366 static constexpr
auto symbol() {
return "Ei"sv; }
369 static constexpr
auto name() {
return "exbi"sv; }
380 #endif // LARDATAALG_UTILITIES_QUANTITIES_DATASIZE_H
static constexpr auto name()
Returns the full name of the prefix.
static constexpr auto name()
Returns the full name of the prefix.
static constexpr auto symbol()
Returns the symbol of the prefix.
static constexpr auto symbol()
Returns the symbol of the prefix.
kibibyte_as<> kibibyte
Type of data size stored in kibibytes, in long long precision.
exbibyte_as<> exbibyte
Type of data size stored in exbibytes, in long long precision.
std::ratio<(1LL<< 60)> exbi
Factor 2^60.
std::ratio<(1LL<< 40)> tebi
Factor 2^40.
tebibyte_as<> tebibyte
Type of data size stored in tebibytes, in long long precision.
static constexpr auto symbol()
Returns the symbol of the prefix.
std::ratio<(1LL<< 30)> gibi
Factor 1'073'741'824 (2^30).
static constexpr auto symbol()
Returns the symbol of the prefix.
static constexpr auto name()
Returns the full name of the prefix.
mebibyte_as<> mebibyte
Type of data size stored in mebibytes, in long long precision.
Infrastructure for the quantities library.
A value measured in the specified unit.
std::ratio<(1LL<< 50)> pebi
Factor 2^50.
static constexpr auto symbol()
Returns the symbol of the prefix.
static constexpr auto symbol()
Returns the symbol of the prefix.
Numeric variable proxies with embedded unit of measurement.
pebibyte_as<> pebibyte
Type of data size stored in pebibytes, in long long precision.
static constexpr auto name()
Returns the full name of the prefix.
byte_as<> byte
Type of data size stored in bytes, in long long precision.
static constexpr auto name()
Returns the full name of the prefix.
gibibyte_as<> gibibyte
Type of data size stored in pebibytes, in long long precision.
Types of variables with a unit.
std::ratio<(1LL<< 10)> kibi
Factor 1'024 (2^10).
std::ratio<(1LL<< 20)> mebi
Factor 1'048'576 (2^20).
static constexpr auto name()
Returns the full name of the prefix.