Mercurial > hg > orthanc-stone
annotate Framework/Loaders/BasicFetchingStrategy.h @ 1488:7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 23 Jun 2020 13:44:23 +0200 |
parents | 30deba7bc8e2 |
children |
rev | line source |
---|---|
708 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
708
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
708 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
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 | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "IFetchingItemsSorter.h" | |
25 #include "IFetchingStrategy.h" | |
26 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
27 #include <Compatibility.h> |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
28 |
708 | 29 #include <memory> |
30 | |
31 namespace OrthancStone | |
32 { | |
33 class BasicFetchingStrategy : public IFetchingStrategy | |
34 { | |
35 private: | |
36 class ContentItem | |
37 { | |
38 private: | |
39 unsigned int item_; | |
40 unsigned int quality_; | |
41 | |
42 public: | |
43 ContentItem(unsigned int item, | |
44 unsigned int quality) : | |
45 item_(item), | |
46 quality_(quality) | |
47 { | |
48 } | |
49 | |
50 unsigned int GetItem() const | |
51 { | |
52 return item_; | |
53 } | |
54 | |
55 unsigned int GetQuality() const | |
56 { | |
57 return quality_; | |
58 } | |
59 }; | |
60 | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
61 std::unique_ptr<IFetchingItemsSorter> sorter_; |
708 | 62 std::vector<unsigned int> nextQuality_; |
63 unsigned int maxQuality_; | |
64 std::vector<ContentItem> content_; | |
65 size_t position_; | |
66 unsigned int blockSize_; | |
67 | |
68 void Schedule(unsigned int item, | |
69 unsigned int quality); | |
70 | |
71 public: | |
72 BasicFetchingStrategy(IFetchingItemsSorter* sorter, // Takes ownership | |
73 unsigned int maxQuality); | |
74 | |
75 virtual unsigned int GetItemsCount() const | |
76 { | |
77 return sorter_->GetItemsCount(); | |
78 } | |
79 | |
80 virtual unsigned int GetMaxQuality() const | |
81 { | |
82 return maxQuality_; | |
83 } | |
84 | |
85 // WARNING - This parameters is only considered during the next | |
86 // call to SetCurrent(). | |
87 void SetBlockSize(unsigned int size); | |
88 | |
89 virtual bool GetNext(unsigned int& item, | |
90 unsigned int& quality); | |
91 | |
92 virtual void SetCurrent(unsigned int item); | |
93 | |
94 virtual void RecycleFurthest(unsigned int& item); | |
95 }; | |
96 } |