Mercurial > hg > orthanc-python
comparison Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp @ 153:c78ec45f3695
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 16 Mar 2024 11:55:27 +0100 |
parents | 93c6f12bf339 |
children | 6fada29b6759 |
comparison
equal
deleted
inserted
replaced
150:3c98306828de | 153:c78ec45f3695 |
---|---|
1 /** | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
4 * Department, University Hospital of Liege, Belgium | 4 * Department, University Hospital of Liege, Belgium |
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium | 5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | 6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
7 * | 7 * |
8 * This program is free software: you can redistribute it and/or | 8 * This program is free software: you can redistribute it and/or |
9 * modify it under the terms of the GNU General Public License as | 9 * modify it under the terms of the GNU General Public License as |
10 * published by the Free Software Foundation, either version 3 of the | 10 * published by the Free Software Foundation, either version 3 of the |
11 * License, or (at your option) any later version. | 11 * License, or (at your option) any later version. |
2605 | 2605 |
2606 int priority = 0; | 2606 int priority = 0; |
2607 | 2607 |
2608 if (body.isMember(KEY_PRIORITY)) | 2608 if (body.isMember(KEY_PRIORITY)) |
2609 { | 2609 { |
2610 if (body[KEY_PRIORITY].type() != Json::booleanValue) | 2610 if (body[KEY_PRIORITY].type() != Json::intValue) |
2611 { | 2611 { |
2612 #if HAS_ORTHANC_EXCEPTION == 1 | 2612 #if HAS_ORTHANC_EXCEPTION == 1 |
2613 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, | 2613 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, |
2614 "Option \"" + std::string(KEY_PRIORITY) + | 2614 "Option \"" + std::string(KEY_PRIORITY) + |
2615 "\" must be an integer"); | 2615 "\" must be an integer"); |
4024 for (uint32_t i = 0; i < request->headersCount; ++i) | 4024 for (uint32_t i = 0; i < request->headersCount; ++i) |
4025 { | 4025 { |
4026 result[request->headersKeys[i]] = request->headersValues[i]; | 4026 result[request->headersKeys[i]] = request->headersValues[i]; |
4027 } | 4027 } |
4028 } | 4028 } |
4029 | |
4030 #if !ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) | |
4031 static void SetPluginProperty(const std::string& pluginIdentifier, | |
4032 _OrthancPluginProperty property, | |
4033 const std::string& value) | |
4034 { | |
4035 _OrthancPluginSetPluginProperty params; | |
4036 params.plugin = pluginIdentifier.c_str(); | |
4037 params.property = property; | |
4038 params.value = value.c_str(); | |
4039 | |
4040 GetGlobalContext()->InvokeService(GetGlobalContext(), _OrthancPluginService_SetPluginProperty, ¶ms); | |
4041 } | |
4042 #endif | |
4043 | |
4044 void SetRootUri(const std::string& pluginIdentifier, | |
4045 const std::string& uri) | |
4046 { | |
4047 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) | |
4048 OrthancPluginSetRootUri2(GetGlobalContext(), pluginIdentifier.c_str(), uri.c_str()); | |
4049 #else | |
4050 SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_RootUri, uri); | |
4051 #endif | |
4052 } | |
4053 | |
4054 void SetDescription(const std::string& pluginIdentifier, | |
4055 const std::string& description) | |
4056 { | |
4057 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) | |
4058 OrthancPluginSetDescription2(GetGlobalContext(), pluginIdentifier.c_str(), description.c_str()); | |
4059 #else | |
4060 SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_Description, description); | |
4061 #endif | |
4062 } | |
4063 | |
4064 void ExtendOrthancExplorer(const std::string& pluginIdentifier, | |
4065 const std::string& javascript) | |
4066 { | |
4067 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) | |
4068 OrthancPluginExtendOrthancExplorer2(GetGlobalContext(), pluginIdentifier.c_str(), javascript.c_str()); | |
4069 #else | |
4070 SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_OrthancExplorer, javascript); | |
4071 #endif | |
4072 } | |
4029 } | 4073 } |