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 
20 /**
21  * This class generates an arbitrary hash number from a sequence of ints.
22  */
23 class EXPCL_DIRECT_DCPARSER HashGenerator {
24 public:
25  HashGenerator();
26 
27  void add_int(int num);
28  void add_string(const std::string &str);
29  void add_blob(const vector_uchar &bytes);
30 
31  unsigned long get_hash() const;
32 
33 private:
34  long _hash;
35  int _index;
36  PrimeNumberGenerator _primes;
37 };
38 
39 #endif
This class generates an arbitrary hash number from a sequence of ints.
Definition: hashGenerator.h:23
This class generates a table of prime numbers, up to the limit of an int.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.