Mercurial > hg > orthanc
changeset 5675:2b65f25cb1c8 find-refactoring
more debug output
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 06 Jul 2024 15:00:45 +0200 |
parents | 74f3aab95886 |
children | b744a2cf408a |
files | OrthancServer/Sources/Database/FindResponse.cpp |
diffstat | 1 files changed, 29 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/FindResponse.cpp Sat Jul 06 14:43:46 2024 +0200 +++ b/OrthancServer/Sources/Database/FindResponse.cpp Sat Jul 06 15:00:45 2024 +0200 @@ -523,6 +523,18 @@ target[EnumerationToString(info.GetContentType())] = u; } + + static void DebugSetOfStrings(Json::Value& target, + const std::set<std::string>& values) + { + target = Json::arrayValue; + for (std::set<std::string>::const_iterator it = values.begin(); it != values.end(); ++it) + { + target.append(*it); + } + } + + void FindResponse::Resource::DebugExport(Json::Value& target, const FindRequest& request) const { @@ -575,27 +587,30 @@ { if (request.GetChildrenRetrieveSpecification(levels[i]).IsRetrieveIdentifiers()) { - const std::set<std::string>& ids = GetChildrenInformation(levels[i]).GetIdentifiers(); + DebugSetOfStrings(target[level]["Identifiers"], GetChildrenInformation(levels[i]).GetIdentifiers()); + } - Json::Value v = Json::arrayValue; - for (std::set<std::string>::const_iterator it = ids.begin(); it != ids.end(); ++it) - { - v.append(*it); - } - target[level]["Identifiers"] = v; + const std::set<MetadataType>& metadata = request.GetChildrenRetrieveSpecification(levels[i]).GetMetadata(); + for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) + { + std::set<std::string> values; + GetChildrenInformation(levels[i]).GetMetadataValues(values, *it); + DebugSetOfStrings(target[level]["Metadata"][EnumerationToString(*it)], values); + } + + const std::set<DicomTag>& tags = request.GetChildrenRetrieveSpecification(levels[i]).GetMainDicomTags(); + for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) + { + std::set<std::string> values; + GetChildrenInformation(levels[i]).GetMainDicomTagValues(values, *it); + DebugSetOfStrings(target[level]["MainDicomTags"][it->Format()], values); } } } if (request.IsRetrieveLabels()) { - Json::Value v = Json::arrayValue; - for (std::set<std::string>::const_iterator it = labels_.begin(); - it != labels_.end(); ++it) - { - v.append(*it); - } - target["Labels"] = v; + DebugSetOfStrings(target["Labels"], labels_); } if (request.IsRetrieveAttachments())