monotone

monotone Mtn Source Tree

Root/vocab_hash.hh

1#ifndef __VOCAB_HASH_HH__
2#define __VOCAB_HASH_HH__
3
4// Copyright 2007 Timothy Brownawell <tbrownaw@gmail.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13#include "vocab.hh"
14#include "hash_map.hh"
15
16#define ENCODING(enc) \
17 namespace hashmap { \
18 template<typename INNER> \
19 struct hash<enc<INNER> > \
20 { \
21size_t operator()(enc<INNER> const & t) const \
22{ \
23 return hash<std::string>()(t()); \
24} \
25 }; \
26 }
27
28#define DECORATE(dec) \
29 namespace hashmap { \
30 template<typename INNER> \
31 struct hash<dec<INNER> > \
32 { \
33size_t operator()(dec<INNER> const & t) const \
34{ \
35 return hash<INNER>()(t.inner()); \
36} \
37 }; \
38 }
39
40#define ATOMIC(ty) \
41 namespace hashmap { \
42 template<> \
43 struct hash<ty> \
44 { \
45size_t operator()(ty const & t) const \
46{ \
47 return hash<std::string>()(t()); \
48} \
49 }; \
50 }
51
52#define ATOMIC_NOVERIFY(ty) ATOMIC(ty)
53
54#include "vocab_terms.hh"
55
56#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status