BytesValue Class Reference

#include <bytesvalue.h>

Inheritance diagram for BytesValue:

Detailed Description

The BytesValue class encapsulates the byte size.

Public Member Functions

 BytesValue ()
 
 BytesValue (const BytesValue &src)
 
BytesValueoperator= (const BytesValue &src)
 
Bool operator== (const BytesValue b) const
 
Bool operator< (const BytesValue b) const
 
BytesValue operator+ (const BytesValue b) const
 
BytesValueoperator+= (const BytesValue b)
 
BytesValue operator- (const BytesValue b) const
 
const BytesValueoperator-= (const BytesValue b)
 
Bool operator>= (const BytesValue b)
 
Bool operator<= (const BytesValue b)
 
Bool operator> (const BytesValue b)
 
Bool operator< (const BytesValue b)
 
Bool operator>= (const Int64 b)
 
Bool operator<= (const Int64 b)
 
Bool operator> (const Int64 b)
 
Bool operator< (const Int64 b)
 
 operator Int64 () const
 
BytesValueoperator*= (const Int64 b)
 
Int64 GetBits () const
 
Int64 GetBytes () const
 
void SetBytes (Int64 bytes)
 
Float32 GetKilobytes () const
 
Float32 GetKibibytes () const
 
Float32 GetMegabytes () const
 
Float32 GetMebibytes () const
 
Float32 GetGigabytes () const
 
Float32 GetGibibytes () const
 
Float32 GetTerabytes () const
 
Float32 GetTebibytes () const
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
HashInt GetHashCode () const
 

Static Public Member Functions

static Result< void > DescribeIO (const DataSerializeInterface &stream)
 

Protected Member Functions

 BytesValue (Int64 bytes)
 

Private Attributes

Int64 _value
 

Friends

BytesValue operator* (const BytesValue a, const Int64 b)
 
Int64 operator/ (const BytesValue a, const BytesValue b)
 
BytesValue operator/ (const BytesValue a, const Int64 b)
 

Constructor & Destructor Documentation

◆ BytesValue() [1/3]

Default constructor.

◆ BytesValue() [2/3]

BytesValue ( const BytesValue src)

Default constructor.

◆ BytesValue() [3/3]

BytesValue ( Int64  bytes)
explicitprotected

Member Function Documentation

◆ operator=()

BytesValue& operator= ( const BytesValue src)

Assignment operator.

◆ operator==()

Bool operator== ( const BytesValue  b) const

Compares two BytesValue.

◆ operator<() [1/3]

Bool operator< ( const BytesValue  b) const

Compares two BytesValue.

◆ operator+()

BytesValue operator+ ( const BytesValue  b) const

Adds two BytesValue.

◆ operator+=()

BytesValue& operator+= ( const BytesValue  b)

Adds two BytesValue.

◆ operator-()

BytesValue operator- ( const BytesValue  b) const

Subtracts two BytesValue.

◆ operator-=()

const BytesValue& operator-= ( const BytesValue  b)

Subtracts two BytesValue.

◆ operator>=() [1/2]

Bool operator>= ( const BytesValue  b)

Compares two BytesValue.

◆ operator<=() [1/2]

Bool operator<= ( const BytesValue  b)

Compares two BytesValue.

◆ operator>() [1/2]

Bool operator> ( const BytesValue  b)

Compares two BytesValue.

◆ operator<() [2/3]

Bool operator< ( const BytesValue  b)

Compares two BytesValue.

◆ operator>=() [2/2]

Bool operator>= ( const Int64  b)

Compares the BytesValue with an Int64.

◆ operator<=() [2/2]

Bool operator<= ( const Int64  b)

Compares the BytesValue with an Int64.

◆ operator>() [2/2]

Bool operator> ( const Int64  b)

Compares the BytesValue with an Int64.

◆ operator<() [3/3]

Bool operator< ( const Int64  b)

Compares the BytesValue with an Int64.

◆ operator Int64()

operator Int64 ( ) const

◆ operator*=()

BytesValue& operator*= ( const Int64  b)

Multiplies a BytesValue with a factor.

Parameters
[in]bThe second factor.
Returns
The result of this * b.

◆ GetBits()

Int64 GetBits ( ) const

Return the number of bits.

Returns
value in bits

◆ GetBytes()

Int64 GetBytes ( ) const

Get the BytesValue

Returns
value in bytes

◆ SetBytes()

void SetBytes ( Int64  bytes)

Set the BytesValue

Parameters
[in]bytesbyte value

◆ GetKilobytes()

Float32 GetKilobytes ( ) const

Get the BytesValue

Returns
value in kilobytes (KB)

◆ GetKibibytes()

Float32 GetKibibytes ( ) const

Get the BytesValue

Returns
value in kibibytes (KiB)

◆ GetMegabytes()

Float32 GetMegabytes ( ) const

Get the BytesValue

Returns
value in megabytes (MB)

◆ GetMebibytes()

Float32 GetMebibytes ( ) const

Get the BytesValue

Returns
value in mebibytes (MiB)

◆ GetGigabytes()

Float32 GetGigabytes ( ) const

Get the BytesValue

Returns
value in gigabytes (GB)

◆ GetGibibytes()

Float32 GetGibibytes ( ) const

Get the BytesValue

Returns
value in gibibytes (GiB)

◆ GetTerabytes()

Float32 GetTerabytes ( ) const

Get the BytesValue

Returns
value in terrabytes (TB)

◆ GetTebibytes()

Float32 GetTebibytes ( ) const

Get the BytesValue

Returns
value in tebibytes (TiB)

◆ ToString()

String ToString ( const FormatStatement formatStatement = nullptr) const

Converts the value into a string.

Parameters
[in]formatStatementNullptr or an additional formatting instruction. See also Formatting Timer values.
Returns
The converted result.

◆ GetHashCode()

HashInt GetHashCode ( ) const

◆ DescribeIO()

static Result<void> DescribeIO ( const DataSerializeInterface stream)
static

Describe all elements of this class for I/O operations.

Parameters
[in]streamThe stream that is used to register the class members.
Returns
OK on success.

Friends And Related Function Documentation

◆ operator*

BytesValue operator* ( const BytesValue  a,
const Int64  b 
)
friend

Multiplies a BytesValue with a factor.

Parameters
[in]aThe first factor.
[in]bThe second factor.
Returns
The result of a * b.

◆ operator/ [1/2]

Int64 operator/ ( const BytesValue  a,
const BytesValue  b 
)
friend

Divides two BytesValue and returns the quotient.

Parameters
[in]aThe dividend.
[in]bThe divisor. If the divisor is 0, the result will be undefined (floating point exception).
Returns
The result of a / b, the quotient has unit therefore it is returned as Int64.

◆ operator/ [2/2]

BytesValue operator/ ( const BytesValue  a,
const Int64  b 
)
friend

Divides a BytesValue by a scalar and returns the quotient.

Parameters
[in]aThe dividend.
[in]bThe divisor. If the divisor is 0, the result will be undefined (floating point exception).
Returns
The result of a / b.

Member Data Documentation

◆ _value

Int64 _value
private