Edinburgh Speech Tools  2.1-release
EST_THashI.h
Go to the documentation of this file.
1 
2  /************************************************************************/
3  /* */
4  /* Centre for Speech Technology Research */
5  /* University of Edinburgh, UK */
6  /* Copyright (c) 1996,1997 */
7  /* All Rights Reserved. */
8  /* */
9  /* Permission is hereby granted, free of charge, to use and distribute */
10  /* this software and its documentation without restriction, including */
11  /* without limitation the rights to use, copy, modify, merge, publish, */
12  /* distribute, sublicense, and/or sell copies of this work, and to */
13  /* permit persons to whom this work is furnished to do so, subject to */
14  /* the following conditions: */
15  /* 1. The code must retain the above copyright notice, this list of */
16  /* conditions and the following disclaimer. */
17  /* 2. Any modifications must be clearly marked as such. */
18  /* 3. Original authors' names are not deleted. */
19  /* 4. The authors' names are not used to endorse or promote products */
20  /* derived from this software without specific prior written */
21  /* permission. */
22  /* */
23  /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
24  /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
25  /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
26  /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
27  /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
28  /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
29  /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
30  /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
31  /* THIS SOFTWARE. */
32  /* */
33  /*************************************************************************/
34 
35 
36 #ifndef __EST_THASH_I_H__
37 #define __EST_THASH_I_H__
38 
39 #include "EST_system.h"
41 
42 /** Instantiate rules for hash template.
43  *
44  * @author Richard Caley <rjc@cstr.ed.ac.uk>
45  * @version $Id: EST_THashI.h,v 1.3 2004/05/04 00:00:17 awb Exp $
46  */
47 
48 // Instantiation Macros
49 
50 #define Instantiate_THash_T_IT_IP(KEY, VAL, TAG, IP, IPK) \
51  typedef EST_THash< KEY, VAL > HASH_ ## TAG ## _t; \
52  typedef EST_Hash_Pair< KEY, VAL > HASHPAIR_ ## TAG ## _t; \
53  Instantiate_TStructIterator_T(HASH_ ## TAG ## _t, HASH_ ## TAG ## _t:: IP, HASHPAIR_ ## TAG ## _t, HASH_ ## TAG ## _itt) \
54  Instantiate_TIterator_T(HASH_ ## TAG ## _t, HASH_ ## TAG ## _t:: IP, HASHPAIR_ ## TAG ## _t, HASH_ ## TAG ## _itt) \
55  Instantiate_TIterator_T(HASH_ ## TAG ## _t, HASH_ ## TAG ## _t:: IPK, KEY, HASH_ ## TAG ## _itt)
56 
57 #if defined(VISUAL_CPP)
58 # define Instantiate_THash_T_IT(KEY, VAL, TAG) \
59  Instantiate_THash_T_IT_IP(KEY, VAL, TAG, IPointer_s, IPointer_k_s)
60 #else
61 # define Instantiate_THash_T_IT(KEY, VAL, TAG) \
62  Instantiate_THash_T_IT_IP(KEY, VAL, TAG, IPointer, IPointer_k)
63 #endif
64 
65 #define Instantiate_THash_T_MIN(KEY, VAL, TAG) \
66  template class EST_Hash_Pair< KEY, VAL >; \
67  template class EST_THash< KEY, VAL >;
68 
69 #define Instantiate_THash_T(KEY, VAL, TAG) \
70  Instantiate_THash_T_MIN(KEY, VAL, TAG) \
71  Instantiate_THash_T_IT(KEY, VAL, TAG)
72 
73 #define Instantiate_THash(KEY, VAL) Instantiate_THash_T(KEY, VAL, KEY ## VAL)
74 #define Instantiate_THash_MIN(KEY, VAL) Instantiate_THash_T_MIN(KEY, VAL, KEY ## VAL)
75 #define Instantiate_THash_IT(KEY, VAL, IP) \
76  Instantiate_THash_T_IT(KEY, VAL, KEY ## VAL, IP)
77 
78 
79 /* disabled. it's INVALID !!!
80 #define Declare_THash_T(KEY, VAL, TAG) \
81  VAL EST_THash< KEY, VAL >::Dummy_Value; \
82  KEY EST_THash< KEY, VAL >::Dummy_Key; \
83  EST_THash< KEY, VAL > TAG ## _hash_dummy(0);
84 */
85 
86 #define Declare_THash_Base_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR,TAG) \
87  template <> KEY EST_THash< KEY, VAL >::Dummy_Key=DEFAULTK; \
88  template <> VAL EST_THash<KEY, VAL>::Dummy_Value=DEFAULT;
89 
90 #define Declare_THash_Class_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR,TAG) \
91  template <> KEY EST_THash< KEY, VAL >::Dummy_Key(DEFAULTK); \
92  template <> VAL EST_THash<KEY, VAL>::Dummy_Value(DEFAULT);
93 
94 #define Declare_THash(KEY, VAL) Declare_THash_T(KEY, VAL, KEY ## VAL)
95 
96 #define Declare_THash_Base(KEY, VAL, DEFAULTK, DEFAULT, ERROR) \
97  Declare_THash_Base_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR, KEY ## VAL)
98 #define Declare_THash_Class(KEY, VAL, DEFAULTK, DEFAULT, ERROR) \
99  Declare_THash_Class_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR, KEY ## VAL)
100 
101 #endif
102