Mercurial > hg > orthanc
changeset 5676:b744a2cf408a find-refactoring
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 06 Jul 2024 15:04:28 +0200 |
parents | 2b65f25cb1c8 |
children | dc96401dbe88 |
files | OrthancServer/Sources/Database/Compatibility/GenericFind.cpp OrthancServer/Sources/Database/FindRequest.cpp OrthancServer/Sources/Database/FindRequest.h OrthancServer/Sources/Database/FindResponse.cpp OrthancServer/Sources/ResourceFinder.cpp |
diffstat | 5 files changed, 57 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Sat Jul 06 15:00:45 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Sat Jul 06 15:04:28 2024 +0200 @@ -240,7 +240,7 @@ return ResourceType_Patient; case ResourceType_Study: - if (request.GetParentRetrieveSpecification(ResourceType_Patient).IsOfInterest()) + if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) { return ResourceType_Patient; } @@ -250,11 +250,11 @@ } case ResourceType_Series: - if (request.GetParentRetrieveSpecification(ResourceType_Patient).IsOfInterest()) + if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) { return ResourceType_Patient; } - else if (request.GetParentRetrieveSpecification(ResourceType_Study).IsOfInterest()) + else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) { return ResourceType_Study; } @@ -264,15 +264,15 @@ } case ResourceType_Instance: - if (request.GetParentRetrieveSpecification(ResourceType_Patient).IsOfInterest()) + if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) { return ResourceType_Patient; } - else if (request.GetParentRetrieveSpecification(ResourceType_Study).IsOfInterest()) + else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) { return ResourceType_Study; } - else if (request.GetParentRetrieveSpecification(ResourceType_Series).IsOfInterest()) + else if (request.GetParentSpecification(ResourceType_Series).IsOfInterest()) { return ResourceType_Series; } @@ -292,15 +292,15 @@ switch (request.GetLevel()) { case ResourceType_Patient: - if (request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsOfInterest()) + if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) { return ResourceType_Instance; } - else if (request.GetChildrenRetrieveSpecification(ResourceType_Series).IsOfInterest()) + else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) { return ResourceType_Series; } - else if (request.GetChildrenRetrieveSpecification(ResourceType_Study).IsOfInterest()) + else if (request.GetChildrenSpecification(ResourceType_Study).IsOfInterest()) { return ResourceType_Study; } @@ -310,11 +310,11 @@ } case ResourceType_Study: - if (request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsOfInterest()) + if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) { return ResourceType_Instance; } - else if (request.GetChildrenRetrieveSpecification(ResourceType_Series).IsOfInterest()) + else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) { return ResourceType_Series; } @@ -324,7 +324,7 @@ } case ResourceType_Series: - if (request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsOfInterest()) + if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) { return ResourceType_Instance; } @@ -422,12 +422,12 @@ throw OrthancException(ErrorCode_DatabasePlugin); } - if (request.GetParentRetrieveSpecification(currentLevel).IsRetrieveMainDicomTags()) + if (request.GetParentSpecification(currentLevel).IsRetrieveMainDicomTags()) { RetrieveMainDicomTags(*resource, currentLevel, currentId); } - if (request.GetParentRetrieveSpecification(currentLevel).IsRetrieveMetadata()) + if (request.GetParentSpecification(currentLevel).IsRetrieveMetadata()) { transaction_.GetAllMetadata(resource->GetMetadata(currentLevel), currentId); } @@ -472,7 +472,7 @@ { ResourceType childrenLevel = GetChildResourceType(currentLevel); - if (request.GetChildrenRetrieveSpecification(childrenLevel).IsRetrieveIdentifiers()) + if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers()) { for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) { @@ -486,7 +486,7 @@ } } - const std::set<MetadataType>& metadata = request.GetChildrenRetrieveSpecification(childrenLevel).GetMetadata(); + const std::set<MetadataType>& metadata = request.GetChildrenSpecification(childrenLevel).GetMetadata(); for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) { @@ -502,7 +502,7 @@ } } - const std::set<DicomTag>& mainDicomTags = request.GetChildrenRetrieveSpecification(childrenLevel).GetMainDicomTags(); + const std::set<DicomTag>& mainDicomTags = request.GetChildrenSpecification(childrenLevel).GetMainDicomTags(); if (childrenLevel != bottomLevel || !mainDicomTags.empty()) @@ -547,7 +547,7 @@ } if (request.IsRetrieveOneInstanceIdentifier() && - !request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsRetrieveIdentifiers()) + !request.GetChildrenSpecification(ResourceType_Instance).IsRetrieveIdentifiers()) { int64_t currentId = internalId; ResourceType currentLevel = level;
--- a/OrthancServer/Sources/Database/FindRequest.cpp Sat Jul 06 15:00:45 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.cpp Sat Jul 06 15:04:28 2024 +0200 @@ -32,7 +32,7 @@ namespace Orthanc { - FindRequest::ParentRetrieveSpecification& FindRequest::GetParentRetrieveSpecification(ResourceType level) + FindRequest::ParentSpecification& FindRequest::GetParentSpecification(ResourceType level) { if (!IsResourceLevelAboveOrEqual(level, level_)) { @@ -56,7 +56,7 @@ } - FindRequest::ChildrenRetrieveSpecification& FindRequest::GetChildrenRetrieveSpecification(ResourceType level) + FindRequest::ChildrenSpecification& FindRequest::GetChildrenSpecification(ResourceType level) { if (!IsResourceLevelAboveOrEqual(level_, level)) {
--- a/OrthancServer/Sources/Database/FindRequest.h Sat Jul 06 15:00:45 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.h Sat Jul 06 15:04:28 2024 +0200 @@ -155,14 +155,14 @@ }; - class ParentRetrieveSpecification : public boost::noncopyable + class ParentSpecification : public boost::noncopyable { private: bool mainDicomTags_; bool metadata_; public: - ParentRetrieveSpecification() : + ParentSpecification() : mainDicomTags_(false), metadata_(false) { @@ -195,7 +195,7 @@ }; - class ChildrenRetrieveSpecification : public boost::noncopyable + class ChildrenSpecification : public boost::noncopyable { private: bool identifiers_; @@ -203,7 +203,7 @@ std::set<DicomTag> mainDicomTags_; public: - ChildrenRetrieveSpecification() : + ChildrenSpecification() : identifiers_(false) { } @@ -263,12 +263,12 @@ bool retrieveLabels_; bool retrieveAttachments_; bool retrieveParentIdentifier_; - ParentRetrieveSpecification retrieveParentPatient_; - ParentRetrieveSpecification retrieveParentStudy_; - ParentRetrieveSpecification retrieveParentSeries_; - ChildrenRetrieveSpecification retrieveChildrenStudies_; - ChildrenRetrieveSpecification retrieveChildrenSeries_; - ChildrenRetrieveSpecification retrieveChildrenInstances_; + ParentSpecification retrieveParentPatient_; + ParentSpecification retrieveParentStudy_; + ParentSpecification retrieveParentSeries_; + ChildrenSpecification retrieveChildrenStudies_; + ChildrenSpecification retrieveChildrenSeries_; + ChildrenSpecification retrieveChildrenInstances_; bool retrieveOneInstanceIdentifier_; std::unique_ptr<MainDicomTagsRegistry> mainDicomTagsRegistry_; @@ -396,18 +396,18 @@ return retrieveParentIdentifier_; } - ParentRetrieveSpecification& GetParentRetrieveSpecification(ResourceType level); + ParentSpecification& GetParentSpecification(ResourceType level); - const ParentRetrieveSpecification& GetParentRetrieveSpecification(ResourceType level) const + const ParentSpecification& GetParentSpecification(ResourceType level) const { - return const_cast<FindRequest&>(*this).GetParentRetrieveSpecification(level); + return const_cast<FindRequest&>(*this).GetParentSpecification(level); } - ChildrenRetrieveSpecification& GetChildrenRetrieveSpecification(ResourceType level); + ChildrenSpecification& GetChildrenSpecification(ResourceType level); - const ChildrenRetrieveSpecification& GetChildrenRetrieveSpecification(ResourceType level) const + const ChildrenSpecification& GetChildrenSpecification(ResourceType level) const { - return const_cast<FindRequest&>(*this).GetChildrenRetrieveSpecification(level); + return const_cast<FindRequest&>(*this).GetChildrenSpecification(level); } void SetRetrieveOneInstanceIdentifier(bool retrieve); @@ -415,7 +415,7 @@ bool IsRetrieveOneInstanceIdentifier() const { return (retrieveOneInstanceIdentifier_ || - GetChildrenRetrieveSpecification(ResourceType_Instance).IsRetrieveIdentifiers()); + GetChildrenSpecification(ResourceType_Instance).IsRetrieveIdentifiers()); } }; }
--- a/OrthancServer/Sources/Database/FindResponse.cpp Sat Jul 06 15:00:45 2024 +0200 +++ b/OrthancServer/Sources/Database/FindResponse.cpp Sat Jul 06 15:04:28 2024 +0200 @@ -569,14 +569,14 @@ if (levels[i] != request.GetLevel() && IsResourceLevelAboveOrEqual(levels[i], request.GetLevel())) { - if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags()) + if (request.GetParentSpecification(levels[i]).IsRetrieveMainDicomTags()) { DicomMap m; GetMainDicomTags(m, levels[i]); DebugDicomMap(target[level]["MainDicomTags"], m); } - if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags()) + if (request.GetParentSpecification(levels[i]).IsRetrieveMainDicomTags()) { DebugMetadata(target[level]["Metadata"], GetMetadata(levels[i])); } @@ -585,12 +585,12 @@ if (levels[i] != request.GetLevel() && IsResourceLevelAboveOrEqual(request.GetLevel(), levels[i])) { - if (request.GetChildrenRetrieveSpecification(levels[i]).IsRetrieveIdentifiers()) + if (request.GetChildrenSpecification(levels[i]).IsRetrieveIdentifiers()) { DebugSetOfStrings(target[level]["Identifiers"], GetChildrenInformation(levels[i]).GetIdentifiers()); } - const std::set<MetadataType>& metadata = request.GetChildrenRetrieveSpecification(levels[i]).GetMetadata(); + const std::set<MetadataType>& metadata = request.GetChildrenSpecification(levels[i]).GetMetadata(); for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) { std::set<std::string> values; @@ -598,7 +598,7 @@ DebugSetOfStrings(target[level]["Metadata"][EnumerationToString(*it)], values); } - const std::set<DicomTag>& tags = request.GetChildrenRetrieveSpecification(levels[i]).GetMainDicomTags(); + const std::set<DicomTag>& tags = request.GetChildrenSpecification(levels[i]).GetMainDicomTags(); for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) { std::set<std::string> values;
--- a/OrthancServer/Sources/ResourceFinder.cpp Sat Jul 06 15:00:45 2024 +0200 +++ b/OrthancServer/Sources/ResourceFinder.cpp Sat Jul 06 15:04:28 2024 +0200 @@ -43,7 +43,7 @@ { requestedComputedTags_.insert(tag); hasRequestedTags_ = true; - request_.GetChildrenRetrieveSpecification(childLevel).SetRetrieveIdentifiers(true); + request_.GetChildrenSpecification(childLevel).SetRetrieveIdentifiers(true); } } @@ -426,17 +426,17 @@ switch (level) { case ResourceType_Patient: - request_.GetChildrenRetrieveSpecification(ResourceType_Study).SetRetrieveIdentifiers(true); + request_.GetChildrenSpecification(ResourceType_Study).SetRetrieveIdentifiers(true); break; case ResourceType_Study: - request_.GetChildrenRetrieveSpecification(ResourceType_Series).SetRetrieveIdentifiers(true); + request_.GetChildrenSpecification(ResourceType_Series).SetRetrieveIdentifiers(true); request_.SetRetrieveParentIdentifier(true); break; case ResourceType_Series: - request_.GetChildrenRetrieveSpecification(ResourceType_Instance).AddMetadata(MetadataType_Instance_IndexInSeries); // required for the SeriesStatus - request_.GetChildrenRetrieveSpecification(ResourceType_Instance).SetRetrieveIdentifiers(true); + request_.GetChildrenSpecification(ResourceType_Instance).AddMetadata(MetadataType_Instance_IndexInSeries); // required for the SeriesStatus + request_.GetChildrenSpecification(ResourceType_Instance).SetRetrieveIdentifiers(true); request_.SetRetrieveParentIdentifier(true); break; @@ -458,8 +458,8 @@ { if (request_.GetLevel() == ResourceType_Patient) { - request_.GetParentRetrieveSpecification(ResourceType_Patient).SetRetrieveMainDicomTags(true); - request_.GetParentRetrieveSpecification(ResourceType_Patient).SetRetrieveMetadata(true); + request_.GetParentSpecification(ResourceType_Patient).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Patient).SetRetrieveMetadata(true); requestedPatientTags_.insert(tag); } else @@ -468,8 +468,8 @@ * This comes from the fact that patient-level tags are copied * at the study level, as implemented by "ResourcesContent::AddResource()". **/ - request_.GetParentRetrieveSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); - request_.GetParentRetrieveSpecification(ResourceType_Study).SetRetrieveMetadata(true); + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMetadata(true); requestedStudyTags_.insert(tag); } @@ -486,8 +486,8 @@ } else { - request_.GetParentRetrieveSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); - request_.GetParentRetrieveSpecification(ResourceType_Study).SetRetrieveMetadata(true); + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMetadata(true); requestedStudyTags_.insert(tag); } @@ -505,8 +505,8 @@ } else { - request_.GetParentRetrieveSpecification(ResourceType_Series).SetRetrieveMainDicomTags(true); - request_.GetParentRetrieveSpecification(ResourceType_Series).SetRetrieveMetadata(true); + request_.GetParentSpecification(ResourceType_Series).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Series).SetRetrieveMetadata(true); requestedSeriesTags_.insert(tag); } @@ -561,13 +561,13 @@ { requestedComputedTags_.insert(tag); hasRequestedTags_ = true; - request_.GetChildrenRetrieveSpecification(ResourceType_Instance).AddMetadata(MetadataType_Instance_SopClassUid); + request_.GetChildrenSpecification(ResourceType_Instance).AddMetadata(MetadataType_Instance_SopClassUid); } else if (tag == DICOM_TAG_MODALITIES_IN_STUDY) { requestedComputedTags_.insert(tag); hasRequestedTags_ = true; - request_.GetChildrenRetrieveSpecification(ResourceType_Series).AddMainDicomTag(DICOM_TAG_MODALITY); + request_.GetChildrenSpecification(ResourceType_Series).AddMainDicomTag(DICOM_TAG_MODALITY); } else if (tag == DICOM_TAG_INSTANCE_AVAILABILITY) {