Mercurial > hg > orthanc
changeset 1725:a7c05bbfaf6a db-changes
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 20 Oct 2015 11:21:36 +0200 |
parents | 7e0b5e413c7c |
children | 9d8bb6bc2890 1ae29c5e52fb |
files | Core/DicomFormat/DicomTag.cpp Core/DicomFormat/DicomTag.h OrthancServer/DatabaseWrapper.cpp OrthancServer/DatabaseWrapper.h OrthancServer/DatabaseWrapperBase.cpp OrthancServer/ServerIndex.cpp OrthancServer/ServerToolbox.cpp |
diffstat | 7 files changed, 21 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomFormat/DicomTag.cpp Tue Oct 20 11:02:06 2015 +0200 +++ b/Core/DicomFormat/DicomTag.cpp Tue Oct 20 11:21:36 2015 +0200 @@ -243,14 +243,4 @@ throw OrthancException(ErrorCode_ParameterOutOfRange); } } - - - bool DicomTag::IsIdentifier() const - { - return (*this == DICOM_TAG_PATIENT_ID || - *this == DICOM_TAG_STUDY_INSTANCE_UID || - *this == DICOM_TAG_ACCESSION_NUMBER || - *this == DICOM_TAG_SERIES_INSTANCE_UID || - *this == DICOM_TAG_SOP_INSTANCE_UID); - } }
--- a/Core/DicomFormat/DicomTag.h Tue Oct 20 11:02:06 2015 +0200 +++ b/Core/DicomFormat/DicomTag.h Tue Oct 20 11:21:36 2015 +0200 @@ -86,8 +86,6 @@ static void AddTagsForModule(std::set<DicomTag>& target, DicomModule module); - - bool IsIdentifier() const; }; // Aliases for the most useful tags
--- a/OrthancServer/DatabaseWrapper.cpp Tue Oct 20 11:02:06 2015 +0200 +++ b/OrthancServer/DatabaseWrapper.cpp Tue Oct 20 11:21:36 2015 +0200 @@ -464,19 +464,6 @@ } - void DatabaseWrapper::LookupIdentifier(std::list<int64_t>& target, - const DicomTag& tag, - const std::string& value) - { - if (!tag.IsIdentifier()) - { - throw OrthancException(ErrorCode_ParameterOutOfRange); - } - - base_.LookupIdentifier(target, tag, value); - } - - void DatabaseWrapper::GetAllMetadata(std::map<MetadataType, std::string>& target, int64_t id) {
--- a/OrthancServer/DatabaseWrapper.h Tue Oct 20 11:02:06 2015 +0200 +++ b/OrthancServer/DatabaseWrapper.h Tue Oct 20 11:21:36 2015 +0200 @@ -317,7 +317,10 @@ virtual void LookupIdentifier(std::list<int64_t>& target, const DicomTag& tag, - const std::string& value); + const std::string& value) + { + base_.LookupIdentifier(target, tag, value); + } virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, int64_t id);
--- a/OrthancServer/DatabaseWrapperBase.cpp Tue Oct 20 11:02:06 2015 +0200 +++ b/OrthancServer/DatabaseWrapperBase.cpp Tue Oct 20 11:21:36 2015 +0200 @@ -669,6 +669,12 @@ const DicomTag& tag, const std::string& value) { + assert(tag == DICOM_TAG_PATIENT_ID || + tag == DICOM_TAG_STUDY_INSTANCE_UID || + tag == DICOM_TAG_SERIES_INSTANCE_UID || + tag == DICOM_TAG_SOP_INSTANCE_UID || + tag == DICOM_TAG_ACCESSION_NUMBER); + SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT id FROM DicomIdentifiers WHERE tagGroup=? AND tagElement=? and value=?");
--- a/OrthancServer/ServerIndex.cpp Tue Oct 20 11:02:06 2015 +0200 +++ b/OrthancServer/ServerIndex.cpp Tue Oct 20 11:21:36 2015 +0200 @@ -1893,6 +1893,12 @@ const std::string& value, ResourceType type) { + assert(tag == DICOM_TAG_PATIENT_ID || + tag == DICOM_TAG_STUDY_INSTANCE_UID || + tag == DICOM_TAG_SERIES_INSTANCE_UID || + tag == DICOM_TAG_SOP_INSTANCE_UID || + tag == DICOM_TAG_ACCESSION_NUMBER); + result.clear(); boost::mutex::scoped_lock lock(mutex_);
--- a/OrthancServer/ServerToolbox.cpp Tue Oct 20 11:02:06 2015 +0200 +++ b/OrthancServer/ServerToolbox.cpp Tue Oct 20 11:21:36 2015 +0200 @@ -184,7 +184,11 @@ { std::string s = value->AsString(); - if (!tag.IsIdentifier()) + if (tag != DICOM_TAG_PATIENT_ID && + tag != DICOM_TAG_STUDY_INSTANCE_UID && + tag != DICOM_TAG_SERIES_INSTANCE_UID && + tag != DICOM_TAG_SOP_INSTANCE_UID && + tag != DICOM_TAG_ACCESSION_NUMBER) { s = NormalizeIdentifierTag(s); }