1
|
1 /**
|
|
2 * Cloud storage plugins for Orthanc
|
|
3 * Copyright (C) 2017-2020 Osimis S.A., Belgium
|
|
4 *
|
|
5 * This program is free software: you can redistribute it and/or
|
|
6 * modify it under the terms of the GNU Affero General Public License
|
|
7 * as published by the Free Software Foundation, either version 3 of
|
|
8 * the License, or (at your option) any later version.
|
|
9 *
|
|
10 * This program is distributed in the hope that it will be useful, but
|
|
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 * Affero General Public License for more details.
|
|
14 *
|
|
15 * You should have received a copy of the GNU Affero General Public License
|
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 **/
|
|
18
|
|
19 #pragma once
|
|
20
|
|
21 #include <orthanc/OrthancCPlugin.h>
|
|
22 #include <OrthancPluginCppWrapper.h>
|
|
23
|
|
24 class StoragePluginException : public std::runtime_error
|
|
25 {
|
|
26 public:
|
|
27 StoragePluginException(const std::string& what)
|
|
28 : std::runtime_error(what)
|
|
29 {
|
|
30 }
|
|
31 };
|
|
32
|
|
33
|
|
34
|
|
35
|
|
36 // each "plugin" must also provide these global methods
|
|
37 //class XXXStoragePluginFactory
|
|
38 //{
|
|
39 //public:
|
|
40 // const char* GetStoragePluginName();
|
|
41 // IStoragePlugin* CreateStoragePlugin(const OrthancPlugins::OrthancConfiguration& orthancConfig);
|
|
42 //};
|
|
43
|
|
44 class IStoragePlugin
|
|
45 {
|
|
46 public:
|
|
47 class IWriter
|
|
48 {
|
|
49 public:
|
|
50 IWriter()
|
|
51 {}
|
|
52
|
|
53 virtual ~IWriter() {}
|
|
54 virtual void Write(const char* data, size_t size) = 0;
|
|
55 };
|
|
56
|
|
57 class IReader
|
|
58 {
|
|
59 public:
|
|
60 IReader()
|
|
61 {}
|
|
62
|
|
63 virtual ~IReader() {}
|
|
64 virtual size_t GetSize() = 0;
|
|
65 virtual void Read(char* data, size_t size) = 0;
|
|
66 };
|
|
67
|
|
68 public:
|
20
|
69 virtual void SetRootPath(const std::string& rootPath) = 0;
|
1
|
70
|
|
71 virtual IWriter* GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0;
|
|
72 virtual IReader* GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0;
|
|
73 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0;
|
15
|
74 virtual const char* GetConfigurationSectionName() = 0;
|
1
|
75 };
|