Mercurial > hg > orthanc-object-storage
annotate Common/IStorage.h @ 105:0585b5de6be2
fix cmake warnings
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 09 Oct 2023 10:18:58 +0200 |
parents | d7295e8678d7 |
children | 407bd022b0cf |
rev | line source |
---|---|
1 | 1 /** |
2 * Cloud storage plugins for Orthanc | |
37
f55b2afdf53d
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
20
diff
changeset
|
3 * Copyright (C) 2020-2021 Osimis S.A., Belgium |
1 | 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 | |
56
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
39
diff
changeset
|
19 |
1 | 20 #pragma once |
21 | |
22 #include <orthanc/OrthancCPlugin.h> | |
23 #include <OrthancPluginCppWrapper.h> | |
24 | |
25 class StoragePluginException : public std::runtime_error | |
26 { | |
27 public: | |
28 StoragePluginException(const std::string& what) | |
29 : std::runtime_error(what) | |
30 { | |
31 } | |
32 }; | |
33 | |
34 | |
35 | |
36 | |
37 // each "plugin" must also provide these global methods | |
38 //class XXXStoragePluginFactory | |
39 //{ | |
40 //public: | |
41 // const char* GetStoragePluginName(); | |
78 | 42 // IStorage* CreateStorage(const OrthancPlugins::OrthancConfiguration& orthancConfig); |
1 | 43 //}; |
44 | |
78 | 45 class IStorage |
1 | 46 { |
47 public: | |
48 class IWriter | |
49 { | |
50 public: | |
51 IWriter() | |
52 {} | |
53 | |
54 virtual ~IWriter() {} | |
55 virtual void Write(const char* data, size_t size) = 0; | |
56 }; | |
57 | |
58 class IReader | |
59 { | |
60 public: | |
61 IReader() | |
62 {} | |
63 | |
64 virtual ~IReader() {} | |
65 virtual size_t GetSize() = 0; | |
39
50d0be413c42
implemented ReadRange (only in Azure plugin right now)
Alain Mazy <am@osimis.io>
parents:
37
diff
changeset
|
66 virtual void ReadWhole(char* data, size_t size) = 0; |
50d0be413c42
implemented ReadRange (only in Azure plugin right now)
Alain Mazy <am@osimis.io>
parents:
37
diff
changeset
|
67 virtual void ReadRange(char* data, size_t size, size_t fromOffset) = 0; |
1 | 68 }; |
69 | |
77 | 70 std::string nameForLogs_; |
1 | 71 public: |
78 | 72 IStorage(const std::string& nameForLogs): |
77 | 73 nameForLogs_(nameForLogs) |
74 {} | |
75 | |
20 | 76 virtual void SetRootPath(const std::string& rootPath) = 0; |
1 | 77 |
78 virtual IWriter* GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0; | |
79 virtual IReader* GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0; | |
77 | 80 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0; // returns true only if 100% sure that the file has been deleted, false otherwise |
81 | |
82 const std::string& GetNameForLogs() {return nameForLogs_;} | |
1 | 83 }; |