JODA
0.13.1 (59b41972)
JSON On-Demand Analysis
|
#include <MemoryUtility.h>
Public Types | |
enum | SIZE { B = 0 , KB = 1 , MB = 2 , GB = 3 , TB = 4 , PB = 5 , EB = 6 } |
Public Member Functions | |
MemorySize (const MemoryT bytes) | |
MemoryT | getBytes () const |
MemoryT | getBase (const int base=SIZE::B) const |
MemoryT | getBaseSI (const int base=SIZE::B) const |
double | getFBase (const int base=SIZE::B) const |
double | getFBaseSI (const int base=SIZE::B) const |
std::string | getHumanReadable () const |
std::string | getHumanReadableSI () const |
Static Public Member Functions | |
static MemoryT | convertToBytes (const MemoryT xbytes, const int powerOfThousand=SIZE::B) |
static MemoryT | convertToBytesSI (const MemoryT xbytes, const int powerOfThousand=SIZE::B) |
This class represents a memory size. It stores the size in byte form, but is able to convert into all representations.
MemoryUtility::MemorySize::MemorySize | ( | const MemoryT | bytes | ) |
Initializes a memory size with a number of bytes.
bytes | The number of bytes |
|
static |
Converts a memory size that is stored in a different power of ten to bytes.
xbytes | the number of <powerOfThousand>bytes to convert |
powerOfThousand | The power of thousand of the input |
|
static |
Converts a memory size that is stored in a different power of ten (SI) to bytes.
xbytes | the number of <powerOfThousand>bytes (SI) to convert |
powerOfThousand | The power of thousand of the input |
MemoryUtility::MemoryT MemoryUtility::MemorySize::getBase | ( | const int | base = SIZE::B | ) | const |
Returns the number of Xbytes of the memory representation with the given base
base | The power of ten of the required output. |
MemoryUtility::MemoryT MemoryUtility::MemorySize::getBaseSI | ( | const int | base = SIZE::B | ) | const |
Returns the number of Xbytes of the memory representation with the given base in SI notation
base | The power of ten of the required output. |
MemoryUtility::MemoryT MemoryUtility::MemorySize::getBytes | ( | ) | const |
Returns the number of bytes of the memory representation
double MemoryUtility::MemorySize::getFBase | ( | const int | base = SIZE::B | ) | const |
Returns the number of Xbytes of the memory representation with the given base
base | The power of ten of the required output. |
double MemoryUtility::MemorySize::getFBaseSI | ( | const int | base = SIZE::B | ) | const |
Returns the number of Xbytes of the memory representation with the given base in SI notation
base | The power of ten of the required output. |
std::string MemoryUtility::MemorySize::getHumanReadable | ( | ) | const |
Returns a human readable string of the memory size. Uses a maximum of two playes after the comma.
std::string MemoryUtility::MemorySize::getHumanReadableSI | ( | ) | const |
Returns a human readable string of the memory size in SI. Uses a maximum of two playes after the comma.