# HG changeset patch # User Sebastien Jodogne # Date 1546617173 -3600 # Node ID c829758b9ca0a5f9f273b858aec3aba06e30867a # Parent 195ba4cbac3f31706dc6b237693394fd3e569604 reorganization diff -r 195ba4cbac3f -r c829758b9ca0 CMakeLists.txt --- a/CMakeLists.txt Fri Jan 04 16:42:55 2019 +0100 +++ b/CMakeLists.txt Fri Jan 04 16:52:53 2019 +0100 @@ -71,9 +71,9 @@ OrthancServer/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/QueryRetrieveHandler.cpp OrthancServer/SQLiteDatabaseWrapper.cpp - OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.cpp OrthancServer/Search/Compatibility/DatabaseLookup.cpp OrthancServer/Search/Compatibility/ICreateInstance.cpp + OrthancServer/Search/Compatibility/ILookupResources.cpp OrthancServer/Search/Compatibility/SetOfResources.cpp OrthancServer/Search/DatabaseConstraint.cpp OrthancServer/Search/DatabaseLookup.cpp diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -45,6 +45,8 @@ #include "../ServerToolbox.h" #include "../SliceOrdering.h" +#include "../../Plugins/Engine/OrthancPlugins.h" + namespace Orthanc { diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.cpp --- a/OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.cpp Fri Jan 04 16:42:55 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2019 Osimis S.A., 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. - * - * In addition, as a special exception, the copyright holders of this - * program give permission to link the code of its release with the - * OpenSSL project's "OpenSSL" library (or with modified versions of it - * that use the same license as the "OpenSSL" library), and distribute - * the linked executables. You must obey the GNU General Public License - * in all respects for all of the code used other than "OpenSSL". If you - * modify file(s) with this exception, you may extend this exception to - * your version of the file(s), but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. If you delete this exception statement from all source files - * in the program, then also delete it here. - * - * 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 "CompatibilityDatabaseWrapper.h" - -#include "DatabaseLookup.h" - -namespace Orthanc -{ - namespace Compatibility - { - void CompatibilityDatabaseWrapper::Apply( - IDatabaseWrapper& database, - CompatibilityDatabaseWrapper& compatibility, - std::list& resourcesId, - std::list* instancesId, - const std::vector& lookup, - ResourceType queryLevel, - size_t limit) - { - Compatibility::DatabaseLookup compat(database, compatibility); - compat.ApplyLookupResources(resourcesId, instancesId, lookup, queryLevel, limit); - } - } -} diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.h --- a/OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.h Fri Jan 04 16:42:55 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2019 Osimis S.A., 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. - * - * In addition, as a special exception, the copyright holders of this - * program give permission to link the code of its release with the - * OpenSSL project's "OpenSSL" library (or with modified versions of it - * that use the same license as the "OpenSSL" library), and distribute - * the linked executables. You must obey the GNU General Public License - * in all respects for all of the code used other than "OpenSSL". If you - * modify file(s) with this exception, you may extend this exception to - * your version of the file(s), but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. If you delete this exception statement from all source files - * in the program, then also delete it here. - * - * 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 "../../IDatabaseWrapper.h" - -namespace Orthanc -{ - namespace Compatibility - { - /** - * This is a compatibility class that contains database primitives - * that were used in Orthanc <= 1.5.1, and that have been removed - * during the optimization of the database engine. - **/ - class CompatibilityDatabaseWrapper : public boost::noncopyable - { - public: - virtual ~CompatibilityDatabaseWrapper() - { - } - - virtual void GetAllInternalIds(std::list& target, - ResourceType resourceType) = 0; - - virtual void LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - IdentifierConstraintType type, - const std::string& value) = 0; - - virtual void LookupIdentifierRange(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& start, - const std::string& end) = 0; - - static void Apply(IDatabaseWrapper& database, - CompatibilityDatabaseWrapper& compatibility, - std::list& resourcesId, - std::list* instancesId, - const std::vector& lookup, - ResourceType queryLevel, - size_t limit); - }; - } -} diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/DatabaseLookup.cpp --- a/OrthancServer/Search/Compatibility/DatabaseLookup.cpp Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/Search/Compatibility/DatabaseLookup.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -92,7 +92,7 @@ static void ApplyIdentifierConstraint(SetOfResources& candidates, - CompatibilityDatabaseWrapper& compatibility, + ILookupResources& compatibility, const DatabaseConstraint& constraint, ResourceType level) { @@ -142,7 +142,7 @@ static void ApplyIdentifierRange(SetOfResources& candidates, - CompatibilityDatabaseWrapper& compatibility, + ILookupResources& compatibility, const DatabaseConstraint& smaller, const DatabaseConstraint& greater, ResourceType level) @@ -161,7 +161,7 @@ static void ApplyLevel(SetOfResources& candidates, IDatabaseWrapper& database, - CompatibilityDatabaseWrapper& compatibility, + ILookupResources& compatibility, const std::vector& lookup, ResourceType level) { diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/DatabaseLookup.h --- a/OrthancServer/Search/Compatibility/DatabaseLookup.h Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/Search/Compatibility/DatabaseLookup.h Fri Jan 04 16:52:53 2019 +0100 @@ -34,7 +34,7 @@ #pragma once #include "../../IDatabaseWrapper.h" -#include "CompatibilityDatabaseWrapper.h" +#include "ILookupResources.h" namespace Orthanc { @@ -44,11 +44,11 @@ { private: IDatabaseWrapper& database_; - CompatibilityDatabaseWrapper& compatibility_; + ILookupResources& compatibility_; public: DatabaseLookup(IDatabaseWrapper& database, - CompatibilityDatabaseWrapper& compatibility) : + ILookupResources& compatibility) : database_(database), compatibility_(compatibility) { diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/ILookupResources.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancServer/Search/Compatibility/ILookupResources.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -0,0 +1,56 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2019 Osimis S.A., 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 "ILookupResources.h" + +#include "DatabaseLookup.h" + +namespace Orthanc +{ + namespace Compatibility + { + void ILookupResources::Apply( + IDatabaseWrapper& database, + ILookupResources& compatibility, + std::list& resourcesId, + std::list* instancesId, + const std::vector& lookup, + ResourceType queryLevel, + size_t limit) + { + Compatibility::DatabaseLookup compat(database, compatibility); + compat.ApplyLookupResources(resourcesId, instancesId, lookup, queryLevel, limit); + } + } +} diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/ILookupResources.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancServer/Search/Compatibility/ILookupResources.h Fri Jan 04 16:52:53 2019 +0100 @@ -0,0 +1,78 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2019 Osimis S.A., 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 "../../IDatabaseWrapper.h" + +namespace Orthanc +{ + namespace Compatibility + { + /** + * This is a compatibility class that contains database primitives + * that were used in Orthanc <= 1.5.1, and that have been removed + * during the optimization of the database engine. + **/ + class ILookupResources : public boost::noncopyable + { + public: + virtual ~ILookupResources() + { + } + + virtual void GetAllInternalIds(std::list& target, + ResourceType resourceType) = 0; + + virtual void LookupIdentifier(std::list& result, + ResourceType level, + const DicomTag& tag, + IdentifierConstraintType type, + const std::string& value) = 0; + + virtual void LookupIdentifierRange(std::list& result, + ResourceType level, + const DicomTag& tag, + const std::string& start, + const std::string& end) = 0; + + static void Apply(IDatabaseWrapper& database, + ILookupResources& compatibility, + std::list& resourcesId, + std::list* instancesId, + const std::vector& lookup, + ResourceType queryLevel, + size_t limit); + }; + } +} diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/SetOfResources.cpp --- a/OrthancServer/Search/Compatibility/SetOfResources.cpp Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/Search/Compatibility/SetOfResources.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -138,7 +138,7 @@ } - void SetOfResources::Flatten(CompatibilityDatabaseWrapper& compatibility, + void SetOfResources::Flatten(ILookupResources& compatibility, std::list& result) { result.clear(); diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/Search/Compatibility/SetOfResources.h --- a/OrthancServer/Search/Compatibility/SetOfResources.h Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/Search/Compatibility/SetOfResources.h Fri Jan 04 16:52:53 2019 +0100 @@ -34,7 +34,7 @@ #pragma once #include "../../IDatabaseWrapper.h" -#include "CompatibilityDatabaseWrapper.h" +#include "ILookupResources.h" #include #include @@ -69,7 +69,7 @@ void GoDown(); - void Flatten(CompatibilityDatabaseWrapper& compatibility, + void Flatten(ILookupResources& compatibility, std::list& result); void Flatten(std::list& result); diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/ServerContext.h --- a/OrthancServer/ServerContext.h Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/ServerContext.h Fri Jan 04 16:52:53 2019 +0100 @@ -47,7 +47,6 @@ #include "../Core/JobsEngine/SetOfInstancesJob.h" #include "../Core/MultiThreading/SharedMessageQueue.h" #include "../Core/RestApi/RestApiOutput.h" -#include "../Plugins/Engine/OrthancPlugins.h" #include #include @@ -55,6 +54,8 @@ namespace Orthanc { + class OrthancPlugins; + /** * This class is responsible for maintaining the storage area on the * filesystem (including compression), as well as the index of the diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/ServerJobs/OrthancJobUnserializer.cpp --- a/OrthancServer/ServerJobs/OrthancJobUnserializer.cpp Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/ServerJobs/OrthancJobUnserializer.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -37,6 +37,7 @@ #include "../../Core/Logging.h" #include "../../Core/OrthancException.h" #include "../../Core/SerializationToolbox.h" +#include "../../Plugins/Engine/OrthancPlugins.h" #include "Operations/DeleteResourceOperation.h" #include "Operations/DicomInstanceOperationValue.h" @@ -52,6 +53,7 @@ #include "MergeStudyJob.h" #include "SplitStudyJob.h" + namespace Orthanc { IJob* OrthancJobUnserializer::UnserializeJob(const Json::Value& source) diff -r 195ba4cbac3f -r c829758b9ca0 OrthancServer/ServerToolbox.cpp --- a/OrthancServer/ServerToolbox.cpp Fri Jan 04 16:42:55 2019 +0100 +++ b/OrthancServer/ServerToolbox.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -39,6 +39,7 @@ #include "../Core/FileStorage/StorageAccessor.h" #include "../Core/Logging.h" #include "../Core/OrthancException.h" +#include "../Plugins/Engine/OrthancPlugins.h" #include "IDatabaseWrapper.h" #include "ServerContext.h" diff -r 195ba4cbac3f -r c829758b9ca0 Plugins/Engine/OrthancPluginDatabase.cpp --- a/Plugins/Engine/OrthancPluginDatabase.cpp Fri Jan 04 16:42:55 2019 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.cpp Fri Jan 04 16:52:53 2019 +0100 @@ -1161,8 +1161,8 @@ if (extensions_.lookupResources == NULL) { // Fallback to compatibility mode - CompatibilityDatabaseWrapper::Apply(*this, *this, resourcesId, instancesId, - lookup, queryLevel, limit); + ILookupResources::Apply + (*this, *this, resourcesId, instancesId, lookup, queryLevel, limit); } else { diff -r 195ba4cbac3f -r c829758b9ca0 Plugins/Engine/OrthancPluginDatabase.h --- a/Plugins/Engine/OrthancPluginDatabase.h Fri Jan 04 16:42:55 2019 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.h Fri Jan 04 16:52:53 2019 +0100 @@ -36,7 +36,7 @@ #if ORTHANC_ENABLE_PLUGINS == 1 #include "../../Core/SharedLibrary.h" -#include "../../OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.h" +#include "../../OrthancServer/Search/Compatibility/ILookupResources.h" #include "../../OrthancServer/Search/Compatibility/ISetResourcesContent.h" #include "../../OrthancServer/Search/Compatibility/ICreateInstance.h" #include "../Include/orthanc/OrthancCDatabasePlugin.h" @@ -46,7 +46,7 @@ { class OrthancPluginDatabase : public IDatabaseWrapper, - public Compatibility::CompatibilityDatabaseWrapper, + public Compatibility::ILookupResources, public Compatibility::ISetResourcesContent, public Compatibility::ICreateInstance { @@ -330,12 +330,12 @@ const std::string& instance) ORTHANC_OVERRIDE; - // From the "CompatibilityDatabaseWrapper" interface + // From the "ILookupResources" interface virtual void GetAllInternalIds(std::list& target, ResourceType resourceType) ORTHANC_OVERRIDE; - // From the "CompatibilityDatabaseWrapper" interface + // From the "ILookupResources" interface virtual void LookupIdentifier(std::list& result, ResourceType level, const DicomTag& tag, @@ -343,7 +343,7 @@ const std::string& value) ORTHANC_OVERRIDE; - // From the "CompatibilityDatabaseWrapper" interface + // From the "ILookupResources" interface virtual void LookupIdentifierRange(std::list& result, ResourceType level, const DicomTag& tag,