# HG changeset patch # User Sebastien Jodogne # Date 1481365498 -3600 # Node ID b1d93286b3151c9e0660a921d05f417cf53263da # Parent 95d1d758abb72eeabd2b48f7ed1d3fd03a58ea94 refactoring diff -r 95d1d758abb7 -r b1d93286b315 Plugins/Samples/Common/OrthancPluginCppWrapper.h --- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h Sat Dec 10 10:17:44 2016 +0100 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h Sat Dec 10 11:24:58 2016 +0100 @@ -353,6 +353,11 @@ bool IsMatch(const void* dicom, uint32_t size) const; + + bool IsMatch(const MemoryBuffer& dicom) const + { + return IsMatch(dicom.GetData(), dicom.GetSize()); + } }; diff -r 95d1d758abb7 -r b1d93286b315 Plugins/Samples/ModalityWorklists/Plugin.cpp --- a/Plugins/Samples/ModalityWorklists/Plugin.cpp Sat Dec 10 10:17:44 2016 +0100 +++ b/Plugins/Samples/ModalityWorklists/Plugin.cpp Sat Dec 10 11:24:58 2016 +0100 @@ -34,14 +34,15 @@ /** * This is the main function for matching a DICOM worklist against a query. **/ -static void MatchWorklist(OrthancPluginWorklistAnswers* answers, - const OrthancPluginWorklistQuery* query, +static void MatchWorklist(OrthancPluginWorklistAnswers* answers, + const OrthancPluginWorklistQuery* query, + const OrthancPlugins::FindMatcher& matcher, const std::string& path) { OrthancPlugins::MemoryBuffer dicom(context_); dicom.ReadFile(path); - if (OrthancPluginWorklistIsMatch(context_, query, dicom.GetData(), dicom.GetSize())) + if (matcher.IsMatch(dicom)) { // This DICOM file matches the worklist query, add it to the answers OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer @@ -77,6 +78,8 @@ std::string(remoteAet) + ":\n" + json.toStyledString()); } + OrthancPlugins::FindMatcher matcher(context_, query); + fs::path source(folder_); fs::directory_iterator end; @@ -94,7 +97,7 @@ if (extension == ".wl") { - MatchWorklist(answers, query, it->path().string()); + MatchWorklist(answers, query, matcher, it->path().string()); } } }