comparison Framework/Plugins/PluginInitialization.cpp @ 129:534759b0cf14

use of macros to report performance warnings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 08 Feb 2019 20:12:29 +0100
parents 3424a54ca2ee
children 4cd7e45b671e
comparison
equal deleted inserted replaced
128:39b2f29ddf3c 129:534759b0cf14
63 LOG(ERROR) << "Your version of Orthanc (" << context->orthancVersion 63 LOG(ERROR) << "Your version of Orthanc (" << context->orthancVersion
64 << ") must be above 0.9.5 to run this plugin"; 64 << ") must be above 0.9.5 to run this plugin";
65 return false; 65 return false;
66 } 66 }
67 67
68 if (OrthancPluginCheckVersionAdvanced(context, 1, 5, 4) == 1) 68 if (OrthancPluginCheckVersionAdvanced(context, 1, 4, 0) == 1)
69 { 69 {
70 ImplicitTransaction::SetErrorOnDoubleExecution(true); 70 ImplicitTransaction::SetErrorOnDoubleExecution(true);
71 }
72
73 if (OrthancPluginCheckVersionAdvanced(context,
74 ORTHANC_OPTIMAL_VERSION_MAJOR,
75 ORTHANC_OPTIMAL_VERSION_MINOR,
76 ORTHANC_OPTIMAL_VERSION_REVISION) == 1)
77 {
71 isOptimal = true; 78 isOptimal = true;
72 } 79 }
73 80
74 useFallback = false; 81 useFallback = false;
75 # endif 82 # endif
108 115
109 int major = boost::lexical_cast<int>(tokens[0]); 116 int major = boost::lexical_cast<int>(tokens[0]);
110 int minor = boost::lexical_cast<int>(tokens[1]); 117 int minor = boost::lexical_cast<int>(tokens[1]);
111 int revision = boost::lexical_cast<int>(tokens[2]); 118 int revision = boost::lexical_cast<int>(tokens[2]);
112 119
113 isOptimal = (major > 1 || 120 isOptimal = (major > ORTHANC_OPTIMAL_VERSION_MAJOR ||
114 (major == 1 && minor > 5) || 121 (major == ORTHANC_OPTIMAL_VERSION_MAJOR &&
115 (major == 1 && minor == 5 && revision >= 4)); 122 minor > ORTHANC_OPTIMAL_VERSION_MINOR) ||
123 (major == ORTHANC_OPTIMAL_VERSION_MAJOR &&
124 minor == ORTHANC_OPTIMAL_VERSION_MINOR &&
125 revision >= ORTHANC_OPTIMAL_VERSION_REVISION));
116 } 126 }
117 } 127 }
118 128
119 if (!isOptimal && 129 if (!isOptimal &&
120 isIndex) 130 isIndex)
121 { 131 {
122 LOG(WARNING) << "Performance warning in " << dbms 132 LOG(WARNING) << "Performance warning in " << dbms
123 << " index: Your version of Orthanc (" 133 << " index: Your version of Orthanc ("
124 << context->orthancVersion << ") should be upgraded to 1.5.4 " 134 << context->orthancVersion << ") should be upgraded to "
125 << "to benefit from best performance"; 135 << ORTHANC_OPTIMAL_VERSION_MAJOR << "."
136 << ORTHANC_OPTIMAL_VERSION_MINOR << "."
137 << ORTHANC_OPTIMAL_VERSION_REVISION
138 << " to benefit from best performance";
126 } 139 }
127 140
128 141
129 std::string description = ("Stores the Orthanc " + 142 std::string description = ("Stores the Orthanc " +
130 std::string(isIndex ? "index" : "storage area") + 143 std::string(isIndex ? "index" : "storage area") +