Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPluginDatabase.cpp @ 1509:0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 10 Aug 2015 10:01:59 +0200 |
parents | f967bdf8534e |
children | ffc9f36103b9 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPluginDatabase.cpp Fri Aug 07 20:14:49 2015 +0200 +++ b/Plugins/Engine/OrthancPluginDatabase.cpp Mon Aug 10 10:01:59 2015 +0200 @@ -326,6 +326,45 @@ } + void OrthancPluginDatabase::GetAllPublicIds(std::list<std::string>& target, + ResourceType resourceType, + size_t since, + size_t limit) + { + // TODO add the corresponding primitives to the SDK + + target.clear(); + + if (limit == 0) + { + return; + } + + std::list<std::string> tmp; + GetAllPublicIds(tmp, resourceType); + + if (tmp.size() <= since) + { + // Not enough results => empty answer + return; + } + + std::list<std::string>::iterator start = tmp.begin(); + std::advance(start, since); + + if (tmp.size() - since <= limit) + { + tmp.splice(start, target); + } + else + { + std::list<std::string>::iterator end = start; + std::advance(end, limit); + tmp.splice(tmp.begin(), target, start, end); + } + } + + void OrthancPluginDatabase::GetChanges(std::list<ServerIndexChange>& target /*out*/, bool& done /*out*/,