Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TOSVal Class Reference

Wrapper for an integer number (int4) to prevent overflow errors. More...

#include <osval.h>

List of all members.

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)


Detailed Description

Wrapper for an integer number (int4) to prevent overflow errors.

Author:
Alberto Barsella, <Alberto.Barsella@univ-lille1.fr>
Version:
Id:
osval.h,v 1.5 2002/01/28 00:34:39 mkrohn5 Exp

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

Properties of the new values:

Multiplicatio Properties (Scale function)

Given: value * numerator/denominator

if ( value*numerator/denominator >= Maximum ) = Maximum

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.


Member Function Documentation

bool TOSVal::load TDataPackageList   in,
const string &    sIdentifier,
bool    bUnique = true
 

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.

Parameters:
in  the list of data packages
Returns:
true means that everything was loaded correctly, otherwise this method will return false.
See also:
TLinkable

bool TOSVal::save TDataPackageList   out,
const string &    sIdentifier,
bool    bUnique = true
const
 

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.

Parameters:
in  the list of data packages
Returns:
true means that everything was saved correctly, otherwise this method will return false.
See also:
TLinkable


The documentation for this class was generated from the following file:
Generated on Thu Jun 20 18:13:28 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001