Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 1615:c40fe92a68e7
Primitives to upgrade the database version in plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 Sep 2015 15:18:59 +0200 |
parents | 1ec254a7c645 |
children | 0a2ad4a6858f |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Fri Sep 11 18:46:13 2015 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Wed Sep 16 15:18:59 2015 +0200 @@ -165,6 +165,37 @@ } + static OrthancPluginContentType Convert(FileContentType type) + { + switch (type) + { + case FileContentType_Dicom: + return OrthancPluginContentType_Dicom; + + case FileContentType_DicomAsJson: + return OrthancPluginContentType_DicomAsJson; + + default: + return OrthancPluginContentType_Unknown; + } + } + + + static FileContentType Convert(OrthancPluginContentType type) + { + switch (type) + { + case OrthancPluginContentType_Dicom: + return FileContentType_Dicom; + + case OrthancPluginContentType_DicomAsJson: + return FileContentType_DicomAsJson; + + default: + return FileContentType_Unknown; + } + } + struct OrthancPlugins::PImpl { @@ -1618,6 +1649,35 @@ DrawText(parameters); return true; + case _OrthancPluginService_StorageAreaCreate: + { + const _OrthancPluginStorageAreaCreate& p = + *reinterpret_cast<const _OrthancPluginStorageAreaCreate*>(parameters); + IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); + storage.Create(p.uuid, p.content, p.size, Convert(p.type)); + return true; + } + + case _OrthancPluginService_StorageAreaRead: + { + const _OrthancPluginStorageAreaRead& p = + *reinterpret_cast<const _OrthancPluginStorageAreaRead*>(parameters); + IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); + std::string content; + storage.Read(content, p.uuid, Convert(p.type)); + CopyToMemoryBuffer(*p.target, content); + return true; + } + + case _OrthancPluginService_StorageAreaRemove: + { + const _OrthancPluginStorageAreaRemove& p = + *reinterpret_cast<const _OrthancPluginStorageAreaRemove*>(parameters); + IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); + storage.Remove(p.uuid, Convert(p.type)); + return true; + } + default: { // This service is unknown to the Orthanc plugin engine @@ -1654,21 +1714,6 @@ } } - OrthancPluginContentType Convert(FileContentType type) const - { - switch (type) - { - case FileContentType_Dicom: - return OrthancPluginContentType_Dicom; - - case FileContentType_DicomAsJson: - return OrthancPluginContentType_DicomAsJson; - - default: - return OrthancPluginContentType_Unknown; - } - } - public: PluginStorageArea(const _OrthancPluginRegisterStorageArea& params) : params_(params) {