Mercurial > hg > orthanc
comparison Core/Enumerations.cpp @ 759:8cfc6119a5bd dicom-rt
integration mainline -> dicom-rt
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 Apr 2014 16:04:55 +0200 |
parents | dd1ce9a2844c |
children | ecedd89055db |
comparison
equal
deleted
inserted
replaced
605:b82292ba2083 | 759:8cfc6119a5bd |
---|---|
1 /** | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
3 * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege, | 3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, |
4 * Belgium | 4 * Belgium |
5 * | 5 * |
6 * This program is free software: you can redistribute it and/or | 6 * This program is free software: you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License as | 7 * modify it under the terms of the GNU General Public License as |
8 * published by the Free Software Foundation, either version 3 of the | 8 * published by the Free Software Foundation, either version 3 of the |
31 | 31 |
32 | 32 |
33 #include "Enumerations.h" | 33 #include "Enumerations.h" |
34 | 34 |
35 #include "OrthancException.h" | 35 #include "OrthancException.h" |
36 #include "Toolbox.h" | |
36 | 37 |
37 namespace Orthanc | 38 namespace Orthanc |
38 { | 39 { |
39 const char* EnumerationToString(HttpMethod method) | 40 const char* EnumerationToString(HttpMethod method) |
40 { | 41 { |
220 | 221 |
221 default: | 222 default: |
222 throw OrthancException(ErrorCode_ParameterOutOfRange); | 223 throw OrthancException(ErrorCode_ParameterOutOfRange); |
223 } | 224 } |
224 } | 225 } |
226 | |
227 | |
228 const char* EnumerationToString(ResourceType type) | |
229 { | |
230 switch (type) | |
231 { | |
232 case ResourceType_Patient: | |
233 return "Patient"; | |
234 | |
235 case ResourceType_Study: | |
236 return "Study"; | |
237 | |
238 case ResourceType_Series: | |
239 return "Series"; | |
240 | |
241 case ResourceType_Instance: | |
242 return "Instance"; | |
243 | |
244 default: | |
245 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
246 } | |
247 } | |
248 | |
249 | |
250 ResourceType StringToResourceType(const char* type) | |
251 { | |
252 std::string s(type); | |
253 Toolbox::ToUpperCase(s); | |
254 | |
255 if (s == "PATIENT" || s == "PATIENTS") | |
256 { | |
257 return ResourceType_Patient; | |
258 } | |
259 else if (s == "STUDY" || s == "STUDIES") | |
260 { | |
261 return ResourceType_Study; | |
262 } | |
263 else if (s == "SERIES") | |
264 { | |
265 return ResourceType_Series; | |
266 } | |
267 else if (s == "INSTANCE" || s == "IMAGE" || | |
268 s == "INSTANCES" || s == "IMAGES") | |
269 { | |
270 return ResourceType_Instance; | |
271 } | |
272 else | |
273 { | |
274 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
275 } | |
276 } | |
225 } | 277 } |