# HG changeset patch # User Sebastien Jodogne # Date 1481361464 -3600 # Node ID 95d1d758abb72eeabd2b48f7ed1d3fd03a58ea94 # Parent c02f6ec404d8975abe35454d32aedea7bc4af33a FindMatcher::IsMatch diff -r c02f6ec404d8 -r 95d1d758abb7 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp --- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Sat Dec 10 10:05:16 2016 +0100 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Sat Dec 10 10:17:44 2016 +0100 @@ -836,12 +836,12 @@ FindMatcher::FindMatcher(OrthancPluginContext* context, - const OrthancPluginWorklistQuery* query) : + const OrthancPluginWorklistQuery* worklist) : context_(context), matcher_(NULL), - query_(query) + worklist_(worklist) { - if (query_ == NULL) + if (worklist_ == NULL) { ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_ParameterOutOfRange); } @@ -852,7 +852,7 @@ const void* query, uint32_t size) : context_(context), - query_(NULL) + worklist_(NULL) { matcher_ = OrthancPluginCreateFindMatcher(context_, query, size); if (matcher_ == NULL) @@ -864,6 +864,8 @@ FindMatcher::~FindMatcher() { + // The "worklist_" field + if (matcher_ != NULL) { OrthancPluginFreeFindMatcher(context_, matcher_); @@ -871,6 +873,41 @@ } + + bool FindMatcher::IsMatch(const void* dicom, + uint32_t size) const + { + int32_t result; + + if (matcher_ != NULL) + { + result = OrthancPluginFindMatcherIsMatch(context_, matcher_, dicom, size); + } + else if (worklist_ != NULL) + { + result = OrthancPluginWorklistIsMatch(context_, worklist_, dicom, size); + } + else + { + ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_InternalError); + } + + if (result == 0) + { + return false; + } + else if (result == 1) + { + return true; + } + else + { + ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_InternalError); + } + } + + + bool RestApiGet(Json::Value& result, OrthancPluginContext* context, const std::string& uri, diff -r c02f6ec404d8 -r 95d1d758abb7 Plugins/Samples/Common/OrthancPluginCppWrapper.h --- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h Sat Dec 10 10:05:16 2016 +0100 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h Sat Dec 10 10:17:44 2016 +0100 @@ -339,17 +339,20 @@ private: OrthancPluginContext* context_; OrthancPluginFindMatcher* matcher_; - const OrthancPluginWorklistQuery* query_; + const OrthancPluginWorklistQuery* worklist_; public: FindMatcher(OrthancPluginContext* context, - const OrthancPluginWorklistQuery* query); + const OrthancPluginWorklistQuery* worklist); FindMatcher(OrthancPluginContext* context, const void* query, uint32_t size); ~FindMatcher(); + + bool IsMatch(const void* dicom, + uint32_t size) const; };