semf
semf::BigEndianInteger< T > Class Template Reference

Class for representing big-endian numbers. More...

#include <bigendianinteger.h>

Collaboration diagram for semf::BigEndianInteger< T >:
Collaboration graph

Public Member Functions

constexpr BigEndianInteger (T value)
 Constructor. More...
 
virtual ~BigEndianInteger ()=default
 
native () const
 Returns a native representation of the stored number. More...
 
bool operator!= (BigEndianInteger< T > other) const
 Check if this and other are unequal. More...
 
BigEndianInteger< T > & operator%= (T i)
 Calculates the modulo. More...
 
BigEndianInteger< T > & operator&= (T i)
 Performs a bitwise AND. More...
 
BigEndianInteger< T > & operator*= (T i)
 Performs a multiplication. More...
 
BigEndianInteger< T > & operator++ ()
 Increments this (prefix) and returns a reference to this. More...
 
BigEndianInteger< T > & operator++ (int i)
 Increments this (postfix) and returns a reference to this. More...
 
BigEndianInteger< T > & operator+= (T i)
 Performs an addition. More...
 
BigEndianInteger< T > & operator-- ()
 Decrements this (prefix) and returns a reference to this. More...
 
BigEndianInteger< T > & operator-- (int i)
 Decrements this (postfix) and returns a reference to this. More...
 
BigEndianInteger< T > & operator-= (T i)
 Performs a subtraction. More...
 
BigEndianInteger< T > & operator/= (T i)
 Performs a division. More...
 
BigEndianInteger< T > & operator<<= (T i)
 Shift i bits left. More...
 
BigEndianInteger< T > & operator= (T i)
 Assigns this with the value i. More...
 
BigEndianInteger< T > & operator^= (T i)
 Performs a bitwise XOR. More...
 
bool operator== (BigEndianInteger< T > other) const
 Checks for equality between this and other. More...
 
BigEndianInteger< T > & operator>>= (T i)
 Shift i bits right. More...
 
BigEndianInteger< T > & operator|= (T i)
 Performs a bitwise OR. More...
 

Static Public Member Functions

static BigEndianInteger< T > max ()
 Returns the maximum (finite) value representable by the numeric type T. More...
 
static BigEndianInteger< T > min ()
 Returns the minimum (finite) value representable by the numeric type T. More...
 

Detailed Description

template<typename T>
class semf::BigEndianInteger< T >

Class for representing big-endian numbers.

Template Parameters
TNative type of the number.

Definition at line 33 of file bigendianinteger.h.

Constructor & Destructor Documentation

◆ BigEndianInteger()

template<typename T >
constexpr semf::BigEndianInteger< T >::BigEndianInteger ( value)
constexpr

Constructor.

Parameters
valueValue of the number.

Definition at line 172 of file bigendianinteger.h.

◆ ~BigEndianInteger()

template<typename T >
virtual semf::BigEndianInteger< T >::~BigEndianInteger ( )
virtualdefault

Member Function Documentation

◆ max()

template<typename T >
BigEndianInteger< T > semf::BigEndianInteger< T >::max
static

Returns the maximum (finite) value representable by the numeric type T.

Returns
Maximum (finite) value.

Definition at line 178 of file bigendianinteger.h.

◆ min()

template<typename T >
BigEndianInteger< T > semf::BigEndianInteger< T >::min
static

Returns the minimum (finite) value representable by the numeric type T.

Returns
Minimum (finite) value.

Definition at line 185 of file bigendianinteger.h.

◆ native()

template<typename T >
T semf::BigEndianInteger< T >::native

Returns a native representation of the stored number.

Returns
Native representation of the stored number.

Definition at line 192 of file bigendianinteger.h.

◆ operator!=()

template<typename T >
bool semf::BigEndianInteger< T >::operator!= ( BigEndianInteger< T >  other) const

Check if this and other are unequal.

Parameters
otherOther number.
Returns
true if unequal.

Definition at line 203 of file bigendianinteger.h.

◆ operator%=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator%= ( i)

Calculates the modulo.

Parameters
iDivisor.
Returns
Reference to this.

Definition at line 209 of file bigendianinteger.h.

◆ operator&=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator&= ( i)

Performs a bitwise AND.

Parameters
iOther number.
Returns
Reference to this.

Definition at line 228 of file bigendianinteger.h.

◆ operator*=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator*= ( i)

Performs a multiplication.

Parameters
iOther number.
Returns
Reference to this.

Definition at line 237 of file bigendianinteger.h.

◆ operator++() [1/2]

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator++

Increments this (prefix) and returns a reference to this.

Returns
Reference to this.

Definition at line 246 of file bigendianinteger.h.

◆ operator++() [2/2]

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator++ ( int  i)

Increments this (postfix) and returns a reference to this.

Parameters
iNumber 1.
Note
This operator overload has the same behavior as the prefix operator.
Returns
Reference to this.

Definition at line 255 of file bigendianinteger.h.

◆ operator+=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator+= ( i)

Performs an addition.

Parameters
iOther number.
Returns
Reference to this.

Definition at line 262 of file bigendianinteger.h.

◆ operator--() [1/2]

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator--

Decrements this (prefix) and returns a reference to this.

Returns
Reference to this.

Definition at line 271 of file bigendianinteger.h.

◆ operator--() [2/2]

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator-- ( int  i)

Decrements this (postfix) and returns a reference to this.

Note
This operator overload has the same behavior as the prefix operator.
Parameters
iNumber 1.
Returns
Reference to this.

Definition at line 280 of file bigendianinteger.h.

◆ operator-=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator-= ( i)

Performs a subtraction.

Parameters
iSubtrahend.
Returns
Reference to this.

Definition at line 287 of file bigendianinteger.h.

◆ operator/=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator/= ( i)

Performs a division.

Parameters
iDivisor.
Returns
Reference to this.

Definition at line 296 of file bigendianinteger.h.

◆ operator<<=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator<<= ( i)

Shift i bits left.

Parameters
iBits to shift.
Returns
Reference to this.

Definition at line 296 of file bigendianinteger.h.

◆ operator=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator= ( i)

Assigns this with the value i.

Parameters
iValue to assign.
Returns
Reference to *this.

Definition at line 314 of file bigendianinteger.h.

◆ operator==()

template<typename T >
bool semf::BigEndianInteger< T >::operator== ( BigEndianInteger< T >  other) const

Checks for equality between this and other.

Parameters
otherNumber to compare to.
Returns
true if equal.

Definition at line 321 of file bigendianinteger.h.

◆ operator>>=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator>>= ( i)

Shift i bits right.

Parameters
iBits to shift.
Returns
Reference to this.

Definition at line 327 of file bigendianinteger.h.

◆ operator^=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator^= ( i)

Performs a bitwise XOR.

Parameters
iOther number.
Returns
Reference to this.

Definition at line 336 of file bigendianinteger.h.

◆ operator|=()

template<typename T >
BigEndianInteger< T > & semf::BigEndianInteger< T >::operator|= ( i)

Performs a bitwise OR.

Parameters
iOther number.
Returns
Reference to this.

Definition at line 345 of file bigendianinteger.h.