HRCore V1.1.0
A High Resolution Calculation Library
|
#include <Value.hpp>
Classes | |
class | DivisionResult_t |
Type defination of division result (For Integer only). More... | |
Public Member Functions | |
Integer (Storage::Interface *ptr, bool positive=true, bool autoRelease=false, bool sim=true) | |
Construct a new Integer object. More... | |
Integer | make () |
Make a new object with same Interface type. More... | |
Integer (Integer &&c) | |
Move a Integer object. More... | |
Integer & | operator= (Integer &&c) |
Move operator. More... | |
Integer (const Integer &c) | |
Copy and construct a new Integer object. More... | |
Integer & | operator= (ival_t num) |
Reload of operator= to support a ival_t be converted to Integer. More... | |
Integer & | operator= (const Integer &c) |
Copy operator. More... | |
Integer | operator+ (const Integer &r) |
Reload of operator+. More... | |
Integer | operator- (const Integer &r) |
Reload of operator-(r) More... | |
Integer | operator* (const Integer &r) |
Reload of operator*(r) More... | |
DivisionResult_t | divideBy (const Integer &r) |
A function to calculate (*this / r) More... | |
Integer | operator/ (const Integer &r) |
Reload of operator/. More... | |
Integer | operator% (const Integer &r) |
Reload of operator%. More... | |
Integer | operator- () const |
Reload of operator-() const. More... | |
Integer | operator+ () const |
Reload of operator+() const. More... | |
bool | positive () const |
Return the sign of object. More... | |
void | positive (bool p) |
Set the sign of object. More... | |
bool | operator< (const Integer &r) |
Compare this and r with operator <. More... | |
bool | operator> (const Integer &r) |
Compare this and r with operator > More... | |
bool | operator== (const Integer &r) |
Test if (r == this) More... | |
bool | operator>= (const Integer &r) |
Test if (this >= r) More... | |
bool | operator<= (const Integer &r) |
Test if (this <= r) More... | |
Integer | operator<< (size_t n) |
Reload of << (Left shift) More... | |
Integer | operator>> (size_t n) |
Reload of >> (Logical right shift) More... | |
Static Public Member Functions | |
template<typename T > | |
static Integer | make () |
Construct a new Integer object using given type of Storage::Interface implement. More... | |
Static Protected Member Functions | |
static int8_t | _absRelation (const Integer &l, const Integer &r) |
Get relation of l and r. More... | |
static bool | _absGreater (const Integer &l, const Integer &r) |
Examine if l > r. More... | |
static bool | _absEqual (const Integer &l, const Integer &r) |
Examine if l == r. More... | |
static bool | _isZero (const Integer &l) |
Protected Attributes | |
Storage::Interface * | _idata = nullptr |
bool | _idata_ar = false |
bool | _isPostive = true |
Friends | |
std::ostream & | operator<< (std::ostream &os, Integer &rhs) |
Reload of operator<< to support std::cout and other std::ostream with Integer. More... | |
std::istream & | operator>> (std::istream &is, Integer &rhs) |
Reload of operator>> to support std::cin and other std::istream with Integer. More... | |
Integer type.
A storage class pointer is needed to construct object. Besides, a static defined construction function is provided.
|
inline |
Construct a new Integer object.
ptr | A pointer to a object of a class that implemented Storage::Interface |
positive | Decide whether the Integer object is positive or negative |
autoRelease | Specify if the ptr should be release autonomously after deconstruction |
sim | Decide if the data should be simplified first. (Internally) |
-1 | when the ptr is invalid. |
Exception::InvalidArgument | is throw when ptr is nullptr |
Definition at line 84 of file Value.hpp.
|
inline |
|
inline |
|
inlinestaticprotected |
|
inline |
A function to calculate (*this / r)
Definition at line 279 of file Value.hpp.
|
inlinestatic |
Construct a new Integer object using given type of Storage::Interface implement.
T | Type of Storage::Interface implement |
Definition at line 109 of file Value.hpp.
|
inline |
|
inline |
Reload of operator+() const.
Definition at line 377 of file Value.hpp.
|
inline |
Reload of operator-() const.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
protected |