Panda3D
hashGenerator.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file hashGenerator.h
10  * @author drose
11  * @date 2001-03-22
12  */
13 
14 #ifndef DCHASHGENERATOR_H
15 #define DCHASHGENERATOR_H
16 
17 #include "dcbase.h"
18 #include "primeNumberGenerator.h"
19 #include "vector_uchar.h"
20 
21 /**
22  * This class generates an arbitrary hash number from a sequence of ints.
23  */
24 class EXPCL_DIRECT_DCPARSER HashGenerator {
25 public:
26  HashGenerator();
27 
28  void add_int(int num);
29  void add_string(const std::string &str);
30  void add_blob(const vector_uchar &bytes);
31 
32  unsigned long get_hash() const;
33 
34 private:
35  long _hash;
36  int _index;
37  PrimeNumberGenerator _primes;
38 };
39 
40 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class generates a table of prime numbers, up to the limit of an int.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class generates an arbitrary hash number from a sequence of ints.
Definition: hashGenerator.h:24