Represents the size of an allocation in different units. More...
#include <allocation_size.h>
Public Member Functions | |
constexpr | AllocationSize ()=default |
Create a zero allocation size. More... | |
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>> | |
constexpr | AllocationSize (T size) |
Create an allocation size with the amount in the Period number of bytes. More... | |
template<size_t OtherPeriod> | |
constexpr | AllocationSize (const AllocationSize< OtherPeriod > &other) |
Create an allocation size from another instance with a different period. More... | |
constexpr | AllocationSize (uint64_t byte_size, FromBytesTag) |
Create an allocation size with the amount directly specified in bytes. More... | |
constexpr uint64_t | GetByteSize () const |
constexpr double | GetSize () const |
template<class AllocationSize > | |
constexpr AllocationSize | ConvertTo () |
Convert the allocation size from one unit to another. More... | |
constexpr bool | operator< (const AllocationSize &other) const |
constexpr bool | operator> (const AllocationSize &other) const |
constexpr bool | operator>= (const AllocationSize &other) const |
constexpr bool | operator<= (const AllocationSize &other) const |
constexpr bool | operator== (const AllocationSize &other) const |
constexpr bool | operator!= (const AllocationSize &other) const |
constexpr | operator bool () const |
constexpr AllocationSize | operator+ (const AllocationSize &other) const |
constexpr AllocationSize | operator- (const AllocationSize &other) const |
constexpr AllocationSize & | operator+= (const AllocationSize &other) |
constexpr AllocationSize & | operator-= (const AllocationSize &other) |
Represents the size of an allocation in different units.
Refer to the typedefs for Bytes, KiloBytes, MegaBytes, Gigabytes, KibiBytes, MebiBytes, and GibiBytes below when using. Storage and all operations are always on unsigned units of bytes.
Period | The number of bytes in 1 unit of the allocation size. |
Definition at line 29 of file allocation_size.h.
|
constexprdefault |
Create a zero allocation size.
Referenced by impeller::AllocationSize< Period >::operator+(), and impeller::AllocationSize< Period >::operator-().
|
inlineexplicitconstexpr |
Create an allocation size with the amount in the Period
number of bytes.
[in] | size | The size in Period number of bytes. |
Definition at line 43 of file allocation_size.h.
|
inlineexplicitconstexpr |
Create an allocation size from another instance with a different period.
[in] | other | The other allocation size. |
OtherPeriod | The period of the other allocation. |
Definition at line 55 of file allocation_size.h.
|
inlineconstexpr |
Create an allocation size with the amount directly specified in bytes.
[in] | byte_size | The byte size. |
[in] | tag | A tag for this constructor. |
Definition at line 65 of file allocation_size.h.
|
inlineconstexpr |
Convert the allocation size from one unit to another.
Conversions are non-truncating.
AllocationSize | The allocation size to convert to. |
Definition at line 90 of file allocation_size.h.
References impeller::AllocationSize< Period >::GetByteSize(), and impeller::kFromBytes.
|
inlineconstexpr |
Definition at line 71 of file allocation_size.h.
Referenced by impeller::AllocationSize< Period >::ConvertTo(), impeller::CreateMappingWithCopy(), impeller::AllocationSize< Period >::GetSize(), impeller::AllocationSize< Period >::operator+(), impeller::AllocationSize< Period >::operator+=(), impeller::AllocationSize< Period >::operator-(), impeller::AllocationSize< Period >::operator-=(), and impeller::testing::TEST().
|
inlineconstexpr |
Periods
of bytes. Definition at line 76 of file allocation_size.h.
References impeller::AllocationSize< Period >::GetByteSize().
Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineexplicitconstexpr |
Definition at line 123 of file allocation_size.h.
|
inlineconstexpr |
Definition at line 117 of file allocation_size.h.
|
inlineconstexpr |
Definition at line 127 of file allocation_size.h.
References impeller::AllocationSize< Period >::AllocationSize(), impeller::AllocationSize< Period >::GetByteSize(), and impeller::kFromBytes.
|
inlineconstexpr |
Definition at line 137 of file allocation_size.h.
References impeller::AllocationSize< Period >::GetByteSize().
|
inlineconstexpr |
Definition at line 132 of file allocation_size.h.
References impeller::AllocationSize< Period >::AllocationSize(), impeller::AllocationSize< Period >::GetByteSize(), and impeller::kFromBytes.
|
inlineconstexpr |
Definition at line 142 of file allocation_size.h.
References impeller::AllocationSize< Period >::GetByteSize().
|
inlineconstexpr |
Definition at line 97 of file allocation_size.h.
|
inlineconstexpr |
Definition at line 109 of file allocation_size.h.
|
inlineconstexpr |
Definition at line 113 of file allocation_size.h.
|
inlineconstexpr |
Definition at line 101 of file allocation_size.h.
|
inlineconstexpr |
Definition at line 105 of file allocation_size.h.