Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomParsing/ParsedDicomCache.h @ 5121:77e20ce39d6f
removed some warnings for recent versions of CMake
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 19 Dec 2022 15:09:38 +0100 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * License along with this program. If not, see |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #pragma once |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "../Cache/MemoryObjectCache.h" |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include "ParsedDicomFile.h" |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 namespace Orthanc |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
4457
789676a8c96a
Refactoring and improvements to the cache of DICOM files in ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4456
diff
changeset
|
31 class ORTHANC_PUBLIC ParsedDicomCache : public boost::noncopyable |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 private: |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 class Item; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
4458
e4dae17035b9
fix ParsedDicomCache for emscripten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4457
diff
changeset
|
36 #if !defined(__EMSCRIPTEN__) |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 boost::mutex mutex_; |
4458
e4dae17035b9
fix ParsedDicomCache for emscripten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4457
diff
changeset
|
38 #endif |
e4dae17035b9
fix ParsedDicomCache for emscripten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4457
diff
changeset
|
39 |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 size_t cacheSize_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 std::unique_ptr<MemoryObjectCache> cache_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 std::unique_ptr<ParsedDicomFile> largeDicom_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 std::string largeId_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 size_t largeSize_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 public: |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 explicit ParsedDicomCache(size_t size); |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
4457
789676a8c96a
Refactoring and improvements to the cache of DICOM files in ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4456
diff
changeset
|
49 size_t GetNumberOfItems(); // For unit tests only |
789676a8c96a
Refactoring and improvements to the cache of DICOM files in ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4456
diff
changeset
|
50 |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 size_t GetCurrentSize(); // For unit tests only |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 void Invalidate(const std::string& id); |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 void Acquire(const std::string& id, |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 ParsedDicomFile* dicom, // Takes ownership |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 size_t fileSize); |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
4486 | 59 class ORTHANC_PUBLIC Accessor : public boost::noncopyable |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 { |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 private: |
4458
e4dae17035b9
fix ParsedDicomCache for emscripten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4457
diff
changeset
|
62 #if !defined(__EMSCRIPTEN__) |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 boost::mutex::scoped_lock lock_; |
4458
e4dae17035b9
fix ParsedDicomCache for emscripten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4457
diff
changeset
|
64 #endif |
e4dae17035b9
fix ParsedDicomCache for emscripten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4457
diff
changeset
|
65 |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 std::string id_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 ParsedDicomFile* file_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 size_t fileSize_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 std::unique_ptr<MemoryObjectCache::Accessor> accessor_; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 public: |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 Accessor(ParsedDicomCache& that, |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 const std::string& id); |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
4495
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4486
diff
changeset
|
76 bool IsValid() const; |
4456
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 ParsedDicomFile& GetDicom() const; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 size_t GetFileSize() const; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 }; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 }; |
3e4f7b7840f0
new class: ParsedDicomCache()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 } |