Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Comparable Class Reference

An Object that can be compared, for sorting purposes, etc. More...

#include <mobject.h>

Inheritance diagram for Comparable::

Object Float Int MagiC::String List of all members.

Public Methods

 Comparable ()
virtual int hashfunc (int hashsize) const
virtual int operator== (const Comparable &other) const=0
virtual int compare (const Comparable &other) const

Detailed Description

An Object that can be compared, for sorting purposes, etc.

It has also a hash function for hashing.

Definition at line 277 of file mobject.h.


Member Function Documentation

int compare ( const Comparable & other ) const [inline, virtual]
 

This should be overloaded to enable quicksorting of the inheritor.

Definition at line 297 of file mobject.h.

int hashfunc ( int hashsize ) const [inline, virtual]
 

Hash function.

Inheritors should overload this if they want to be used as a key in Map, etc.

Returns:
Hash value.
Parameters:
hashsize   Hash size.

Reimplemented in Int, and MagiC::String.

Definition at line 289 of file mobject.h.

int operator== ( const Comparable & other ) const [pure virtual]
 

Equality comparison.

Must be overloaded.

Reimplemented in Int, Float, and MagiC::String.


The documentation for this class was generated from the following file:
Generated at Tue Dec 4 19:53:28 2001 for MagiC++ by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001