Edinburgh Speech Tools  2.1-release
EST_TNamedEnumI.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_TNamedEnum_I_H__
37 #define __EST_TNamedEnum_I_H__
38 
39 /** Instantiate rules for named enum template.
40  *
41  * @author Richard Caley <rjc@cstr.ed.ac.uk>
42  * @version $Id: EST_TNamedEnumI.h,v 1.2 2001/04/04 13:11:27 awb Exp $
43  */
44 
45 // Instantiation Macros
46 
47 #define Instantiate_TValuedEnumI_T(ENUM, VAL, INFO, TAG) \
48  template class EST_TValuedEnumI< ENUM, VAL, INFO >; \
49 
50 
51 #define Instantiate_TValuedEnum_T(ENUM, VAL, TAG) \
52  Instantiate_TValuedEnumI_T(ENUM, VAL, NO_INFO, TAG)
53 
54 #define Instantiate_TNamedEnumI_T(ENUM, INFO, TAG) \
55  template class EST_TNamedEnumI< ENUM, INFO >; \
56  Instantiate_TValuedEnumI_T(ENUM, const char *, INFO, TAG)
57 
58 #define Instantiate_TNamedEnum_T(ENUM, TAG) \
59  Instantiate_TValuedEnumI_T(ENUM, const char *, NO_INFO, TAG) \
60  template class EST_TNamedEnum< ENUM >; \
61  template class EST_TNamedEnumI< ENUM, NO_INFO >;
62 
63 
64 #define Instantiate_TValuedEnumI(ENUM, VAL, INFO) \
65  Instantiate_TValuedEnumI_T(ENUM, VAL, INFO, ENUM ## VAL ## INFO )
66 
67 #define Instantiate_TValuedEnum(ENUM, VAL) \
68  template class EST_TValuedEnum< ENUM, VAL >; \
69  Instantiate_TValuedEnum_T(ENUM, VAL, ENUM ## VAL)
70 
71 
72 #define Instantiate_TNamedEnumI(ENUM, INFO) \
73  Instantiate_TNamedEnumI_T(ENUM, INFO, ENUM ## INFO)
74 
75 #define Instantiate_TNamedEnum(ENUM) \
76  Instantiate_TNamedEnum_T(ENUM, ENUM) \
77 
78 // declaration macros. NULL at the moment.
79 
80 #define Declare_TValuedEnumI_T(ENUM, VAL, INFO, TAG) \
81  /* EMPTY */
82 
83 #define Declare_TValuedEnum_T(ENUM, VAL, TAG) \
84  Declare_TValuedEnumI_T(ENUM, VAL, NO_INFO, TAG)
85 
86 #define Declare_TNamedEnumI_T(ENUM, INFO, TAG) \
87  Declare_TValuedEnumI_T(ENUM, const char *, INFO, TAG)
88 
89 #define Declare_TNamedEnum_T(ENUM, TAG) \
90  Declare_TNamedEnumI_T(ENUM, NO_INFO, TAG)
91 
92 
93 #define Declare_TValuedEnumI(ENUM, VAL, INFO) \
94  Declare_TValuedEnumI_T(ENUM, VAL, INFO, ENUM ## VAL ## INFO )
95 
96 #define Declare_TValuedEnum(ENUM, VAL) \
97  Declare_TValuedEnum_T(ENUM, VAL, ENUM ## VAL)
98 
99 #define Declare_TNamedEnumI(ENUM, INFO) \
100  Declare_TNamedEnumI_T(ENUM, INFO, ENUM ## INFO)
101 
102 #define Declare_TNamedEnum(ENUM) \
103  Declare_TNamedEnum_T(ENUM, ENUM)
104 
105 // Actual table declaration macros
106 
107 #define Create_TValuedEnumDefinition(ENUM, VAL, INFO, TAG) \
108  static EST_TValuedEnumDefinition< ENUM, VAL, INFO> TAG ## _names[]
109 
110 #define Create_TNamedEnumDefinition(ENUM, INFO, TAG) \
111  Create_TValuedEnumDefinition(ENUM, const char *, INFO, TAG)
112 
113 #define Start_TValuedEnumI_T(ENUM, VAL, INFO, NAME, TAG) \
114  Create_TValuedEnumDefinition(ENUM, VAL, INFO, TAG) = {
115 #define End_TValuedEnumI_T(ENUM, VAL, INFO, NAME, TAG) \
116  }; \
117  EST_TValuedEnumI< ENUM, VAL, INFO > NAME (TAG ## _names);
118 
119 #define Start_TNamedEnumI_T(ENUM, INFO, NAME, TAG) \
120  Create_TValuedEnumDefinition(ENUM, const char *, INFO, TAG) = {
121 #define End_TNamedEnumI_T(ENUM, INFO, NAME, TAG) \
122  }; \
123  EST_TNamedEnumI< ENUM, INFO > NAME (TAG ## _names);
124 
125 #define Start_TValuedEnumI(ENUM, VAL, INFO, NAME) \
126  Start_TValuedEnumI_T(ENUM, VAL, INFO, NAME, NAME)
127 #define End_TValuedEnumI(ENUM, VAL, INFO, NAME) \
128  End_TValuedEnumI_T(ENUM, VAL, INFO, NAME, NAME)
129 
130 #define Start_TNamedEnumI(ENUM, INFO, NAME) \
131  Start_TNamedEnumI_T(ENUM, INFO, NAME, NAME)
132 #define End_TNamedEnumI(ENUM, INFO, NAME) \
133  End_TNamedEnumI_T(ENUM, INFO, NAME, NAME)
134 
135 #define Start_TValuedEnum_T(ENUM, VAL, NAME, TAG) \
136  Create_TValuedEnumDefinition(ENUM, VAL, NO_INFO, TAG) = {
137 #define End_TValuedEnum_T(ENUM, VAL, NAME, TAG) \
138  }; \
139  EST_TValuedEnum< ENUM, VAL > NAME (TAG ## _names);
140 
141 #define Start_TNamedEnum_T(ENUM, NAME, TAG) \
142  Create_TValuedEnumDefinition(ENUM, const char *, NO_INFO, TAG) = {
143 #define End_TNamedEnum_T(ENUM, NAME, TAG) \
144  }; \
145  EST_TNamedEnum< ENUM > NAME (TAG ## _names);
146 
147 #define Start_TValuedEnum(ENUM, VAL, NAME) \
148  Start_TValuedEnum_T(ENUM, VAL, NAME, NAME)
149 #define End_TValuedEnum(ENUM, VAL, NAME) \
150  End_TValuedEnum_T(ENUM, VAL, NAME, NAME)
151 
152 #define Start_TNamedEnum(ENUM, NAME) \
153  Start_TNamedEnum_T(ENUM, NAME, NAME)
154 #define End_TNamedEnum(ENUM, NAME) \
155  End_TNamedEnum_T(ENUM, NAME, NAME)
156 #endif
157