<commit_before>// $Id: hash.h,v 1.7 2000/11/30 23:00:01 amoll Exp $

#ifndef BALL_COMMON_HASH_H
#define BALL_COMMON_HASH_H

#ifndef BALL_COMMON_H
#	include <BALL/common.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif

namespace BALL 
{

	/**	@name	Hashing
	*/
	//@{

	/**	General Hash Function Template.
			This template function provides a simple wrapper
			for the specialized hash functions. It facilitates their use 
			in STL hash associative containers which expect a {\bf Hasher}
			class as template parameter.
	*/
  template <typename T>
  class HashFunction
  {
    public:
		
    bool operator () (const T& t) const throw()
    {
      return Hash(t);
		}
	};

	/**	@name Specialized Hash Functions.
	*/
	//@{
	
	/**
	*/
  extern HashIndex hashPointer(void *const ptr) throw();

	/**
	*/
  extern HashIndex hashString(const char* str) throw();

	/**
	*/
  extern HashIndex hashPJWString(const char* str) throw();

	/**
	*/
  extern HashIndex hashElfString(const char* str) throw();

	/** General default hash function.
			This method should tires to convert the given key to a 
			\Ref{HashIndex} by calling {\tt (HashIndex)key}.
			If the key type {\tt T} is not convertible to \Ref{HashIndex} by
			default, a converter should be defined ({\tt operator HashIndex}).
			@param	key the key to be hashed
			@return	HashIndex the hash index
	*/
	template <typename T>
	inline HashIndex Hash(const T& key) throw()
	{
		return (HashIndex)((PointerInt)key);
	}

	/** String hash function.
			This method is optimized for the hashing of STL strings.
			In fact, it is only an inline wrapper around \Ref{hashString}.
	*/
	inline HashIndex Hash(const string& s) throw()
	{<commit_msg>changed: adapted to new pointer type in global.h<commit_after>// $Id: hash.h,v 1.8 2000/12/12 16:15:13 oliver Exp $

#ifndef BALL_COMMON_HASH_H
#define BALL_COMMON_HASH_H

#ifndef BALL_COMMON_H
#	include <BALL/common.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif

namespace BALL 
{

	/**	@name	Hashing
	*/
	//@{

	/**	General Hash Function Template.
			This template function provides a simple wrapper
			for the specialized hash functions. It facilitates their use 
			in STL hash associative containers which expect a {\bf Hasher}
			class as template parameter.
	*/
  template <typename T>
  class HashFunction
  {
    public:
		
    bool operator () (const T& t) const throw()
    {
      return Hash(t);
		}
	};

	/**	@name Specialized Hash Functions.
	*/
	//@{
	
	/**
	*/
  extern HashIndex hashPointer(void *const ptr) throw();

	/**
	*/
  extern HashIndex hashString(const char* str) throw();

	/**
	*/
  extern HashIndex hashPJWString(const char* str) throw();

	/**
	*/
  extern HashIndex hashElfString(const char* str) throw();

	/** General default hash function.
			This method should tires to convert the given key to a 
			\Ref{HashIndex} by calling {\tt (HashIndex)key}.
			If the key type {\tt T} is not convertible to \Ref{HashIndex} by
			default, a converter should be defined ({\tt operator HashIndex}).
			@param	key the key to be hashed
			@return	HashIndex the hash index
	*/
	template <typename T>
	inline HashIndex Hash(const T& key) throw()
	{
		return (HashIndex)(key);
	}

	/** String hash function.
			This method is optimized for the hashing of STL strings.
			In fact, it is only an inline wrapper around \Ref{hashString}.
	*/
	inline HashIndex Hash(const string& s) throw()
	{
{'fraction_non_alphanumeric': 0.1100864553314121, 'fraction_numerical': 0.009221902017291067, 'mean_word_length': 3.3333333333333335, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '784034', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1124, 'n_words': 399}