head	1.10;
access;
symbols
	r2_1:1.9
	r2_0:1.9
	r1_1_beta:1.9
	r1_1_alpha:1.8
	r1_0:1.8
	r0_11:1.8
	r0_10:1.8
	r0_9:1.8
	Eglin_alpha_1:1.8;
locks; strict;
comment	@// @;


1.10
date	94.11.30.19.29.49;	author fjsoria;	state Exp;
branches;
next	1.9;

1.9
date	94.07.25.16.58.52;	author thoth;	state Exp;
branches;
next	1.8;

1.8
date	93.05.26.16.51.26;	author thoth;	state Exp;
branches;
next	1.7;

1.7
date	93.04.19.23.27.39;	author thoth;	state Exp;
branches;
next	1.6;

1.6
date	93.02.12.16.21.24;	author thoth;	state Exp;
branches;
next	1.5;

1.5
date	93.01.20.11.35.41;	author thoth;	state Exp;
branches;
next	1.4;

1.4
date	92.12.16.14.48.04;	author thoth;	state Exp;
branches;
next	1.3;

1.3
date	92.08.23.13.30.07;	author thoth;	state Exp;
branches;
next	1.2;

1.2
date	92.08.20.11.02.30;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	92.07.16.11.51.08;	author thoth;	state Exp;
branches;
next	;


desc
@Header file for the IntPointSet HashTable
@


1.10
log
@thoth added member function for IA_HashTable to print
out the hash table
@
text
@// Emacs: -*- C++ -*-

//
//	Copyright 1993, Center for Computer Vision and Visualization,
//	University of Florida.  All rights reserved.
//


// 
// $Log: HashTable.h,v $
// Revision 1.9  1994/07/25  16:58:52  thoth
// \Name sanitization
//
// Revision 1.8  1993/05/26  16:51:26  thoth
// Copyright Notices
//
// Revision 1.7  93/04/19  23:27:39  thoth
// Convert BaseIPS to IA_BasePS<IA_IntPoint>
// 
// Revision 1.6  93/02/12  16:21:24  thoth
// more comments
// 
// Revision 1.5  93/01/20  11:35:41  thoth
// increase in hash table size should result in slight performance improvement
// 
// Revision 1.4  92/12/16  14:48:04  thoth
// conversion to IA_ mostly complete
// 
// Revision 1.3  92/08/23  13:30:07  thoth
// CFrontified version
// 
// 

#ifndef HashTable_h_
#define HashTable_h_

#ifdef IA_PRII
#pragma interface
#endif

#include "BasePS.h"
#include "IntPoint.h"

const int TBLSIZE=4095;

// HType must be a pointer
typedef IA_BasePS<IA_Point<int> >	*HType;

// a hash table that handles overflows with a linked list

class IA_HashTable {
private:
  struct link {
      link	*next;
      HType	data;
  };
  link *buckets[TBLSIZE];

public:
  IA_HashTable();
  ~IA_HashTable();
  int reference(HType in, HType *out);
/*
  passing in==0 is illegal.

  reference will search the hash table for an HType that is ->equal()
to in.  If it finds one it will store it in out and reference will
return 1.  Otherwise out will be set to in, the pointer will be stored
in the hash table and reference will return 0.

  in and out must be different variables for cleanup to be proper.

  idiom:
  if (reference(ptr, temp)) {
      delete ptr;
  }
  ... use temp
  */


  void remove(HType);
  // remove removes an entry from the hash table

  void print(ostream &o) const;
};

#endif
@


1.9
log
@\Name sanitization
@
text
@d11 3
d83 2
@


1.8
log
@Copyright Notices
@
text
@d10 4
a13 1
// $Log:	HashTable.h,v $
d44 1
a44 1
typedef IA_BasePS<IA_IntPoint>	*HType;
@


1.7
log
@Convert BaseIPS to IA_BasePS<IA_IntPoint>
@
text
@d3 6
d11 3
@


1.6
log
@more comments
@
text
@d5 3
d26 2
a27 1
#include "BaseIPS.h"
d32 1
a32 1
typedef BaseIPS	*HType;
@


1.5
log
@increase in hash table size should result in slight performance improvement
@
text
@d5 3
a28 8

#if 0
// this is how you retrieve an entry in the hash table.
struct HashTableIndex {
    int	hashed;	// which entry in the hash table?
    int	nth;	// which link in that entry?
};
#endif
@


1.4
log
@conversion to IA_ mostly complete
@
text
@d5 3
d22 1
a22 1
const int TBLSIZE=256;
@


1.3
log
@CFrontified version
@
text
@d5 2
d8 1
d24 1
d30 1
d34 1
a34 1
class HashTable {
d43 2
a44 2
  HashTable();
  ~HashTable();
@


1.2
log
@Reference counting is now the responsibility of IntPointSet
@
text
@a4 2
// Revision 1.1  92/07/16  11:51:08  thoth
// Initial revision
a5 1
// 
d10 1
d12 1
d25 1
a25 1
} index;
d38 2
a39 15
  HashTable() {
      for (int i=0; i<TBLSIZE; i++)
	  this->buckets[i] = 0;
  }
  ~HashTable() {
      for (int i=0; i<TBLSIZE; i++) {
	  link *scan=this->buckets[i];
	  while (scan) {
	      delete scan->data;
	      link *temp = scan;
	      scan = scan->next;
	      delete temp;
	  }
      }
  }
@


1.1
log
@Initial revision
@
text
@d4 3
a6 1
// $Log$
d8 1
a34 1
      int	refcount;
d59 3
a61 4
  to in.  If it finds one it will store it in out, the reference count
  will be incremented, and reference will return 1.  Otherwise out will
  be set to in, the pointer will be stored in the hash table and
  reference will return 0.
d73 2
a74 3
  void unreference(HType);
  // unreference will decrement the use count of the particular HType.
  // when the reference count reaches 0, the pointer will be deleted.
@
