Mercurial > hg > orthanc
changeset 5867:022ce5323d09 find-refactoring tip
fix children count in GenericFind
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 07 Nov 2024 10:27:28 +0100 |
parents | 5c484b4f99d5 |
children | |
files | OrthancServer/Sources/Database/Compatibility/GenericFind.cpp OrthancServer/Sources/Database/FindRequest.h OrthancServer/Sources/Database/FindResponse.h |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Wed Nov 06 19:25:30 2024 +0100 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Thu Nov 07 10:27:28 2024 +0100 @@ -550,7 +550,8 @@ { ResourceType childrenLevel = GetChildResourceType(currentLevel); - if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers()) + if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers() || + request.GetChildrenSpecification(childrenLevel).IsRetrieveCount()) { for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) { @@ -561,6 +562,7 @@ { resource->AddChildIdentifier(childrenLevel, *it2); } + resource->IncrementChildrenCount(childrenLevel, ids.size()); } }
--- a/OrthancServer/Sources/Database/FindRequest.h Wed Nov 06 19:25:30 2024 +0100 +++ b/OrthancServer/Sources/Database/FindRequest.h Thu Nov 07 10:27:28 2024 +0100 @@ -236,7 +236,7 @@ bool IsOfInterest() const { - return (identifiers_ || !metadata_.empty() || !mainDicomTags_.empty()); + return (identifiers_ || !metadata_.empty() || !mainDicomTags_.empty() || count_); } };
--- a/OrthancServer/Sources/Database/FindResponse.h Wed Nov 06 19:25:30 2024 +0100 +++ b/OrthancServer/Sources/Database/FindResponse.h Thu Nov 07 10:27:28 2024 +0100 @@ -97,6 +97,11 @@ count_ = count; } + void IncrementCount(uint64_t count) + { + count_ += count; + } + uint64_t GetCount() const { return count_; @@ -294,6 +299,12 @@ GetChildrenInformation(level).SetCount(count); } + void IncrementChildrenCount(ResourceType level, + uint64_t count) + { + GetChildrenInformation(level).IncrementCount(count); + } + uint64_t GetChildrenCount(ResourceType level) const { return GetChildrenInformation(level).GetCount();