Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1508:86394eb9f5bb | 1509:0586ed8897f1 |
---|---|
324 | 324 |
325 ForwardAnswers(target); | 325 ForwardAnswers(target); |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 void OrthancPluginDatabase::GetAllPublicIds(std::list<std::string>& target, | |
330 ResourceType resourceType, | |
331 size_t since, | |
332 size_t limit) | |
333 { | |
334 // TODO add the corresponding primitives to the SDK | |
335 | |
336 target.clear(); | |
337 | |
338 if (limit == 0) | |
339 { | |
340 return; | |
341 } | |
342 | |
343 std::list<std::string> tmp; | |
344 GetAllPublicIds(tmp, resourceType); | |
345 | |
346 if (tmp.size() <= since) | |
347 { | |
348 // Not enough results => empty answer | |
349 return; | |
350 } | |
351 | |
352 std::list<std::string>::iterator start = tmp.begin(); | |
353 std::advance(start, since); | |
354 | |
355 if (tmp.size() - since <= limit) | |
356 { | |
357 tmp.splice(start, target); | |
358 } | |
359 else | |
360 { | |
361 std::list<std::string>::iterator end = start; | |
362 std::advance(end, limit); | |
363 tmp.splice(tmp.begin(), target, start, end); | |
364 } | |
365 } | |
366 | |
367 | |
329 | 368 |
330 void OrthancPluginDatabase::GetChanges(std::list<ServerIndexChange>& target /*out*/, | 369 void OrthancPluginDatabase::GetChanges(std::list<ServerIndexChange>& target /*out*/, |
331 bool& done /*out*/, | 370 bool& done /*out*/, |
332 int64_t since, | 371 int64_t since, |
333 uint32_t maxResults) | 372 uint32_t maxResults) |