# HG changeset patch # User Sebastien Jodogne # Date 1445332896 -7200 # Node ID a7c05bbfaf6a991a857e15aad040bf96ade62fe9 # Parent 7e0b5e413c7cb69b3783631fc7d0b69c69d63a70 refactoring diff -r 7e0b5e413c7c -r a7c05bbfaf6a Core/DicomFormat/DicomTag.cpp --- 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); - } } diff -r 7e0b5e413c7c -r a7c05bbfaf6a Core/DicomFormat/DicomTag.h --- 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& target, DicomModule module); - - bool IsIdentifier() const; }; // Aliases for the most useful tags diff -r 7e0b5e413c7c -r a7c05bbfaf6a OrthancServer/DatabaseWrapper.cpp --- 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& 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& target, int64_t id) { diff -r 7e0b5e413c7c -r a7c05bbfaf6a OrthancServer/DatabaseWrapper.h --- 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& target, const DicomTag& tag, - const std::string& value); + const std::string& value) + { + base_.LookupIdentifier(target, tag, value); + } virtual void GetAllMetadata(std::map& target, int64_t id); diff -r 7e0b5e413c7c -r a7c05bbfaf6a OrthancServer/DatabaseWrapperBase.cpp --- 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=?"); diff -r 7e0b5e413c7c -r a7c05bbfaf6a OrthancServer/ServerIndex.cpp --- 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_); diff -r 7e0b5e413c7c -r a7c05bbfaf6a OrthancServer/ServerToolbox.cpp --- 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); }