comparison OrthancServer/ServerContext.cpp @ 2876:ae8e72009e64

notes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Oct 2018 20:09:35 +0200
parents 8aa6aef11b70
children a27b0e9a3fd9
comparison
equal deleted inserted replaced
2875:edfd98a2b6c4 2876:ae8e72009e64
764 return false; 764 return false;
765 #endif 765 #endif
766 } 766 }
767 767
768 768
769 void ServerContext::Apply(std::list<std::string>& result, 769 void ServerContext::Apply(bool& isComplete,
770 std::list<std::string>& result,
770 const ::Orthanc::LookupResource& lookup, 771 const ::Orthanc::LookupResource& lookup,
771 size_t since, 772 size_t since,
772 size_t limit) 773 size_t limit)
773 { 774 {
774 result.clear(); 775 result.clear();
776 isComplete = true;
775 777
776 std::vector<std::string> resources, instances; 778 std::vector<std::string> resources, instances;
777 GetIndex().FindCandidates(resources, instances, lookup); 779 GetIndex().FindCandidates(resources, instances, lookup);
778 780
779 assert(resources.size() == instances.size()); 781 assert(resources.size() == instances.size());
780 782
781 size_t skipped = 0; 783 size_t skipped = 0;
782 for (size_t i = 0; i < instances.size(); i++) 784 for (size_t i = 0; i < instances.size(); i++)
783 { 785 {
786 // TODO - Don't read the full JSON from the disk if only "main
787 // DICOM tags" are to be returned
784 Json::Value dicom; 788 Json::Value dicom;
785 ReadDicomAsJson(dicom, instances[i]); 789 ReadDicomAsJson(dicom, instances[i]);
786 790
787 if (lookup.IsMatch(dicom)) 791 if (lookup.IsMatch(dicom))
788 { 792 {
791 skipped++; 795 skipped++;
792 } 796 }
793 else if (limit != 0 && 797 else if (limit != 0 &&
794 result.size() >= limit) 798 result.size() >= limit)
795 { 799 {
800 isComplete = false;
796 return; // too many results 801 return; // too many results
797 } 802 }
798 else 803 else
799 { 804 {
800 result.push_back(resources[i]); 805 result.push_back(resources[i]);