comparison OrthancServer/ServerContext.cpp @ 1757:98abb8d7f905 db-changes

ServerContext::Apply lookup
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Oct 2015 12:29:12 +0100
parents 06addfcd1d4c
children 318c2e83c2bd
comparison
equal deleted inserted replaced
1756:03b030680e3d 1757:98abb8d7f905
541 return (plugins_ != NULL); 541 return (plugins_ != NULL);
542 #else 542 #else
543 return false; 543 return false;
544 #endif 544 #endif
545 } 545 }
546
547
548 bool ServerContext::Apply(std::vector<std::string>& result,
549 const ::Orthanc::LookupResource& lookup,
550 size_t maxResults)
551 {
552 std::vector<std::string> resources, instances;
553 GetIndex().FindCandidates(resources, instances, lookup);
554
555 assert(resources.size() == instances.size());
556
557 for (size_t i = 0; i < instances.size(); i++)
558 {
559 Json::Value dicom;
560 ReadJson(dicom, instances[i]);
561
562 if (lookup.IsMatch(dicom))
563 {
564 if (maxResults != 0 &&
565 result.size() >= maxResults)
566 {
567 return false; // too many results
568 }
569 else
570 {
571 result.push_back(resources[i]);
572 }
573 }
574 }
575
576 return true; // finished
577 }
578
546 } 579 }