Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : LIGHTHAS.H

 
Output of file : LIGHTHAS.H contained in archive : PCCAPP.ZIP
/*
* This file is part of the Choices Operating System
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989 The University of Illinois Board of Trustees.
* All Rights Reserved.
* CONFIDENTIAL INFORMATION. Distribution restricted under license agreement.
*
* Author: Aamod Sane ([email protected])
* Project Manager and Principal Investigator: Roy Campbell ([email protected])
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*/

#include "GPInclude.h"
#include "LightList.h"

#ifndef LightHashTable_h
#define LightHashTable_h

// Abstract hash table defined for SLink subclasses that have a hash()
// function. An interface can define a proper subclass and hash
// functions for numbers, strings and pointers.

class LightHashTable {
friend class HashVirtualiser;
int nextPrime( int from );
int isPrime( int number );
int divides( int divisor, int number );
protected:

// Internal classes and variables get prepended by underscore
class _lht_table {
protected:
int _numBuckets;
LightList* __table;
public:
_lht_table(LightList * _t, int _n) { __table = _t; _numBuckets = _n; };
virtual ~_lht_table();
virtual LightList* operator[](int i);
};
_lht_table* _table;

int _numBuckets;
PFSV _destructFunction; // Function called on all elements when
// destructing, if defined in ctor

// Virtualiser is used to virtualise the functions for the
// lightlist. What it actually does is to dispatch these to the
// functions defined in the hashtable. Subclasses of hashtable
// never have to bother about the virtualiser again.

class HashVirtualiser : public LightListVirtualiser {
LightHashTable* _t;
public:
HashVirtualiser( LightHashTable * h ) { _t = h; };
virtual ~HashVirtualiser() {};
virtual int compare(SLink * a, SLink * b);
virtual void destroy(SLink * a);
virtual void inspect(SLink * a);
virtual SLink * end(SLink *);
};
HashVirtualiser* _v;

virtual int hash( SLink * entry, int buckets );
virtual int compare( SLink * a, SLink * b );
virtual void deleteEntry( SLink * entry );
virtual void inspectEntry( SLink * entry );
virtual SLink * listType(SLink *);

public:
// Estimated size or nearabouts.
LightHashTable(int size, PFSV f=0);
LightHashTable(int size, PFSV f, int derived);
virtual ~LightHashTable();

// find and remove will return a pointer to the found/removed link
// resp. or 0 for failure. Note,of course, that the SLink class
// defined such a member function

virtual void insert( SLink * entry );
// For nonunique members, search for the nth element. The first
// element is 0
virtual SLink * find( SLink * entry, int n=0 );
virtual SLink * remove( SLink * entry, int n=0 );
virtual void mapcar(PFSV f); // PFSV defined in SLink.h

virtual void inspect();
};

#endif


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : LIGHTHAS.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/