comparison Sources/Autogenerated/sdk_OrthancPluginStorageArea.impl.h @ 75:cbfc72a53970

refactoring calls to PythonLock::RaiseException()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Aug 2021 16:59:59 +0200
parents 32de70a1e4c7
children e7ff5efb100d
comparison
equal deleted inserted replaced
73:da73be4b361b 75:cbfc72a53970
95 { 95 {
96 PythonLock::LogCall("Calling method OrthancPluginStorageAreaCreate() on object of class OrthancPluginStorageArea"); 96 PythonLock::LogCall("Calling method OrthancPluginStorageAreaCreate() on object of class OrthancPluginStorageArea");
97 97
98 if (self->object_ == NULL) 98 if (self->object_ == NULL)
99 { 99 {
100 // TODO: RAISE
101 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer);
102 PyErr_SetString(PyExc_ValueError, "Invalid object"); 100 PyErr_SetString(PyExc_ValueError, "Invalid object");
103 return NULL; 101 return NULL;
104 } 102 }
105 103
106 const char* arg0 = NULL; 104 const char* arg0 = NULL;
108 unsigned long long arg2 = 0; 106 unsigned long long arg2 = 0;
109 long int arg3 = 0; 107 long int arg3 = 0;
110 108
111 if (!PyArg_ParseTuple(args, "ss*Kl", &arg0, &arg1, &arg2, &arg3)) 109 if (!PyArg_ParseTuple(args, "ss*Kl", &arg0, &arg1, &arg2, &arg3))
112 { 110 {
113 // TODO => RAISE : https://stackoverflow.com/questions/60832317
114 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); 111 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)");
115 return NULL; 112 return NULL;
116 } 113 }
117 OrthancPluginErrorCode code = OrthancPluginStorageAreaCreate(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1.buf, arg2, static_cast<OrthancPluginContentType>(arg3)); 114 OrthancPluginErrorCode code = OrthancPluginStorageAreaCreate(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1.buf, arg2, static_cast<OrthancPluginContentType>(arg3));
118 PyBuffer_Release(&arg1); 115 PyBuffer_Release(&arg1);
122 Py_INCREF(Py_None); 119 Py_INCREF(Py_None);
123 return Py_None; 120 return Py_None;
124 } 121 }
125 else 122 else
126 { 123 {
127 // TODO => RAISE : https://stackoverflow.com/questions/60832317 124 PythonLock::RaiseException(code);
128 //PythonLock::RaiseException(module, code);
129 PyErr_SetString(PyExc_ValueError, "Internal error");
130 return NULL; 125 return NULL;
131 } 126 }
132 } 127 }
133 128
134 static PyObject *sdk_OrthancPluginStorageArea_OrthancPluginStorageAreaRead( 129 static PyObject *sdk_OrthancPluginStorageArea_OrthancPluginStorageAreaRead(
136 { 131 {
137 PythonLock::LogCall("Calling method OrthancPluginStorageAreaRead() on object of class OrthancPluginStorageArea"); 132 PythonLock::LogCall("Calling method OrthancPluginStorageAreaRead() on object of class OrthancPluginStorageArea");
138 133
139 if (self->object_ == NULL) 134 if (self->object_ == NULL)
140 { 135 {
141 // TODO: RAISE
142 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer);
143 PyErr_SetString(PyExc_ValueError, "Invalid object"); 136 PyErr_SetString(PyExc_ValueError, "Invalid object");
144 return NULL; 137 return NULL;
145 } 138 }
146 139
147 const char* arg0 = NULL; 140 const char* arg0 = NULL;
148 long int arg1 = 0; 141 long int arg1 = 0;
149 142
150 if (!PyArg_ParseTuple(args, "sl", &arg0, &arg1)) 143 if (!PyArg_ParseTuple(args, "sl", &arg0, &arg1))
151 { 144 {
152 // TODO => RAISE : https://stackoverflow.com/questions/60832317
153 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 145 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
154 return NULL; 146 return NULL;
155 } 147 }
156 OrthancPlugins::MemoryBuffer buffer; 148 OrthancPlugins::MemoryBuffer buffer;
157 OrthancPluginErrorCode code = OrthancPluginStorageAreaRead(OrthancPlugins::GetGlobalContext(), *buffer, self->object_, arg0, static_cast<OrthancPluginContentType>(arg1)); 149 OrthancPluginErrorCode code = OrthancPluginStorageAreaRead(OrthancPlugins::GetGlobalContext(), *buffer, self->object_, arg0, static_cast<OrthancPluginContentType>(arg1));
160 { 152 {
161 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 153 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
162 } 154 }
163 else 155 else
164 { 156 {
165 // TODO => RAISE : https://stackoverflow.com/questions/60832317 157 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
166 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError);
167 PyErr_SetString(PyExc_ValueError, "Internal error");
168 return NULL; 158 return NULL;
169 } 159 }
170 } 160 }
171 161
172 static PyObject *sdk_OrthancPluginStorageArea_OrthancPluginStorageAreaRemove( 162 static PyObject *sdk_OrthancPluginStorageArea_OrthancPluginStorageAreaRemove(
174 { 164 {
175 PythonLock::LogCall("Calling method OrthancPluginStorageAreaRemove() on object of class OrthancPluginStorageArea"); 165 PythonLock::LogCall("Calling method OrthancPluginStorageAreaRemove() on object of class OrthancPluginStorageArea");
176 166
177 if (self->object_ == NULL) 167 if (self->object_ == NULL)
178 { 168 {
179 // TODO: RAISE
180 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer);
181 PyErr_SetString(PyExc_ValueError, "Invalid object"); 169 PyErr_SetString(PyExc_ValueError, "Invalid object");
182 return NULL; 170 return NULL;
183 } 171 }
184 172
185 const char* arg0 = NULL; 173 const char* arg0 = NULL;
186 long int arg1 = 0; 174 long int arg1 = 0;
187 175
188 if (!PyArg_ParseTuple(args, "sl", &arg0, &arg1)) 176 if (!PyArg_ParseTuple(args, "sl", &arg0, &arg1))
189 { 177 {
190 // TODO => RAISE : https://stackoverflow.com/questions/60832317
191 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 178 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
192 return NULL; 179 return NULL;
193 } 180 }
194 OrthancPluginErrorCode code = OrthancPluginStorageAreaRemove(OrthancPlugins::GetGlobalContext(), self->object_, arg0, static_cast<OrthancPluginContentType>(arg1)); 181 OrthancPluginErrorCode code = OrthancPluginStorageAreaRemove(OrthancPlugins::GetGlobalContext(), self->object_, arg0, static_cast<OrthancPluginContentType>(arg1));
195 182
199 Py_INCREF(Py_None); 186 Py_INCREF(Py_None);
200 return Py_None; 187 return Py_None;
201 } 188 }
202 else 189 else
203 { 190 {
204 // TODO => RAISE : https://stackoverflow.com/questions/60832317 191 PythonLock::RaiseException(code);
205 //PythonLock::RaiseException(module, code);
206 PyErr_SetString(PyExc_ValueError, "Internal error");
207 return NULL; 192 return NULL;
208 } 193 }
209 } 194 }
210 195
211 static PyObject *sdk_OrthancPluginStorageArea_OrthancPluginReconstructMainDicomTags( 196 static PyObject *sdk_OrthancPluginStorageArea_OrthancPluginReconstructMainDicomTags(
213 { 198 {
214 PythonLock::LogCall("Calling method OrthancPluginReconstructMainDicomTags() on object of class OrthancPluginStorageArea"); 199 PythonLock::LogCall("Calling method OrthancPluginReconstructMainDicomTags() on object of class OrthancPluginStorageArea");
215 200
216 if (self->object_ == NULL) 201 if (self->object_ == NULL)
217 { 202 {
218 // TODO: RAISE
219 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer);
220 PyErr_SetString(PyExc_ValueError, "Invalid object"); 203 PyErr_SetString(PyExc_ValueError, "Invalid object");
221 return NULL; 204 return NULL;
222 } 205 }
223 206
224 long int arg0 = 0; 207 long int arg0 = 0;
225 208
226 if (!PyArg_ParseTuple(args, "l", &arg0)) 209 if (!PyArg_ParseTuple(args, "l", &arg0))
227 { 210 {
228 // TODO => RAISE : https://stackoverflow.com/questions/60832317
229 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 211 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
230 return NULL; 212 return NULL;
231 } 213 }
232 OrthancPluginErrorCode code = OrthancPluginReconstructMainDicomTags(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginResourceType>(arg0)); 214 OrthancPluginErrorCode code = OrthancPluginReconstructMainDicomTags(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginResourceType>(arg0));
233 215
237 Py_INCREF(Py_None); 219 Py_INCREF(Py_None);
238 return Py_None; 220 return Py_None;
239 } 221 }
240 else 222 else
241 { 223 {
242 // TODO => RAISE : https://stackoverflow.com/questions/60832317 224 PythonLock::RaiseException(code);
243 //PythonLock::RaiseException(module, code);
244 PyErr_SetString(PyExc_ValueError, "Internal error");
245 return NULL; 225 return NULL;
246 } 226 }
247 } 227 }
248 228
249 229