# HG changeset patch # User Sebastien Jodogne # Date 1681314911 -7200 # Node ID 0e8dfba67ac9b170aa5b64d47c69796795eb8e43 # Parent 99751c5a7cfe8635d27120a3dbc3b8a1573f1b03 fix pch diff -r 99751c5a7cfe -r 0e8dfba67ac9 OrthancServer/CMakeLists.txt --- a/OrthancServer/CMakeLists.txt Wed Apr 12 17:43:05 2023 +0200 +++ b/OrthancServer/CMakeLists.txt Wed Apr 12 17:55:11 2023 +0200 @@ -711,7 +711,6 @@ # The "OrthancFrameworkDependencies.cpp" file is used to bypass the # precompiled headers if compiling with Visual Studio add_library(DelayedDeletion SHARED - ${CMAKE_SOURCE_DIR}/Plugins/Engine/PluginsEnumerations.cpp ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/PendingDeletionsDatabase.cpp ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp diff -r 99751c5a7cfe -r 0e8dfba67ac9 OrthancServer/Plugins/Samples/DelayedDeletion/Plugin.cpp --- a/OrthancServer/Plugins/Samples/DelayedDeletion/Plugin.cpp Wed Apr 12 17:43:05 2023 +0200 +++ b/OrthancServer/Plugins/Samples/DelayedDeletion/Plugin.cpp Wed Apr 12 17:55:11 2023 +0200 @@ -25,8 +25,7 @@ #include "../../../../OrthancFramework/Sources/FileStorage/FilesystemStorage.h" #include "../../../../OrthancFramework/Sources/Logging.h" #include "../../../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h" -#include "../../../../OrthancServer/Plugins/Engine/PluginsEnumerations.h" -#include "../../../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h" +#include "../Common/OrthancPluginCppWrapper.h" #include @@ -67,6 +66,25 @@ static unsigned int throttleDelayMs_ = 0; +static Orthanc::FileContentType Convert(OrthancPluginContentType type) +{ + switch (type) + { + case OrthancPluginContentType_Dicom: + return Orthanc::FileContentType_Dicom; + + case OrthancPluginContentType_DicomAsJson: + return Orthanc::FileContentType_DicomAsJson; + + case OrthancPluginContentType_DicomUntilPixelData: + return Orthanc::FileContentType_DicomUntilPixelData; + + default: + return Orthanc::FileContentType_Unknown; + } +} + + static OrthancPluginErrorCode StorageCreate(const char* uuid, const void* content, int64_t size, @@ -74,7 +92,7 @@ { try { - storage_->Create(uuid, content, size, Orthanc::Plugins::Convert(type)); + storage_->Create(uuid, content, size, Convert(type)); return OrthancPluginErrorCode_Success; } catch (Orthanc::OrthancException& e) @@ -94,7 +112,7 @@ { try { - std::unique_ptr buffer(storage_->Read(uuid, Orthanc::Plugins::Convert(type))); + std::unique_ptr buffer(storage_->Read(uuid, Convert(type))); // copy from a buffer allocated on plugin's heap into a buffer allocated on core's heap if (OrthancPluginCreateMemoryBuffer64(OrthancPlugins::GetGlobalContext(), target, buffer->GetSize()) != OrthancPluginErrorCode_Success) @@ -125,7 +143,7 @@ { try { - std::unique_ptr buffer(storage_->ReadRange(uuid, Orthanc::Plugins::Convert(type), rangeStart, rangeStart + target->size)); + std::unique_ptr buffer(storage_->ReadRange(uuid, Convert(type), rangeStart, rangeStart + target->size)); assert(buffer->GetSize() == target->size); @@ -152,7 +170,7 @@ try { LOG(INFO) << "DelayedDeletion - Scheduling delayed deletion of " << uuid; - db_->Enqueue(uuid, Orthanc::Plugins::Convert(type)); + db_->Enqueue(uuid, Convert(type)); return OrthancPluginErrorCode_Success; }