comparison RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h @ 2124:16c01cc201e7

updated copyright, as Osimis is not active on Orthanc anymore
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 17:00:29 +0200
parents 11bc8a304038
children 2965172977a4
comparison
equal deleted inserted replaced
2121:4cc9e4a54a89 2124:16c01cc201e7
125 # define HAS_ORTHANC_PLUGIN_WEBDAV 1 125 # define HAS_ORTHANC_PLUGIN_WEBDAV 1
126 #else 126 #else
127 # define HAS_ORTHANC_PLUGIN_WEBDAV 0 127 # define HAS_ORTHANC_PLUGIN_WEBDAV 0
128 #endif 128 #endif
129 129
130 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
131 # define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 1
132 #else
133 # define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 0
134 #endif
135
136
137 // Macro to tag a function as having been deprecated
138 #if (__cplusplus >= 201402L) // C++14
139 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) [[deprecated]] f
140 #elif defined(__GNUC__) || defined(__clang__)
141 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) f __attribute__((deprecated))
142 #elif defined(_MSC_VER)
143 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) __declspec(deprecated) f
144 #else
145 # define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED
146 #endif
147
148
149 #if !defined(__ORTHANC_FILE__)
150 # if defined(_MSC_VER)
151 # pragma message("Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries")
152 # else
153 # warning Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries
154 # endif
155 # define __ORTHANC_FILE__ __FILE__
156 #endif
157
158
159 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
160 # define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Error, __ORTHANC_FILE__, __LINE__, msg)
161 # define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Warning, __ORTHANC_FILE__, __LINE__, msg)
162 # define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Info, __ORTHANC_FILE__, __LINE__, msg)
163 #else
164 # define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogError(msg)
165 # define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogWarning(msg)
166 # define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogInfo(msg)
167 #endif
130 168
131 169
132 namespace OrthancPlugins 170 namespace OrthancPlugins
133 { 171 {
134 typedef void (*RestCallback) (OrthancPluginRestOutput* output, 172 typedef void (*RestCallback) (OrthancPluginRestOutput* output,
135 const char* url, 173 const char* url,
136 const OrthancPluginHttpRequest* request); 174 const OrthancPluginHttpRequest* request);
137 175
138 void SetGlobalContext(OrthancPluginContext* context); 176 void SetGlobalContext(OrthancPluginContext* context);
177
178 void SetGlobalContext(OrthancPluginContext* context,
179 const char* pluginName);
139 180
140 void ResetGlobalContext(); 181 void ResetGlobalContext();
141 182
142 bool HasGlobalContext(); 183 bool HasGlobalContext();
143 184
635 676
636 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) 677 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
637 const char* AutodetectMimeType(const std::string& path); 678 const char* AutodetectMimeType(const std::string& path);
638 #endif 679 #endif
639 680
681 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
682 void LogMessage(OrthancPluginLogLevel level,
683 const char* file,
684 uint32_t line,
685 const std::string& message);
686 #endif
687
688 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
689 // Use macro ORTHANC_PLUGINS_LOG_ERROR() instead
690 ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogError(const std::string& message));
691 #else
640 void LogError(const std::string& message); 692 void LogError(const std::string& message);
641 693 #endif
694
695 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
696 // Use macro ORTHANC_PLUGINS_LOG_WARNING() instead
697 ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogWarning(const std::string& message));
698 #else
642 void LogWarning(const std::string& message); 699 void LogWarning(const std::string& message);
643 700 #endif
701
702 #if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
703 // Use macro ORTHANC_PLUGINS_LOG_INFO() instead
704 ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogInfo(const std::string& message));
705 #else
644 void LogInfo(const std::string& message); 706 void LogInfo(const std::string& message);
707 #endif
645 708
646 void ReportMinimalOrthancVersion(unsigned int major, 709 void ReportMinimalOrthancVersion(unsigned int major,
647 unsigned int minor, 710 unsigned int minor,
648 unsigned int revision); 711 unsigned int revision);
649 712