#ifndef __JTOOLS__JHASHEVALUATOR__
#define __JTOOLS__JHASHEVALUATOR__
/**
* \author mdejong
*/
namespace JTOOLS {}
namespace JPP { using namespace JTOOLS; }
namespace JTOOLS {
/**
* Auxiliary class for default hash key evaluation.
*
* For a composite hash key, the following policy member method should be provided.
*
* int %getKey() const;
*
*
* For integral primitive data types, the hash value is obtained by a simple cast to an int value.
*/
struct JHashEvaluator {
/**
* Get hash value.
*
* \param key key
* \return hash value
*/
template
inline int operator()(const JKey_t& key) const
{
return key.getKey();
}
inline int operator()(const char key) const { return (int) key; } //!< Get hash value.
inline int operator()(const unsigned char key) const { return (int) key; } //!< Get hash value.
inline int operator()(const short key) const { return (int) key; } //!< Get hash value.
inline int operator()(const unsigned short key) const { return (int) key; } //!< Get hash value.
inline int operator()(const int key) const { return (int) key; } //!< Get hash value.
inline int operator()(const unsigned int key) const { return (int) key; } //!< Get hash value.
inline int operator()(const long int key) const { return (int) key; } //!< Get hash value.
inline int operator()(const unsigned long int key) const { return (int) key; } //!< Get hash value.
inline int operator()(const long long int key) const { return (int) key; } //!< Get hash value.
inline int operator()(const unsigned long long int key) const { return (int) key; } //!< Get hash value.
};
}
#endif