Loading...
Searching...
No Matches
hash.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#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
{
BALL_EXPORT extern HashIndex hashPointer(void *const ptr);
BALL_EXPORT extern HashIndex hashString(const char* str);
BALL_EXPORT extern HashIndex hashPJWString(const char* str);
BALL_EXPORT extern HashIndex hashElfString(const char* str);
template <typename T>
inline HashIndex Hash(const T& key)
{
return static_cast<HashIndex>((PointerSizeUInt)key);
}
BALL_EXPORT inline HashIndex Hash(const string& s)
{
return hashString(s.c_str());
}
BALL_EXPORT inline HashIndex Hash(const String& s)
{
return hashString(s.c_str());
}
BALL_EXPORT inline HashIndex Hash(void *const& ptr)
{
return hashPointer(ptr);
}
BALL_EXPORT HashIndex getNextPrime(HashIndex l);
} // namespace BALL
#endif // BALL_COMMON_HASH_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::String
Definition string.h:57
BALL::String::c_str
const char * c_str() const BALL_NOEXCEPT
common.h
BALL
Definition constants.h:13
BALL::HashIndex
BALL_SIZE_TYPE HashIndex
Definition COMMON/global.h:131
BALL::hashPointer
BALL_EXPORT HashIndex hashPointer(void *const ptr)
BALL::PointerSizeUInt
BALL_POINTERSIZEUINT_TYPE PointerSizeUInt
Definition COMMON/global.h:207
BALL::hashPJWString
BALL_EXPORT HashIndex hashPJWString(const char *str)
BALL::Hash
HashIndex Hash(const T &key)
Definition hash.h:47
BALL::hashElfString
BALL_EXPORT HashIndex hashElfString(const char *str)
BALL::getNextPrime
BALL_EXPORT HashIndex getNextPrime(HashIndex l)
BALL::hashString
BALL_EXPORT HashIndex hashString(const char *str)
string.h