diff Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 2212:c02f6ec404d8

OrthancPlugins::FindMatcher
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 10 Dec 2016 10:05:16 +0100
parents 27106f7e3759
children 95d1d758abb7
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Sat Dec 10 09:41:15 2016 +0100
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Sat Dec 10 10:05:16 2016 +0100
@@ -835,6 +835,42 @@
   }
 
 
+  FindMatcher::FindMatcher(OrthancPluginContext*              context,
+                           const OrthancPluginWorklistQuery*  query) :
+    context_(context),
+    matcher_(NULL),
+    query_(query)
+  {
+    if (query_ == NULL)
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
+  FindMatcher::FindMatcher(OrthancPluginContext*  context,
+                           const void*            query,
+                           uint32_t               size) :
+    context_(context),
+    query_(NULL)
+  {
+    matcher_ = OrthancPluginCreateFindMatcher(context_, query, size);
+    if (matcher_ == NULL)
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_InternalError);
+    }
+  }
+
+
+  FindMatcher::~FindMatcher()
+  {
+    if (matcher_ != NULL)
+    {
+      OrthancPluginFreeFindMatcher(context_, matcher_);
+    }
+  }
+
+
   bool RestApiGet(Json::Value& result,
                   OrthancPluginContext* context,
                   const std::string& uri,