• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*---------------------------------------------------------------------------*
2  *  ESR_SessionTypeImpl.h  *
3  *                                                                           *
4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5  *                                                                           *
6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7  *  you may not use this file except in compliance with the License.         *
8  *                                                                           *
9  *  You may obtain a copy of the License at                                  *
10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
11  *                                                                           *
12  *  Unless required by applicable law or agreed to in writing, software      *
13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15  *  See the License for the specific language governing permissions and      *
16  *  limitations under the License.                                           *
17  *                                                                           *
18  *---------------------------------------------------------------------------*/
19 
20 #ifndef __ESR_SESSIONTYPEIMPL_H
21 #define __ESR_SESSIONTYPEIMPL_H
22 
23 
24 
25 #include "ArrayList.h"
26 #include "ESR_ReturnCode.h"
27 #include "ESR_SessionType.h"
28 #include "ESR_SharedPrefix.h"
29 #include "HashMap.h"
30 #include "pstdio.h"
31 
32 
33 /**
34  * ESR_SessionType implementation data.
35  */
36 typedef struct ESR_SessionTypeData_t
37 {
38   /**
39    * [key, value] pairs.
40    */
41   HashMap* value;
42 
43   /**
44    * Event listeners.
45    */
46   ArrayList* listeners;
47 }
48 ESR_SessionTypeData;
49 
50 typedef struct ESR_SessionTypePair_t
51 {
52   /**
53    * Pointer to value.
54    */
55   void* value;
56   /**
57    * Value type.
58    */
59   VariableTypes type;
60 }
61 ESR_SessionPair;
62 
63 /**
64  * Default implementation.
65  */
66 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetPropertyImpl(ESR_SessionType* self,
67     const LCHAR* name,
68     void** value,
69     VariableTypes type);
70 /**
71  * Default implementation.
72  */
73 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetIntImpl(ESR_SessionType* self,
74     const LCHAR* name,
75     int* value);
76 /**
77  * Default implementation.
78  */
79 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetUint16_tImpl(ESR_SessionType* self,
80     const LCHAR* name,
81     asr_uint16_t* value);
82 /**
83  * Default implementation.
84  */
85 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetSize_tImpl(ESR_SessionType* self,
86     const LCHAR* name,
87     size_t* value);
88 /**
89  * Default implementation.
90  */
91 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetFloatImpl(ESR_SessionType* self,
92     const LCHAR* name,
93     float* value);
94 /**
95  * Default implementation.
96  */
97 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetBoolImpl(ESR_SessionType* self,
98     const LCHAR* name,
99     ESR_BOOL* value);
100 /**
101  * Default implementation.
102  */
103 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetLCHARImpl(ESR_SessionType* self,
104     const LCHAR* name,
105     LCHAR* value, size_t* len);
106 /**
107  * Default implementation.
108  */
109 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeContainsImpl(ESR_SessionType* self,
110     const LCHAR* name,
111     ESR_BOOL* exists);
112 /**
113  * Default implementation.
114  */
115 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetPropertyImpl(ESR_SessionType* self,
116     const LCHAR* name,
117     void* value, VariableTypes type);
118 /**
119  * Default implementation.
120  */
121 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetIntImpl(ESR_SessionType* self,
122     const LCHAR* name,
123     int value);
124 /**
125  * Default implementation.
126  */
127 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetUint16_tImpl(ESR_SessionType* self,
128     const LCHAR* name,
129     asr_uint16_t value);
130 /**
131  * Default implementation.
132  */
133 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetSize_tImpl(ESR_SessionType* self,
134     const LCHAR* name,
135     size_t value);
136 /**
137  * Default implementation.
138  */
139 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetFloatImpl(ESR_SessionType* self,
140     const LCHAR* name,
141     float value);
142 /**
143  * Default implementation.
144  */
145 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetBoolImpl(ESR_SessionType* self,
146     const LCHAR* name,
147     ESR_BOOL value);
148 /**
149  * Default implementation.
150  */
151 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetLCHARImpl(ESR_SessionType* self,
152     const LCHAR* name,
153     LCHAR* value);
154 /**
155  * Default implementation.
156  */
157 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetIntIfEmptyImpl(ESR_SessionType* self,
158     const LCHAR* name,
159     int value);
160 /**
161  * Default implementation.
162  */
163 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetUint16_tIfEmptyImpl(ESR_SessionType* self,
164     const LCHAR* name,
165     asr_uint16_t value);
166 /**
167  * Default implementation.
168  */
169 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetSize_tIfEmptyImpl(ESR_SessionType* self,
170     const LCHAR* name,
171     size_t value);
172 /**
173  * Default implementation.
174  */
175 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetFloatIfEmptyImpl(ESR_SessionType* self,
176     const LCHAR* name,
177     float value);
178 /**
179  * Default implementation.
180  */
181 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetBoolIfEmptyImpl(ESR_SessionType* self,
182     const LCHAR* name,
183     ESR_BOOL value);
184 /**
185  * Default implementation.
186  */
187 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeSetLCHARIfEmptyImpl(ESR_SessionType* self,
188     const LCHAR* name,
189     LCHAR* value);
190 /**
191  * Default implementation.
192  */
193 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeRemovePropertyImpl(ESR_SessionType* self,
194     const LCHAR* name);
195 /**
196  * Default implementation.
197  */
198 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeRemoveAndFreePropertyImpl(ESR_SessionType* self,
199     const LCHAR* name);
200 /**
201  * Default implementation.
202  */
203 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeImportCommandLineImpl(ESR_SessionType* self,
204     int argc,
205     LCHAR* argv[]);
206 /**
207  * Default implementation.
208  */
209 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeImportSessionImpl(ESR_SessionType* self,
210     ESR_SessionType* source);
211 /**
212  * Default implementation.
213  */
214 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetSizeImpl(ESR_SessionType* self,
215     size_t* size);
216 /**
217  * Default implementation.
218  */
219 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetKeyAtIndexImpl(ESR_SessionType* self,
220     size_t index,
221     LCHAR** key);
222 /**
223  * Default implementation.
224  */
225 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeDestroyImpl(ESR_SessionType* self);
226 /**
227  * Default implementation.
228  */
229 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeConvertToIntImpl(ESR_SessionType* self,
230     const LCHAR* key);
231 /**
232  * Default implementation.
233  */
234 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeConvertToUint16_tImpl(ESR_SessionType* self,
235     const LCHAR* key);
236 /**
237  * Default implementation.
238  */
239 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeConvertToSize_tImpl(ESR_SessionType* self,
240     const LCHAR* key);
241 /**
242  * Default implementation.
243  */
244 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeConvertToFloatImpl(ESR_SessionType* self,
245     const LCHAR* key);
246 /**
247  * Default implementation.
248  */
249 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeConvertToBoolImpl(ESR_SessionType* self,
250     const LCHAR* key);
251 /**
252  * Default implementation.
253  */
254 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeGetPropertyTypeImpl(ESR_SessionType* self,
255     const LCHAR* name,
256     VariableTypes* type);
257 /**
258  * Default implementation.
259  */
260 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeImportParFileImpl(ESR_SessionType* self,
261     const LCHAR* filename);
262 
263 /**
264  * Default implementation.
265  */
266 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeAddListenerImpl(ESR_SessionType* self,
267     ESR_SessionTypeListenerPair* listener);
268 
269 /**
270  * Default implementation.
271  */
272 ESR_SHARED_API ESR_ReturnCode ESR_SessionTypeRemoveListenerImpl(ESR_SessionType* self,
273     ESR_SessionTypeListenerPair* listener);
274 
275 #endif /* __ESR_SESSIONTYPEIMPL_H */
276