Jpp
JHashEvaluator.hh
Go to the documentation of this file.
1 #ifndef __JTOOLS__JHASHEVALUATOR__
2 #define __JTOOLS__JHASHEVALUATOR__
3 
4 
5 /**
6  * \author mdejong
7  */
8 
9 namespace JTOOLS {}
10 namespace JPP { using namespace JTOOLS; }
11 
12 namespace JTOOLS {
13 
14  /**
15  * Auxiliary class for default hash key evaluation.
16  *
17  * For a composite hash key, the following policy member method should be provided.
18  * <pre>
19  * int %getID() const;
20  * </pre>
21  *
22  * For integral primitive data types, the hash value is obtained by a simple cast to an <tt>int</tt> value.
23  */
24  struct JHashEvaluator {
25  /**
26  * Get hash value.
27  *
28  * \param key key
29  * \return hash value
30  */
31  template<class JKey_t>
32  inline int operator()(const JKey_t& key) const
33  {
34  return key.getID();
35  }
36 
37  inline int operator()(const char key) const { return (int) key; } //!< Get hash value.
38  inline int operator()(const unsigned char key) const { return (int) key; } //!< Get hash value.
39  inline int operator()(const short key) const { return (int) key; } //!< Get hash value.
40  inline int operator()(const unsigned short key) const { return (int) key; } //!< Get hash value.
41  inline int operator()(const int key) const { return (int) key; } //!< Get hash value.
42  inline int operator()(const unsigned int key) const { return (int) key; } //!< Get hash value.
43  inline int operator()(const long int key) const { return (int) key; } //!< Get hash value.
44  inline int operator()(const unsigned long int key) const { return (int) key; } //!< Get hash value.
45  inline int operator()(const long long int key) const { return (int) key; } //!< Get hash value.
46  inline int operator()(const unsigned long long int key) const { return (int) key; } //!< Get hash value.
47  };
48 }
49 
50 #endif
JTOOLS::JHashEvaluator::operator()
int operator()(const long long int key) const
Get hash value.
Definition: JHashEvaluator.hh:45
JTOOLS::JHashEvaluator::operator()
int operator()(const char key) const
Get hash value.
Definition: JHashEvaluator.hh:37
JTOOLS::JHashEvaluator
Auxiliary class for default hash key evaluation.
Definition: JHashEvaluator.hh:24
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JTOOLS::JHashEvaluator::operator()
int operator()(const unsigned long int key) const
Get hash value.
Definition: JHashEvaluator.hh:44
JTOOLS::JHashEvaluator::operator()
int operator()(const unsigned short key) const
Get hash value.
Definition: JHashEvaluator.hh:40
JTOOLS::JHashEvaluator::operator()
int operator()(const int key) const
Get hash value.
Definition: JHashEvaluator.hh:41
JTOOLS::JHashEvaluator::operator()
int operator()(const long int key) const
Get hash value.
Definition: JHashEvaluator.hh:43
JTOOLS::JHashEvaluator::operator()
int operator()(const unsigned long long int key) const
Get hash value.
Definition: JHashEvaluator.hh:46
JTOOLS
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
Definition: JAbstractCollection.hh:9
JTOOLS::JHashEvaluator::operator()
int operator()(const unsigned char key) const
Get hash value.
Definition: JHashEvaluator.hh:38
JTOOLS::JHashEvaluator::operator()
int operator()(const JKey_t &key) const
Get hash value.
Definition: JHashEvaluator.hh:32
JTOOLS::JHashEvaluator::operator()
int operator()(const unsigned int key) const
Get hash value.
Definition: JHashEvaluator.hh:42
JTOOLS::JHashEvaluator::operator()
int operator()(const short key) const
Get hash value.
Definition: JHashEvaluator.hh:39