COVISE Core
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
19namespace covise
20{
21
22template <class DATA>
23class coIntHash : public coHash<int, DATA>
24{
25
26public:
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
35private:
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
GLsizeiptr size
Definition: khronos-glext.h:6610
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: khronos-glext.h:11877
list of all chemical elements
Definition: coConfig.h:27
Definition: coHash.h:32
Definition: coIntHash.h:24
virtual unsigned long hash1(const int &key) const
1st Hash function
Definition: coIntHash.h:37
coIntHash()
Definition: coIntHash.h:32
virtual bool equal(const int &key1, const int &key2) const
Equal function.
Definition: coIntHash.h:49
virtual unsigned long hash2(const int &key) const
2nd Hash function
Definition: coIntHash.h:43
coIntHash(const DATA &nullelem)
Definition: coIntHash.h:28