mace::MaceKeyDiff Class Reference

#include <MaceKey.h>

Inheritance diagram for mace::MaceKeyDiff:

Inheritance graph
[legend]
Collaboration diagram for mace::MaceKeyDiff:

Collaboration graph
[legend]

List of all members.


Detailed Description

A class to represent the difference between two bit array MaceKey objects (big integers). (like TimeDiff in other languages).

Definition at line 1076 of file MaceKey.h.


Public Member Functions

int sign ()
 returns the sign of the MaceKeyDiff
bool isPositive ()
 Returns sign() > 0.
bool isNegative ()
 Returns sign() < 0.
bool isZero ()
 Returns sign() == 0.
MaceKeyDiffabs ()
 modifies *this to be its unsigned value.
MaceKeyDifftoSigned ()
 modifies *this to be signed.
MaceKeyDifftoUnsigned ()
 modifies *this to be unsigned.
MaceKeyDiffoperator= (const MaceKeyDiff &)
 standard assignment
bool operator< (const MaceKeyDiff &) const
 standard less than
bool operator> (const MaceKeyDiff &right) const
 standard greater than
bool operator== (const MaceKeyDiff &) const
 standard equality check
bool operator<= (const MaceKeyDiff &right) const
 standard less than or equal
bool operator>= (const MaceKeyDiff &right) const
 standard greater than or equal
MaceKeyDiff operator>> (int bits) const
 standard bit shifting
MaceKeyDiff operator+ (const MaceKeyDiff &) const
 add a MaceKeyDiff to another
MaceKeyDiff operator- (const MaceKeyDiff &) const
 subtract a MaceKeyDiff from another
MaceKeyDiff operator+ (uint32_t) const
 add an unsigned int to a MaceKeyDiff
MaceKeyDiff operator- (uint32_t) const
 subtract an unsigned int from a MaceKeyDiff

Static Public Attributes

static MaceKeyDiff NEG_INF = mace::MaceKeyDiff(_NEG_INFINITY)
 basic helper for a NEG_INF MaceKeyDiff
static MaceKeyDiff INF = mace::MaceKeyDiff(_INFINITY)
 basic helper for an INF MaceKeyDiff

Friends

MaceKey operator- (const MaceKey &to, const MaceKeyDiff &from) throw (InvalidMaceKeyException)
 subtracts a MaceKeyDiff from a MaceKey
MaceKey operator+ (const MaceKey &to, const MaceKeyDiff &from) throw (InvalidMaceKeyException)
 adds a MaceKeyDiff to a MaceKey

Member Function Documentation

int mace::MaceKeyDiff::sign (  ) 

returns the sign of the MaceKeyDiff

Note: unsigned diffs can only return 1 or 0.

Returns:
-1, 0, or 1, depending on sign of value.

Definition at line 286 of file MaceKey.cc.

Referenced by abs(), isNegative(), isPositive(), isZero(), operator<(), and operator<=().

MaceKeyDiff & mace::MaceKeyDiff::abs (  ) 

modifies *this to be its unsigned value.

No-op for 0, inf, or unsigned diffs. -inf becomes +inf. For signed values, do nothing if sign() >= 0, otherwise do complement plus one.

Returns:
reference to *this

Definition at line 299 of file MaceKey.cc.

References sign().

MaceKeyDiff& mace::MaceKeyDiff::toSigned (  )  [inline]

modifies *this to be signed.

Note: no-op unless type is unsigned, then set type to signed. No content changes. It's like a cast.

Returns:
reference to *this

Definition at line 1122 of file MaceKey.h.

Referenced by operator<(), and operator<=().

MaceKeyDiff& mace::MaceKeyDiff::toUnsigned (  )  [inline]

modifies *this to be unsigned.

Note: no-op unless type is signed, then set type to unsigned. No content changes. It's like a cast.

Todo:
Check if -inf should be changed?
Returns:
reference to *this

Definition at line 1136 of file MaceKey.h.


The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:39 2008 for Mace Library by  doxygen 1.5.5