COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coIntHash.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef _CO_INT_HASH_H_
9 #define _CO_INT_HASH_H_
10 
11 #include "coHash.h"
12 
13 // 24.02.98
14 
19 namespace covise
20 {
21 
22 template <class DATA>
23 class coIntHash : public coHash<int, DATA>
24 {
25 
26 public:
27  // constructor with NULL element
28  coIntHash(const DATA &nullelem)
29  : coHash<int, DATA>(nullelem){};
30 
31  // constructor without NULL element
33  : coHash<int, DATA>(){};
34 
35 private:
37  virtual unsigned long hash1(const int &key) const
38  {
39  return (key % this->size);
40  }
41 
43  virtual unsigned long hash2(const int &key) const
44  {
45  return (this->size - 2 - key % (this->size - 2));
46  }
47 
49  virtual bool equal(const int &key1, const int &key2) const
50  {
51  return (key1 == key2);
52  }
53 };
54 }
55 #endif
coIntHash(const DATA &nullelem)
Definition: coIntHash.h:28
virtual unsigned long hash1(const int &key) const
1st Hash function
Definition: coIntHash.h:37
Definition: coHash.h:31
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: khronos-glext.h:11877
GLsizeiptr size
Definition: khronos-glext.h:6610
coIntHash()
Definition: coIntHash.h:32
virtual unsigned long hash2(const int &key) const
2nd Hash function
Definition: coIntHash.h:43
Definition: coIntHash.h:23
virtual bool equal(const int &key1, const int &key2) const
Equal function.
Definition: coIntHash.h:49