WWC snapshot of http://www.alw.nih.gov/Docs/NIHCL/nihcl_18.html taken on Sat Jun 10 19:13:43 1995

Go to the previous, next section.

Integer--Integer Number Object

SYNOPSIS

#include <nihcl/Integer.h>

BASE CLASS

Object

DERIVED CLASSES

None

RELATED CLASSES

AssocInt

DESCRIPTION

Class Integer provides an NIH Class Library object to hold an integer number. This is useful, for example, if one wishes to associate a key object with an integer and store it in a Dictionary. Arithmetic operations on Integer objects have not been provided to discourage their use, due to their relative inefficiency.

CONSTRUCTORS

Integer(long value =0)
Constructs an instance of class Integer with the value value.

Integer(istream& strm)
Constructs an instance of class Integer with the value read from the input stream strm with istream::operator>>().

ACCESSING INTEGERS

long value() const
Returns the value of this Integer.

long value(long newValue)
Sets this Integer to newValue and returns newValue.

SEARCHING

virtual unsigned hash() const
Returns a number suitable for use as a hash table probe.

COMPARING INTEGERS

virtual int compare(const Object& ob) const
Compares this Integer with the argument object ob, which must also be an instance of class Integer. Returns a negative result if this Integer is less than ob, zero if this Integer equals ob, and a positive result if this Integer is greater than ob.

TESTING INTEGERS

virtual bool isEqual(const Object& ob) const
Returns YES if ob is of species Integer and equals this Integer.

COPYING INTEGERS

virtual void deepenShallowCopy()
This function is a no-op for class Integer.

READING AND PRINTING INTEGERS

virtual void printOn(ostream& strm =cout) const
Prints this Integer on output stream strm using ostream::operator<<().

virtual void scanFrom(istream& strm)
Assigns the value of this Integer to the value obtained by reading the input stream strm with istream::operator>>().

INTEGER SPECIES

virtual const Class* species() const
Returns a pointer to the class descriptor for class Integer.

PROTECTED MEMBERS

Object I/O

virtual void storer(OIOofd& fd) const
virtual void storer(OIOout& strm) const
Stores this Integer on fd or strm.

EXCEPTIONS RAISED

None

Go to the previous, next section.