Mercurial > hg > orthanc
annotate OrthancFramework/Sources/FileStorage/FilesystemStorage.h @ 4406:4cb9f66a1c7c
documenting generation of images
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Dec 2020 17:32:19 +0100 |
parents | b30a8de92ad9 |
children | d9473bd5ed43 |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
136 | 11 * |
0 | 12 * This program is distributed in the hope that it will be useful, but |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
0 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
0 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
4034
78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
25 #include "../OrthancFramework.h" |
78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
26 |
2407
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
27 #if !defined(ORTHANC_SANDBOXED) |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
28 # error The macro ORTHANC_SANDBOXED must be defined |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
29 #endif |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
30 |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
31 #if ORTHANC_SANDBOXED == 1 |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
32 # error The class FilesystemStorage cannot be used in sandboxed environments |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
33 #endif |
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
34 |
1124
790ff7a5b3bf
IStorageArea abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1123
diff
changeset
|
35 #include "IStorageArea.h" |
4202
2007ab69ac16
moving ORTHANC_FORCE_INLINE and ORTHANC_OVERRIDE from Enumerations.h to Compatibility.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4200
diff
changeset
|
36 #include "../Compatibility.h" // For ORTHANC_OVERRIDE |
1124
790ff7a5b3bf
IStorageArea abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1123
diff
changeset
|
37 |
1398 | 38 #include <stdint.h> |
0 | 39 #include <boost/filesystem.hpp> |
40 #include <set> | |
41 | |
59 | 42 namespace Orthanc |
0 | 43 { |
4037
5e26d004838c
adding option "system" to DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4034
diff
changeset
|
44 class ORTHANC_PUBLIC FilesystemStorage : public IStorageArea |
0 | 45 { |
208 | 46 // TODO REMOVE THIS |
47 friend class FilesystemHttpSender; | |
221
e7432706b354
accessors to storage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
208
diff
changeset
|
48 friend class FileStorageAccessor; |
0 | 49 |
50 private: | |
51 boost::filesystem::path root_; | |
4185
b289a1234822
giving a try to cross-platform compilation of SyncStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
52 bool fsyncOnWrite_; |
0 | 53 |
54 boost::filesystem::path GetPath(const std::string& uuid) const; | |
55 | |
4185
b289a1234822
giving a try to cross-platform compilation of SyncStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
56 void Setup(const std::string& root); |
b289a1234822
giving a try to cross-platform compilation of SyncStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
57 |
4273
0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4202
diff
changeset
|
58 #if ORTHANC_BUILDING_FRAMEWORK_LIBRARY == 1 |
0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4202
diff
changeset
|
59 // Alias for binary compatibility with Orthanc Framework 1.7.2 => don't use it anymore |
0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4202
diff
changeset
|
60 explicit FilesystemStorage(std::string root); |
0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4202
diff
changeset
|
61 #endif |
0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4202
diff
changeset
|
62 |
0 | 63 public: |
4300 | 64 explicit FilesystemStorage(const std::string& root); |
4185
b289a1234822
giving a try to cross-platform compilation of SyncStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
65 |
b289a1234822
giving a try to cross-platform compilation of SyncStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
66 FilesystemStorage(const std::string& root, |
4300 | 67 bool fsyncOnWrite); |
0 | 68 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1126
diff
changeset
|
69 virtual void Create(const std::string& uuid, |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1126
diff
changeset
|
70 const void* content, |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1126
diff
changeset
|
71 size_t size, |
4200 | 72 FileContentType type) ORTHANC_OVERRIDE; |
0 | 73 |
1124
790ff7a5b3bf
IStorageArea abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1123
diff
changeset
|
74 virtual void Read(std::string& content, |
1126
bf67431a7383
handling of file content type in IStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
75 const std::string& uuid, |
4200 | 76 FileContentType type) ORTHANC_OVERRIDE; |
0 | 77 |
1126
bf67431a7383
handling of file content type in IStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
78 virtual void Remove(const std::string& uuid, |
4200 | 79 FileContentType type) ORTHANC_OVERRIDE; |
0 | 80 |
81 void ListAllFiles(std::set<std::string>& result) const; | |
82 | |
1122
1d60316c3618
simplifications in FileStorage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
83 uintmax_t GetSize(const std::string& uuid) const; |
0 | 84 |
85 void Clear(); | |
86 | |
87 uintmax_t GetCapacity() const; | |
88 | |
89 uintmax_t GetAvailableSpace() const; | |
90 }; | |
91 } |