comparison Plugins/Engine/PluginsEnumerations.cpp @ 1646:da799f767e5d

simplification in error casting with plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Sep 2015 16:01:09 +0200
parents 1558b3226b18
children 5360cdba70d8
comparison
equal deleted inserted replaced
1645:1558b3226b18 1646:da799f767e5d
42 42
43 namespace Orthanc 43 namespace Orthanc
44 { 44 {
45 namespace Plugins 45 namespace Plugins
46 { 46 {
47 ErrorCode Convert(OrthancPluginErrorCode error)
48 {
49 switch (error)
50 {
51 case OrthancPluginErrorCode_InternalError:
52 return ErrorCode_InternalError;
53
54 case OrthancPluginErrorCode_Success:
55 return ErrorCode_Success;
56
57 case OrthancPluginErrorCode_Plugin:
58 return ErrorCode_Plugin;
59
60 case OrthancPluginErrorCode_NotImplemented:
61 return ErrorCode_NotImplemented;
62
63 case OrthancPluginErrorCode_ParameterOutOfRange:
64 return ErrorCode_ParameterOutOfRange;
65
66 case OrthancPluginErrorCode_NotEnoughMemory:
67 return ErrorCode_NotEnoughMemory;
68
69 case OrthancPluginErrorCode_BadParameterType:
70 return ErrorCode_BadParameterType;
71
72 case OrthancPluginErrorCode_BadSequenceOfCalls:
73 return ErrorCode_BadSequenceOfCalls;
74
75 case OrthancPluginErrorCode_InexistentItem:
76 return ErrorCode_InexistentItem;
77
78 case OrthancPluginErrorCode_BadRequest:
79 return ErrorCode_BadRequest;
80
81 case OrthancPluginErrorCode_NetworkProtocol:
82 return ErrorCode_NetworkProtocol;
83
84 case OrthancPluginErrorCode_SystemCommand:
85 return ErrorCode_SystemCommand;
86
87 case OrthancPluginErrorCode_Database:
88 return ErrorCode_Database;
89
90 case OrthancPluginErrorCode_UriSyntax:
91 return ErrorCode_UriSyntax;
92
93 case OrthancPluginErrorCode_InexistentFile:
94 return ErrorCode_InexistentFile;
95
96 case OrthancPluginErrorCode_CannotWriteFile:
97 return ErrorCode_CannotWriteFile;
98
99 case OrthancPluginErrorCode_BadFileFormat:
100 return ErrorCode_BadFileFormat;
101
102 case OrthancPluginErrorCode_Timeout:
103 return ErrorCode_Timeout;
104
105 case OrthancPluginErrorCode_UnknownResource:
106 return ErrorCode_UnknownResource;
107
108 case OrthancPluginErrorCode_IncompatibleDatabaseVersion:
109 return ErrorCode_IncompatibleDatabaseVersion;
110
111 case OrthancPluginErrorCode_FullStorage:
112 return ErrorCode_FullStorage;
113
114 case OrthancPluginErrorCode_CorruptedFile:
115 return ErrorCode_CorruptedFile;
116
117 case OrthancPluginErrorCode_InexistentTag:
118 return ErrorCode_InexistentTag;
119
120 case OrthancPluginErrorCode_ReadOnly:
121 return ErrorCode_ReadOnly;
122
123 case OrthancPluginErrorCode_IncompatibleImageFormat:
124 return ErrorCode_IncompatibleImageFormat;
125
126 case OrthancPluginErrorCode_IncompatibleImageSize:
127 return ErrorCode_IncompatibleImageSize;
128
129 case OrthancPluginErrorCode_SharedLibrary:
130 return ErrorCode_SharedLibrary;
131
132 case OrthancPluginErrorCode_UnknownPluginService:
133 return ErrorCode_UnknownPluginService;
134
135 case OrthancPluginErrorCode_UnknownDicomTag:
136 return ErrorCode_UnknownDicomTag;
137
138 case OrthancPluginErrorCode_BadJson:
139 return ErrorCode_BadJson;
140
141 case OrthancPluginErrorCode_Unauthorized:
142 return ErrorCode_Unauthorized;
143
144 case OrthancPluginErrorCode_BadFont:
145 return ErrorCode_BadFont;
146
147 case OrthancPluginErrorCode_DatabasePlugin:
148 return ErrorCode_DatabasePlugin;
149
150 case OrthancPluginErrorCode_StorageAreaPlugin:
151 return ErrorCode_StorageAreaPlugin;
152
153 case OrthancPluginErrorCode_SQLiteNotOpened:
154 return ErrorCode_SQLiteNotOpened;
155
156 case OrthancPluginErrorCode_SQLiteAlreadyOpened:
157 return ErrorCode_SQLiteAlreadyOpened;
158
159 case OrthancPluginErrorCode_SQLiteCannotOpen:
160 return ErrorCode_SQLiteCannotOpen;
161
162 case OrthancPluginErrorCode_SQLiteStatementAlreadyUsed:
163 return ErrorCode_SQLiteStatementAlreadyUsed;
164
165 case OrthancPluginErrorCode_SQLiteExecute:
166 return ErrorCode_SQLiteExecute;
167
168 case OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction:
169 return ErrorCode_SQLiteRollbackWithoutTransaction;
170
171 case OrthancPluginErrorCode_SQLiteCommitWithoutTransaction:
172 return ErrorCode_SQLiteCommitWithoutTransaction;
173
174 case OrthancPluginErrorCode_SQLiteRegisterFunction:
175 return ErrorCode_SQLiteRegisterFunction;
176
177 case OrthancPluginErrorCode_SQLiteFlush:
178 return ErrorCode_SQLiteFlush;
179
180 case OrthancPluginErrorCode_SQLiteCannotRun:
181 return ErrorCode_SQLiteCannotRun;
182
183 case OrthancPluginErrorCode_SQLiteCannotStep:
184 return ErrorCode_SQLiteCannotStep;
185
186 case OrthancPluginErrorCode_SQLiteBindOutOfRange:
187 return ErrorCode_SQLiteBindOutOfRange;
188
189 case OrthancPluginErrorCode_SQLitePrepareStatement:
190 return ErrorCode_SQLitePrepareStatement;
191
192 case OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted:
193 return ErrorCode_SQLiteTransactionAlreadyStarted;
194
195 case OrthancPluginErrorCode_SQLiteTransactionCommit:
196 return ErrorCode_SQLiteTransactionCommit;
197
198 case OrthancPluginErrorCode_SQLiteTransactionBegin:
199 return ErrorCode_SQLiteTransactionBegin;
200
201 case OrthancPluginErrorCode_DirectoryOverFile:
202 return ErrorCode_DirectoryOverFile;
203
204 case OrthancPluginErrorCode_FileStorageCannotWrite:
205 return ErrorCode_FileStorageCannotWrite;
206
207 case OrthancPluginErrorCode_DirectoryExpected:
208 return ErrorCode_DirectoryExpected;
209
210 case OrthancPluginErrorCode_HttpPortInUse:
211 return ErrorCode_HttpPortInUse;
212
213 case OrthancPluginErrorCode_DicomPortInUse:
214 return ErrorCode_DicomPortInUse;
215
216 case OrthancPluginErrorCode_BadHttpStatusInRest:
217 return ErrorCode_BadHttpStatusInRest;
218
219 case OrthancPluginErrorCode_RegularFileExpected:
220 return ErrorCode_RegularFileExpected;
221
222 case OrthancPluginErrorCode_PathToExecutable:
223 return ErrorCode_PathToExecutable;
224
225 case OrthancPluginErrorCode_MakeDirectory:
226 return ErrorCode_MakeDirectory;
227
228 case OrthancPluginErrorCode_BadApplicationEntityTitle:
229 return ErrorCode_BadApplicationEntityTitle;
230
231 case OrthancPluginErrorCode_NoCFindHandler:
232 return ErrorCode_NoCFindHandler;
233
234 case OrthancPluginErrorCode_NoCMoveHandler:
235 return ErrorCode_NoCMoveHandler;
236
237 case OrthancPluginErrorCode_NoCStoreHandler:
238 return ErrorCode_NoCStoreHandler;
239
240 case OrthancPluginErrorCode_NoApplicationEntityFilter:
241 return ErrorCode_NoApplicationEntityFilter;
242
243 case OrthancPluginErrorCode_NoSopClassOrInstance:
244 return ErrorCode_NoSopClassOrInstance;
245
246 case OrthancPluginErrorCode_NoPresentationContext:
247 return ErrorCode_NoPresentationContext;
248
249 case OrthancPluginErrorCode_DicomFindUnavailable:
250 return ErrorCode_DicomFindUnavailable;
251
252 case OrthancPluginErrorCode_DicomMoveUnavailable:
253 return ErrorCode_DicomMoveUnavailable;
254
255 case OrthancPluginErrorCode_CannotStoreInstance:
256 return ErrorCode_CannotStoreInstance;
257
258 case OrthancPluginErrorCode_CreateDicomNotString:
259 return ErrorCode_CreateDicomNotString;
260
261 case OrthancPluginErrorCode_CreateDicomOverrideTag:
262 return ErrorCode_CreateDicomOverrideTag;
263
264 case OrthancPluginErrorCode_CreateDicomUseContent:
265 return ErrorCode_CreateDicomUseContent;
266
267 case OrthancPluginErrorCode_CreateDicomNoPayload:
268 return ErrorCode_CreateDicomNoPayload;
269
270 case OrthancPluginErrorCode_CreateDicomUseDataUriScheme:
271 return ErrorCode_CreateDicomUseDataUriScheme;
272
273 case OrthancPluginErrorCode_CreateDicomBadParent:
274 return ErrorCode_CreateDicomBadParent;
275
276 case OrthancPluginErrorCode_CreateDicomParentIsInstance:
277 return ErrorCode_CreateDicomParentIsInstance;
278
279 case OrthancPluginErrorCode_CreateDicomParentEncoding:
280 return ErrorCode_CreateDicomParentEncoding;
281
282 case OrthancPluginErrorCode_UnknownModality:
283 return ErrorCode_UnknownModality;
284
285 case OrthancPluginErrorCode_BadJobOrdering:
286 return ErrorCode_BadJobOrdering;
287
288 case OrthancPluginErrorCode_JsonToLuaTable:
289 return ErrorCode_JsonToLuaTable;
290
291 case OrthancPluginErrorCode_CannotCreateLua:
292 return ErrorCode_CannotCreateLua;
293
294 case OrthancPluginErrorCode_CannotExecuteLua:
295 return ErrorCode_CannotExecuteLua;
296
297 case OrthancPluginErrorCode_LuaAlreadyExecuted:
298 return ErrorCode_LuaAlreadyExecuted;
299
300 case OrthancPluginErrorCode_LuaBadOutput:
301 return ErrorCode_LuaBadOutput;
302
303 case OrthancPluginErrorCode_NotLuaPredicate:
304 return ErrorCode_NotLuaPredicate;
305
306 case OrthancPluginErrorCode_LuaReturnsNoString:
307 return ErrorCode_LuaReturnsNoString;
308
309 case OrthancPluginErrorCode_StorageAreaAlreadyRegistered:
310 return ErrorCode_StorageAreaAlreadyRegistered;
311
312 case OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered:
313 return ErrorCode_DatabaseBackendAlreadyRegistered;
314
315 case OrthancPluginErrorCode_DatabaseNotInitialized:
316 return ErrorCode_DatabaseNotInitialized;
317
318 default:
319 return ErrorCode_InternalError;
320 }
321 }
322
323
324 OrthancPluginResourceType Convert(ResourceType type) 47 OrthancPluginResourceType Convert(ResourceType type)
325 { 48 {
326 switch (type) 49 switch (type)
327 { 50 {
328 case ResourceType_Patient: 51 case ResourceType_Patient: