comparison Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h @ 77:1e396fb509ca default

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 22:44:10 +0200
parents 3f43bfbea00e
children
comparison
equal deleted inserted replaced
76:7ae450b0edb7 77:1e396fb509ca
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-2024 Osimis S.A., Belgium 5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium 7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
7 * 8 *
8 * This program is free software: you can redistribute it and/or 9 * This program is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 10 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation, either version 3 of the 11 * published by the Free Software Foundation, either version 3 of the
125 # define HAS_ORTHANC_PLUGIN_WEBDAV 1 126 # define HAS_ORTHANC_PLUGIN_WEBDAV 1
126 #else 127 #else
127 # define HAS_ORTHANC_PLUGIN_WEBDAV 0 128 # define HAS_ORTHANC_PLUGIN_WEBDAV 0
128 #endif 129 #endif
129 130
131 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
132 # define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 1
133 #else
134 # define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 0
135 #endif
136
137
138 // Macro to tag a function as having been deprecated
139 #if (__cplusplus >= 201402L) // C++14
140 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) [[deprecated]] f
141 #elif defined(__GNUC__) || defined(__clang__)
142 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) f __attribute__((deprecated))
143 #elif defined(_MSC_VER)
144 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) __declspec(deprecated) f
145 #else
146 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED
147 #endif
148
149
150 #if !defined(__ORTHANC_FILE__)
151 # if defined(_MSC_VER)
152 # pragma message("Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries")
153 # else
154 # warning Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries
155 # endif
156 # define __ORTHANC_FILE__ __FILE__
157 #endif
158
159
160 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
161 # define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Error, __ORTHANC_FILE__, __LINE__, msg)
162 # define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Warning, __ORTHANC_FILE__, __LINE__, msg)
163 # define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Info, __ORTHANC_FILE__, __LINE__, msg)
164 #else
165 # define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogError(msg)
166 # define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogWarning(msg)
167 # define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogInfo(msg)
168 #endif
130 169
131 170
132 namespace OrthancPlugins 171 namespace OrthancPlugins
133 { 172 {
134 typedef void (*RestCallback) (OrthancPluginRestOutput* output, 173 typedef void (*RestCallback) (OrthancPluginRestOutput* output,
135 const char* url, 174 const char* url,
136 const OrthancPluginHttpRequest* request); 175 const OrthancPluginHttpRequest* request);
137 176
138 void SetGlobalContext(OrthancPluginContext* context); 177 void SetGlobalContext(OrthancPluginContext* context);
178
179 void SetGlobalContext(OrthancPluginContext* context,
180 const char* pluginName);
139 181
140 void ResetGlobalContext(); 182 void ResetGlobalContext();
141 183
142 bool HasGlobalContext(); 184 bool HasGlobalContext();
143 185
635 677
636 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) 678 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
637 const char* AutodetectMimeType(const std::string& path); 679 const char* AutodetectMimeType(const std::string& path);
638 #endif 680 #endif
639 681
682 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
683 void LogMessage(OrthancPluginLogLevel level,
684 const char* file,
685 uint32_t line,
686 const std::string& message);
687 #endif
688
689 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
690 // Use macro ORTHANC_PLUGINS_LOG_ERROR() instead
691 ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogError(const std::string& message));
692 #else
640 void LogError(const std::string& message); 693 void LogError(const std::string& message);
641 694 #endif
695
696 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
697 // Use macro ORTHANC_PLUGINS_LOG_WARNING() instead
698 ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogWarning(const std::string& message));
699 #else
642 void LogWarning(const std::string& message); 700 void LogWarning(const std::string& message);
643 701 #endif
702
703 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
704 // Use macro ORTHANC_PLUGINS_LOG_INFO() instead
705 ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogInfo(const std::string& message));
706 #else
644 void LogInfo(const std::string& message); 707 void LogInfo(const std::string& message);
708 #endif
645 709
646 void ReportMinimalOrthancVersion(unsigned int major, 710 void ReportMinimalOrthancVersion(unsigned int major,
647 unsigned int minor, 711 unsigned int minor,
648 unsigned int revision); 712 unsigned int revision);
649 713