# HG changeset patch # User Sebastien Jodogne # Date 1725893027 -7200 # Node ID e2771185dad6335ef70d8ba522ff85b2851ae439 # Parent 0da33161acf78d1640db12a21ed30e3ab588e0db reorganization diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/CMakeLists.txt --- a/OrthancServer/CMakeLists.txt Mon Sep 09 16:37:52 2024 +0200 +++ b/OrthancServer/CMakeLists.txt Mon Sep 09 16:43:47 2024 +0200 @@ -126,6 +126,7 @@ ${CMAKE_SOURCE_DIR}/Sources/QueryRetrieveHandler.cpp ${CMAKE_SOURCE_DIR}/Sources/ResourceFinder.cpp ${CMAKE_SOURCE_DIR}/Sources/Search/DatabaseConstraint.cpp + ${CMAKE_SOURCE_DIR}/Sources/Search/DatabaseConstraints.cpp ${CMAKE_SOURCE_DIR}/Sources/Search/DatabaseLookup.cpp ${CMAKE_SOURCE_DIR}/Sources/Search/DicomTagConstraint.cpp ${CMAKE_SOURCE_DIR}/Sources/Search/HierarchicalMatcher.cpp diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/Sources/Database/FindRequest.h --- a/OrthancServer/Sources/Database/FindRequest.h Mon Sep 09 16:37:52 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.h Mon Sep 09 16:43:47 2024 +0200 @@ -24,7 +24,7 @@ #pragma once #include "../../../OrthancFramework/Sources/DicomFormat/DicomTag.h" -#include "../Search/DatabaseConstraint.h" +#include "../Search/DatabaseConstraints.h" #include "../Search/DicomTagConstraint.h" #include "../Search/ISqlLookupFormatter.h" #include "../ServerEnumerations.h" diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/Sources/Database/MainDicomTagsRegistry.h --- a/OrthancServer/Sources/Database/MainDicomTagsRegistry.h Mon Sep 09 16:37:52 2024 +0200 +++ b/OrthancServer/Sources/Database/MainDicomTagsRegistry.h Mon Sep 09 16:43:47 2024 +0200 @@ -24,6 +24,7 @@ #pragma once #include "../Search/DatabaseLookup.h" +#include "../Search/DatabaseConstraints.h" #include diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/Sources/Search/DatabaseConstraint.cpp --- a/OrthancServer/Sources/Search/DatabaseConstraint.cpp Mon Sep 09 16:37:52 2024 +0200 +++ b/OrthancServer/Sources/Search/DatabaseConstraint.cpp Mon Sep 09 16:43:47 2024 +0200 @@ -109,103 +109,4 @@ constraint.values = (tmpValues.empty() ? NULL : &tmpValues[0]); } #endif - - - void DatabaseConstraints::Clear() - { - for (size_t i = 0; i < constraints_.size(); i++) - { - assert(constraints_[i] != NULL); - delete constraints_[i]; - } - - constraints_.clear(); - } - - - void DatabaseConstraints::AddConstraint(DatabaseConstraint* constraint) - { - if (constraint == NULL) - { - throw OrthancException(ErrorCode_NullPointer); - } - else - { - constraints_.push_back(constraint); - } - } - - - const DatabaseConstraint& DatabaseConstraints::GetConstraint(size_t index) const - { - if (index >= constraints_.size()) - { - throw OrthancException(ErrorCode_ParameterOutOfRange); - } - else - { - assert(constraints_[index] != NULL); - return *constraints_[index]; - } - } - - - std::string DatabaseConstraints::Format() const - { - std::string s; - - for (size_t i = 0; i < constraints_.size(); i++) - { - assert(constraints_[i] != NULL); - const DatabaseConstraint& constraint = *constraints_[i]; - s += "Constraint " + boost::lexical_cast(i) + " at " + EnumerationToString(constraint.GetLevel()) + - ": " + constraint.GetTag().Format(); - - switch (constraint.GetConstraintType()) - { - case ConstraintType_Equal: - s += " == " + constraint.GetSingleValue(); - break; - - case ConstraintType_SmallerOrEqual: - s += " <= " + constraint.GetSingleValue(); - break; - - case ConstraintType_GreaterOrEqual: - s += " >= " + constraint.GetSingleValue(); - break; - - case ConstraintType_Wildcard: - s += " ~~ " + constraint.GetSingleValue(); - break; - - case ConstraintType_List: - { - s += " in [ "; - bool first = true; - for (size_t j = 0; j < constraint.GetValuesCount(); j++) - { - if (first) - { - first = false; - } - else - { - s += ", "; - } - s += constraint.GetValue(j); - } - s += "]"; - break; - } - - default: - throw OrthancException(ErrorCode_InternalError); - } - - s += "\n"; - } - - return s; - } } diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/Sources/Search/DatabaseConstraint.h --- a/OrthancServer/Sources/Search/DatabaseConstraint.h Mon Sep 09 16:37:52 2024 +0200 +++ b/OrthancServer/Sources/Search/DatabaseConstraint.h Mon Sep 09 16:43:47 2024 +0200 @@ -30,8 +30,6 @@ # include "../../Plugins/Include/orthanc/OrthancCDatabasePlugin.h" #endif -#include - namespace Orthanc { class DatabaseConstraint : public boost::noncopyable @@ -100,35 +98,4 @@ std::vector& tmpValues) const; #endif }; - - - class DatabaseConstraints : public boost::noncopyable - { - private: - std::deque constraints_; - - public: - ~DatabaseConstraints() - { - Clear(); - } - - void Clear(); - - void AddConstraint(DatabaseConstraint* constraint); // Takes ownership - - bool IsEmpty() const - { - return constraints_.empty(); - } - - size_t GetSize() const - { - return constraints_.size(); - } - - const DatabaseConstraint& GetConstraint(size_t index) const; - - std::string Format() const; - }; } diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/Sources/Search/DatabaseConstraints.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancServer/Sources/Search/DatabaseConstraints.cpp Mon Sep 09 16:43:47 2024 +0200 @@ -0,0 +1,132 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2023 Osimis S.A., Belgium + * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium + * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + **/ + + +#include "../PrecompiledHeadersServer.h" +#include "DatabaseConstraints.h" + +#include "../../../OrthancFramework/Sources/OrthancException.h" + +#include +#include + + +namespace Orthanc +{ + void DatabaseConstraints::Clear() + { + for (size_t i = 0; i < constraints_.size(); i++) + { + assert(constraints_[i] != NULL); + delete constraints_[i]; + } + + constraints_.clear(); + } + + + void DatabaseConstraints::AddConstraint(DatabaseConstraint* constraint) + { + if (constraint == NULL) + { + throw OrthancException(ErrorCode_NullPointer); + } + else + { + constraints_.push_back(constraint); + } + } + + + const DatabaseConstraint& DatabaseConstraints::GetConstraint(size_t index) const + { + if (index >= constraints_.size()) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + else + { + assert(constraints_[index] != NULL); + return *constraints_[index]; + } + } + + + std::string DatabaseConstraints::Format() const + { + std::string s; + + for (size_t i = 0; i < constraints_.size(); i++) + { + assert(constraints_[i] != NULL); + const DatabaseConstraint& constraint = *constraints_[i]; + s += "Constraint " + boost::lexical_cast(i) + " at " + EnumerationToString(constraint.GetLevel()) + + ": " + constraint.GetTag().Format(); + + switch (constraint.GetConstraintType()) + { + case ConstraintType_Equal: + s += " == " + constraint.GetSingleValue(); + break; + + case ConstraintType_SmallerOrEqual: + s += " <= " + constraint.GetSingleValue(); + break; + + case ConstraintType_GreaterOrEqual: + s += " >= " + constraint.GetSingleValue(); + break; + + case ConstraintType_Wildcard: + s += " ~~ " + constraint.GetSingleValue(); + break; + + case ConstraintType_List: + { + s += " in [ "; + bool first = true; + for (size_t j = 0; j < constraint.GetValuesCount(); j++) + { + if (first) + { + first = false; + } + else + { + s += ", "; + } + s += constraint.GetValue(j); + } + s += "]"; + break; + } + + default: + throw OrthancException(ErrorCode_InternalError); + } + + s += "\n"; + } + + return s; + } +} diff -r 0da33161acf7 -r e2771185dad6 OrthancServer/Sources/Search/DatabaseConstraints.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancServer/Sources/Search/DatabaseConstraints.h Mon Sep 09 16:43:47 2024 +0200 @@ -0,0 +1,61 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2023 Osimis S.A., Belgium + * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium + * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + **/ + + +#pragma once + +#include "DatabaseConstraint.h" + +#include + +namespace Orthanc +{ + class DatabaseConstraints : public boost::noncopyable + { + private: + std::deque constraints_; + + public: + ~DatabaseConstraints() + { + Clear(); + } + + void Clear(); + + void AddConstraint(DatabaseConstraint* constraint); // Takes ownership + + bool IsEmpty() const + { + return constraints_.empty(); + } + + size_t GetSize() const + { + return constraints_.size(); + } + + const DatabaseConstraint& GetConstraint(size_t index) const; + + std::string Format() const; + }; +}