X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fhash.hh;fp=src%2Fmoof%2Fhash.hh;h=27cc650147ab98c81a90b4a6ff57d08dab4cab66;hp=0000000000000000000000000000000000000000;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hpb=299af4f2047e767e5d79501c26444473bda64c64 diff --git a/src/moof/hash.hh b/src/moof/hash.hh new file mode 100644 index 0000000..27cc650 --- /dev/null +++ b/src/moof/hash.hh @@ -0,0 +1,52 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_HASH_HH_ +#define _MOOF_HASH_HH_ + +/** + * \file hash.hh + * Hash tables and functions. + */ + +#include + +#include + + +namespace moof { + + +using stlplus::hash; + + +struct hash_function +{ + // generic hash function + unsigned operator () (const void* key, int len, + unsigned seed = -1) const; + + unsigned operator () (const std::string& val) const + { + return (*this)(val.data(), val.length()); + } + + unsigned operator () (int val) const + { + return val; + } +}; + + +} // namespace moof + +#endif // _MOOF_HASH_HH_ +