#include <osval.h>
Public Methods | |
TOSVal () | |
TOSVal (const int4 iVal) | |
int4 | Value () const |
bool | Infinite () const |
bool | Maximum () const |
bool | Zero () const |
bool | Positive () const |
bool | Negative () const |
TOSVal & | operator= (const int4 iVal) |
const TOSVal | operator- (void) const |
const TOSVal | operator+ (const TOSVal &v2) const |
const TOSVal | operator- (const TOSVal &v2) const |
TOSVal & | operator+= (const TOSVal &v2) |
TOSVal & | operator-= (const TOSVal &v2) |
TOSVal | Scale (const int4 iNum, const int4 iDenom) const |
bool | operator== (const TOSVal v2) const |
bool | operator>= (const TOSVal v2) const |
bool | operator<= (const TOSVal v2) const |
bool | operator> (const TOSVal v2) const |
bool | operator< (const TOSVal v2) const |
bool | operator== (int4 v2) const |
bool | operator!= (int4 v2) const |
bool | load (TDataPackageList *in, const string &sIdentifier, bool bUnique=true) |
bool | save (TDataPackageList *out, const string &sIdentifier, bool bUnique=true) const |
Static Public Attributes | |
const int4 | iInfinity |
const int4 | iMaximum |
Private Attributes | |
int4 | iValue |
Friends | |
ostream & | operator<< (ostream &os, const TOSVal &v) |
TOSVal, Overflow-secure Value
This class is a wrapper for an integer number (int4) to prevent overflow errors from wrapping and/or messing things up.
Two "special" values are added:
Properties of the new values:
Given: value * numerator/denominator
if (value*numerator > Maximum BUT value*numerator/denominator < Maximum)
the function will try to approximate the result by preventing a multipliction overflow. The result is NOT guaranteed to be the exact value.
|
With the method Load you can load a TOSVal object from the data packages in the list. For more information look in the documentation of TLinkable.
|
|
With the method Save you can save a TOSVal object from the data packages in the list. For more information look in the documentation of TLinkable.
|