Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 5572:f0dc99bc811c
removed circular dependency of OrthancPluginsCppWrapper with Orthanc::Logging
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Apr 2024 15:50:01 +0200 |
parents | 0b18690c1935 |
children | d7eaa568da15 |
comparison
equal
deleted
inserted
replaced
5571:addccb1590d2 | 5572:f0dc99bc811c |
---|---|
51 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \ | 51 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \ |
52 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision)))) | 52 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision)))) |
53 #endif | 53 #endif |
54 | 54 |
55 | 55 |
56 #if !defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE) | |
57 #define ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(major, minor, revision) \ | |
58 (ORTHANC_VERSION_MAJOR > major || \ | |
59 (ORTHANC_VERSION_MAJOR == major && \ | |
60 (ORTHANC_VERSION_MINOR > minor || \ | |
61 (ORTHANC_VERSION_MINOR == minor && \ | |
62 ORTHANC_VERSION_REVISION >= revision)))) | |
63 #endif | |
64 | |
65 | |
66 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0) | 56 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0) |
67 // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0 | 57 // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0 |
68 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1 | 58 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1 |
69 #else | 59 #else |
70 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0 | 60 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0 |
125 # define HAS_ORTHANC_PLUGIN_WEBDAV 1 | 115 # define HAS_ORTHANC_PLUGIN_WEBDAV 1 |
126 #else | 116 #else |
127 # define HAS_ORTHANC_PLUGIN_WEBDAV 0 | 117 # define HAS_ORTHANC_PLUGIN_WEBDAV 0 |
128 #endif | 118 #endif |
129 | 119 |
120 | |
121 // Macro "ORTHANC_PLUGINS_DEPRECATED" tags a function as having been deprecated | |
122 #if (__cplusplus >= 201402L) // C++14 | |
123 # define ORTHANC_PLUGINS_DEPRECATED(f) [[deprecated]] f | |
124 #elif defined(__GNUC__) || defined(__clang__) | |
125 # define ORTHANC_PLUGINS_DEPRECATED(f) f __attribute__((deprecated)) | |
126 #elif defined(_MSC_VER) | |
127 # define ORTHANC_PLUGINS_DEPRECATED(f) __declspec(deprecated) f | |
128 #else | |
129 # define ORTHANC_PLUGINS_DEPRECATED | |
130 #endif | |
131 | |
132 | |
133 #if !defined(__ORTHANC_FILE__) | |
134 # if defined(_MSC_VER) | |
135 # pragma message("Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries") | |
136 # else | |
137 # warning Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries | |
138 # endif | |
139 # define __ORTHANC_FILE__ __FILE__ | |
140 #endif | |
141 | |
142 #define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Error, __ORTHANC_FILE__, __LINE__, msg); | |
143 #define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Warning, __ORTHANC_FILE__, __LINE__, msg); | |
144 #define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Info, __ORTHANC_FILE__, __LINE__, msg); | |
130 | 145 |
131 | 146 |
132 namespace OrthancPlugins | 147 namespace OrthancPlugins |
133 { | 148 { |
134 typedef void (*RestCallback) (OrthancPluginRestOutput* output, | 149 typedef void (*RestCallback) (OrthancPluginRestOutput* output, |
135 const char* url, | 150 const char* url, |
136 const OrthancPluginHttpRequest* request); | 151 const OrthancPluginHttpRequest* request); |
137 | 152 |
138 void SetGlobalContext(OrthancPluginContext* context); | 153 void SetGlobalContext(OrthancPluginContext* context); |
139 | 154 |
140 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) && ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 4) | 155 void SetGlobalContext(OrthancPluginContext* context, |
141 void SetGlobalContext(OrthancPluginContext* context, const char* pluginName); | 156 const char* pluginName); |
142 #endif | |
143 | 157 |
144 void ResetGlobalContext(); | 158 void ResetGlobalContext(); |
145 | 159 |
146 bool HasGlobalContext(); | 160 bool HasGlobalContext(); |
147 | 161 |
639 | 653 |
640 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) | 654 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) |
641 const char* AutodetectMimeType(const std::string& path); | 655 const char* AutodetectMimeType(const std::string& path); |
642 #endif | 656 #endif |
643 | 657 |
644 void LogError(const std::string& message); // From Orthanc 1.12.4, use LOG(ERROR) to display the plugin name, file and line (First set a plugin name in Orthanc::Logging::InitializePluginContext) | 658 void LogMessage(OrthancPluginLogLevel level, |
645 | 659 const char* file, |
646 void LogWarning(const std::string& message); // From Orthanc 1.12.4, use LOG(WARNING) to display the plugin name, file and line (First set a plugin name in Orthanc::Logging::InitializePluginContext) | 660 uint32_t line, |
647 | 661 const std::string& message); |
648 void LogInfo(const std::string& message); // From Orthanc 1.12.4, use LOG(INFO) to display the plugin name, file and line (First set a plugin name in Orthanc::Logging::InitializePluginContext) | 662 |
663 // Use macro ORTHANC_PLUGINS_LOG_ERROR() instead | |
664 ORTHANC_PLUGINS_DEPRECATED(void LogError(const std::string& message)); | |
665 | |
666 // Use macro ORTHANC_PLUGINS_LOG_WARNING() instead | |
667 ORTHANC_PLUGINS_DEPRECATED(void LogWarning(const std::string& message)); | |
668 | |
669 // Use macro ORTHANC_PLUGINS_LOG_INFO() instead | |
670 ORTHANC_PLUGINS_DEPRECATED(void LogInfo(const std::string& message)); | |
649 | 671 |
650 void ReportMinimalOrthancVersion(unsigned int major, | 672 void ReportMinimalOrthancVersion(unsigned int major, |
651 unsigned int minor, | 673 unsigned int minor, |
652 unsigned int revision); | 674 unsigned int revision); |
653 | 675 |