JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Types | Public Member Functions | Static Public Member Functions
MemoryUtility::MemorySize Class Reference

#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)
 

Detailed Description

This class represents a memory size. It stores the size in byte form, but is able to convert into all representations.

Member Enumeration Documentation

◆ SIZE

Most commenly used memory sizes mapped to their power of ten.

Enumerator
KB 
MB 
GB 
TB 
PB 
EB 

Constructor & Destructor Documentation

◆ MemorySize()

MemoryUtility::MemorySize::MemorySize ( const MemoryT  bytes)

Initializes a memory size with a number of bytes.

Parameters
bytesThe number of bytes

Member Function Documentation

◆ convertToBytes()

MemoryUtility::MemoryT MemoryUtility::MemorySize::convertToBytes ( const MemoryT  xbytes,
const int  powerOfThousand = SIZE::B 
)
static

Converts a memory size that is stored in a different power of ten to bytes.

Parameters
xbytesthe number of <powerOfThousand>bytes to convert
powerOfThousandThe power of thousand of the input
Returns
The number of bytes.
Here is the caller graph for this function:

◆ convertToBytesSI()

MemoryUtility::MemoryT MemoryUtility::MemorySize::convertToBytesSI ( const MemoryT  xbytes,
const int  powerOfThousand = SIZE::B 
)
static

Converts a memory size that is stored in a different power of ten (SI) to bytes.

Parameters
xbytesthe number of <powerOfThousand>bytes (SI) to convert
powerOfThousandThe power of thousand of the input
Returns
The number of bytes.

◆ getBase()

MemoryUtility::MemoryT MemoryUtility::MemorySize::getBase ( const int  base = SIZE::B) const

Returns the number of Xbytes of the memory representation with the given base

Parameters
baseThe power of ten of the required output.
Returns
The number of Xbytes

◆ getBaseSI()

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

Parameters
baseThe power of ten of the required output.
Returns
The number of SI Xbytes

◆ getBytes()

MemoryUtility::MemoryT MemoryUtility::MemorySize::getBytes ( ) const

Returns the number of bytes of the memory representation

Here is the caller graph for this function:

◆ getFBase()

double MemoryUtility::MemorySize::getFBase ( const int  base = SIZE::B) const

Returns the number of Xbytes of the memory representation with the given base

Parameters
baseThe power of ten of the required output.
Returns
The number of Xbytes

◆ getFBaseSI()

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

Parameters
baseThe power of ten of the required output.
Returns
The number of SI Xbytes

◆ getHumanReadable()

std::string MemoryUtility::MemorySize::getHumanReadable ( ) const

Returns a human readable string of the memory size. Uses a maximum of two playes after the comma.

Returns
a human readable string of the memory size
Here is the caller graph for this function:

◆ getHumanReadableSI()

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.

Returns
a human readable string of the memory size

The documentation for this class was generated from the following files: