diff OrthancServer/ServerIndex.cpp @ 521:2c739f76d0bb

lookup tag values
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Aug 2013 14:50:23 +0200
parents 935e8c7e0b18
children b2357f1f026f
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp	Tue Aug 20 13:39:42 2013 +0200
+++ b/OrthancServer/ServerIndex.cpp	Thu Aug 29 14:50:23 2013 +0200
@@ -1468,4 +1468,42 @@
     unstableResources_.AddOrMakeMostRecent(id, type);
     //LOG(INFO) << "Unstable resource: " << EnumerationToString(type) << " " << id;
   }
+
+
+
+  void ServerIndex::LookupTagValue(std::list<std::string>& result,
+                                   DicomTag tag,
+                                   const std::string& value)
+  {
+    result.clear();
+
+    boost::mutex::scoped_lock lock(mutex_);
+
+    std::list<int64_t> id;
+    db_->LookupTagValue(id, tag, value);
+
+    for (std::list<int64_t>::const_iterator 
+           it = id.begin(); it != id.end(); it++)
+    {
+      result.push_back(db_->GetPublicId(*it));
+    }
+  }
+
+
+  void ServerIndex::LookupTagValue(std::list<std::string>& result,
+                                   const std::string& value)
+  {
+    result.clear();
+
+    boost::mutex::scoped_lock lock(mutex_);
+
+    std::list<int64_t> id;
+    db_->LookupTagValue(id, value);
+
+    for (std::list<int64_t>::const_iterator 
+           it = id.begin(); it != id.end(); it++)
+    {
+      result.push_back(db_->GetPublicId(*it));
+    }
+  }
 }