comparison OrthancServer/Sources/Database/FindResponse.cpp @ 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
comparison
equal deleted inserted replaced
5674:74f3aab95886 5675:2b65f25cb1c8
521 u.append(info.GetUuid()); 521 u.append(info.GetUuid());
522 u.append(static_cast<Json::UInt64>(info.GetUncompressedSize())); 522 u.append(static_cast<Json::UInt64>(info.GetUncompressedSize()));
523 target[EnumerationToString(info.GetContentType())] = u; 523 target[EnumerationToString(info.GetContentType())] = u;
524 } 524 }
525 525
526
527 static void DebugSetOfStrings(Json::Value& target,
528 const std::set<std::string>& values)
529 {
530 target = Json::arrayValue;
531 for (std::set<std::string>::const_iterator it = values.begin(); it != values.end(); ++it)
532 {
533 target.append(*it);
534 }
535 }
536
537
526 void FindResponse::Resource::DebugExport(Json::Value& target, 538 void FindResponse::Resource::DebugExport(Json::Value& target,
527 const FindRequest& request) const 539 const FindRequest& request) const
528 { 540 {
529 target = Json::objectValue; 541 target = Json::objectValue;
530 542
573 if (levels[i] != request.GetLevel() && 585 if (levels[i] != request.GetLevel() &&
574 IsResourceLevelAboveOrEqual(request.GetLevel(), levels[i])) 586 IsResourceLevelAboveOrEqual(request.GetLevel(), levels[i]))
575 { 587 {
576 if (request.GetChildrenRetrieveSpecification(levels[i]).IsRetrieveIdentifiers()) 588 if (request.GetChildrenRetrieveSpecification(levels[i]).IsRetrieveIdentifiers())
577 { 589 {
578 const std::set<std::string>& ids = GetChildrenInformation(levels[i]).GetIdentifiers(); 590 DebugSetOfStrings(target[level]["Identifiers"], GetChildrenInformation(levels[i]).GetIdentifiers());
579 591 }
580 Json::Value v = Json::arrayValue; 592
581 for (std::set<std::string>::const_iterator it = ids.begin(); it != ids.end(); ++it) 593 const std::set<MetadataType>& metadata = request.GetChildrenRetrieveSpecification(levels[i]).GetMetadata();
582 { 594 for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it)
583 v.append(*it); 595 {
584 } 596 std::set<std::string> values;
585 target[level]["Identifiers"] = v; 597 GetChildrenInformation(levels[i]).GetMetadataValues(values, *it);
598 DebugSetOfStrings(target[level]["Metadata"][EnumerationToString(*it)], values);
599 }
600
601 const std::set<DicomTag>& tags = request.GetChildrenRetrieveSpecification(levels[i]).GetMainDicomTags();
602 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
603 {
604 std::set<std::string> values;
605 GetChildrenInformation(levels[i]).GetMainDicomTagValues(values, *it);
606 DebugSetOfStrings(target[level]["MainDicomTags"][it->Format()], values);
586 } 607 }
587 } 608 }
588 } 609 }
589 610
590 if (request.IsRetrieveLabels()) 611 if (request.IsRetrieveLabels())
591 { 612 {
592 Json::Value v = Json::arrayValue; 613 DebugSetOfStrings(target["Labels"], labels_);
593 for (std::set<std::string>::const_iterator it = labels_.begin();
594 it != labels_.end(); ++it)
595 {
596 v.append(*it);
597 }
598 target["Labels"] = v;
599 } 614 }
600 615
601 if (request.IsRetrieveAttachments()) 616 if (request.IsRetrieveAttachments())
602 { 617 {
603 Json::Value v = Json::objectValue; 618 Json::Value v = Json::objectValue;