Mercurial > hg > orthanc
annotate Plugins/Engine/PluginsEnumerations.cpp @ 1649:8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 16:24:13 +0200 |
parents | da799f767e5d |
children | 5360cdba70d8 |
rev | line source |
---|---|
1625 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * | |
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 | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
22 * | |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #include "../../OrthancServer/PrecompiledHeadersServer.h" | |
34 #include "PluginsEnumerations.h" | |
35 | |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
36 #if ORTHANC_PLUGINS_ENABLED != 1 |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
37 #error The plugin support is disabled |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
38 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
39 |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
40 |
1625 | 41 #include "../../Core/OrthancException.h" |
42 | |
43 namespace Orthanc | |
44 { | |
45 namespace Plugins | |
46 { | |
47 OrthancPluginResourceType Convert(ResourceType type) | |
48 { | |
49 switch (type) | |
50 { | |
51 case ResourceType_Patient: | |
52 return OrthancPluginResourceType_Patient; | |
53 | |
54 case ResourceType_Study: | |
55 return OrthancPluginResourceType_Study; | |
56 | |
57 case ResourceType_Series: | |
58 return OrthancPluginResourceType_Series; | |
59 | |
60 case ResourceType_Instance: | |
61 return OrthancPluginResourceType_Instance; | |
62 | |
63 default: | |
64 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
65 } | |
66 } | |
67 | |
68 | |
69 OrthancPluginChangeType Convert(ChangeType type) | |
70 { | |
71 switch (type) | |
72 { | |
73 case ChangeType_CompletedSeries: | |
74 return OrthancPluginChangeType_CompletedSeries; | |
75 | |
76 case ChangeType_Deleted: | |
77 return OrthancPluginChangeType_Deleted; | |
78 | |
79 case ChangeType_NewChildInstance: | |
80 return OrthancPluginChangeType_NewChildInstance; | |
81 | |
82 case ChangeType_NewInstance: | |
83 return OrthancPluginChangeType_NewInstance; | |
84 | |
85 case ChangeType_NewPatient: | |
86 return OrthancPluginChangeType_NewPatient; | |
87 | |
88 case ChangeType_NewSeries: | |
89 return OrthancPluginChangeType_NewSeries; | |
90 | |
91 case ChangeType_NewStudy: | |
92 return OrthancPluginChangeType_NewStudy; | |
93 | |
94 case ChangeType_StablePatient: | |
95 return OrthancPluginChangeType_StablePatient; | |
96 | |
97 case ChangeType_StableSeries: | |
98 return OrthancPluginChangeType_StableSeries; | |
99 | |
100 case ChangeType_StableStudy: | |
101 return OrthancPluginChangeType_StableStudy; | |
102 | |
103 default: | |
104 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
105 } | |
106 } | |
107 | |
108 | |
109 OrthancPluginPixelFormat Convert(PixelFormat format) | |
110 { | |
111 switch (format) | |
112 { | |
113 case PixelFormat_Grayscale16: | |
114 return OrthancPluginPixelFormat_Grayscale16; | |
115 | |
116 case PixelFormat_Grayscale8: | |
117 return OrthancPluginPixelFormat_Grayscale8; | |
118 | |
119 case PixelFormat_RGB24: | |
120 return OrthancPluginPixelFormat_RGB24; | |
121 | |
122 case PixelFormat_RGBA32: | |
123 return OrthancPluginPixelFormat_RGBA32; | |
124 | |
125 case PixelFormat_SignedGrayscale16: | |
126 return OrthancPluginPixelFormat_SignedGrayscale16; | |
127 | |
128 default: | |
129 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
130 } | |
131 } | |
132 | |
133 | |
134 PixelFormat Convert(OrthancPluginPixelFormat format) | |
135 { | |
136 switch (format) | |
137 { | |
138 case OrthancPluginPixelFormat_Grayscale16: | |
139 return PixelFormat_Grayscale16; | |
140 | |
141 case OrthancPluginPixelFormat_Grayscale8: | |
142 return PixelFormat_Grayscale8; | |
143 | |
144 case OrthancPluginPixelFormat_RGB24: | |
145 return PixelFormat_RGB24; | |
146 | |
147 case OrthancPluginPixelFormat_RGBA32: | |
148 return PixelFormat_RGBA32; | |
149 | |
150 case OrthancPluginPixelFormat_SignedGrayscale16: | |
151 return PixelFormat_SignedGrayscale16; | |
152 | |
153 default: | |
154 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
155 } | |
156 } | |
157 | |
158 | |
159 OrthancPluginContentType Convert(FileContentType type) | |
160 { | |
161 switch (type) | |
162 { | |
163 case FileContentType_Dicom: | |
164 return OrthancPluginContentType_Dicom; | |
165 | |
166 case FileContentType_DicomAsJson: | |
167 return OrthancPluginContentType_DicomAsJson; | |
168 | |
169 default: | |
170 return OrthancPluginContentType_Unknown; | |
171 } | |
172 } | |
173 | |
174 | |
175 FileContentType Convert(OrthancPluginContentType type) | |
176 { | |
177 switch (type) | |
178 { | |
179 case OrthancPluginContentType_Dicom: | |
180 return FileContentType_Dicom; | |
181 | |
182 case OrthancPluginContentType_DicomAsJson: | |
183 return FileContentType_DicomAsJson; | |
184 | |
185 default: | |
186 return FileContentType_Unknown; | |
187 } | |
188 } | |
189 } | |
190 } |