Mercurial > hg > orthanc-stone
annotate Framework/Loaders/LoaderCache.cpp @ 973:38409549db43 toa2019082903
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
where:
- a message is sent with a receiver
- the receiver dies
- another receiver with the SAME address is created
- the message reply is executed --> execution on the wrong object!
(since their "identity" is their address. The fix is to identify them with
an UUID stored at creation time)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Thu, 29 Aug 2019 18:07:55 +0200 |
parents | d358593820b8 |
children | e704a53c9d0a |
rev | line source |
---|---|
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
6 * |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
16 * |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
19 **/ |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
20 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 #include "LoaderCache.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 #include "OrthancSeriesVolumeProgressiveLoader.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 #include "OrthancMultiframeVolumeLoader.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 #include "DicomStructureSetLoader.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 |
930 | 27 #if ORTHANC_ENABLE_WASM == 1 |
28 # include <unistd.h> | |
29 # include "../Oracle/WebAssemblyOracle.h" | |
30 #else | |
31 # include "../Oracle/ThreadedOracle.h" | |
32 #endif | |
33 | |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 #include "../Messages/LockingEmitter.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 #include "../Volumes/DicomVolumeImage.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 #include "../Volumes/DicomVolumeImageMPRSlicer.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 #include <Core/OrthancException.h> |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 #include <Core/Toolbox.h> |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 namespace OrthancStone |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 #if ORTHANC_ENABLE_WASM == 1 |
930 | 44 LoaderCache::LoaderCache(WebAssemblyOracle& oracle) |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 : oracle_(oracle) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 #else |
930 | 50 LoaderCache::LoaderCache(ThreadedOracle& oracle, LockingEmitter& lockingEmitter) |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 : oracle_(oracle) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 , lockingEmitter_(lockingEmitter) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 #endif |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 LoaderCache::GetSeriesVolumeProgressiveLoader(std::string seriesUuid) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
59 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 try |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
61 { |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
62 |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 // normalize keys a little |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 seriesUuid = Orthanc::Toolbox::StripSpaces(seriesUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 Orthanc::Toolbox::ToLowerCase(seriesUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 // find in cache |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 if (seriesVolumeProgressiveLoaders_.find(seriesUuid) == seriesVolumeProgressiveLoaders_.end()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 { |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
70 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : CACHEMISS --> need to load seriesUUid = " << seriesUuid; |
930 | 71 #if ORTHANC_ENABLE_WASM == 1 |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
72 // LOG(TRACE) << "Performing request for series " << seriesUuid << " sbrk(0) = " << sbrk(0); |
930 | 73 #else |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
74 // LOG(TRACE) << "Performing request for series " << seriesUuid; |
930 | 75 #endif |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 boost::shared_ptr<DicomVolumeImage> volumeImage(new DicomVolumeImage); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> loader; |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
78 // LOG(TRACE) << "volumeImage = " << volumeImage.get(); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
80 #if ORTHANC_ENABLE_WASM == 1 |
930 | 81 loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, oracle_)); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 #else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 LockingEmitter::WriterLock lock(lockingEmitter_); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, lock.GetOracleObservable())); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 #endif |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
86 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : loader = " << loader.get(); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
87 loader->LoadSeries(seriesUuid); |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
88 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : loader->LoadSeries successful"; |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 seriesVolumeProgressiveLoaders_[seriesUuid] = loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 } |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
92 else |
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
93 { |
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
94 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : returning cached loader for seriesUUid = " << seriesUuid; |
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
95 } |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
96 return seriesVolumeProgressiveLoaders_[seriesUuid]; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 catch (const Orthanc::OrthancException& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 if (e.HasDetails()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
107 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
109 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 catch (const std::exception& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
112 LOG(ERROR) << "std::exception in LoaderCache: " << e.what(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
113 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
114 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
115 catch (...) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
116 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
117 LOG(ERROR) << "Unknown exception in LoaderCache"; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
118 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
119 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
120 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
121 |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
122 boost::shared_ptr<OrthancMultiframeVolumeLoader> LoaderCache::GetMultiframeVolumeLoader(std::string instanceUuid) |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
123 { |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
124 // if the loader is not available, let's trigger its creation |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
125 if(multiframeVolumeLoaders_.find(instanceUuid) == multiframeVolumeLoaders_.end()) |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
126 { |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
127 GetMultiframeDicomVolumeImageMPRSlicer(instanceUuid); |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
128 } |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
129 ORTHANC_ASSERT(multiframeVolumeLoaders_.find(instanceUuid) != multiframeVolumeLoaders_.end()); |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
130 |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
131 return multiframeVolumeLoaders_[instanceUuid]; |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
132 } |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
933
diff
changeset
|
133 |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 boost::shared_ptr<DicomVolumeImageMPRSlicer> LoaderCache::GetMultiframeDicomVolumeImageMPRSlicer(std::string instanceUuid) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 try |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 // normalize keys a little |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 instanceUuid = Orthanc::Toolbox::StripSpaces(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
140 Orthanc::Toolbox::ToLowerCase(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 // find in cache |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 if (dicomVolumeImageMPRSlicers_.find(instanceUuid) == dicomVolumeImageMPRSlicers_.end()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 boost::shared_ptr<DicomVolumeImage> volumeImage(new DicomVolumeImage); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 boost::shared_ptr<OrthancMultiframeVolumeLoader> loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 #if ORTHANC_ENABLE_WASM == 1 |
930 | 150 loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, oracle_)); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 #else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 LockingEmitter::WriterLock lock(lockingEmitter_); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
153 loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, lock.GetOracleObservable())); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 #endif |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 loader->LoadInstance(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
157 multiframeVolumeLoaders_[instanceUuid] = loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
158 boost::shared_ptr<DicomVolumeImageMPRSlicer> mprSlicer(new DicomVolumeImageMPRSlicer(volumeImage)); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
159 dicomVolumeImageMPRSlicers_[instanceUuid] = mprSlicer; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 return dicomVolumeImageMPRSlicers_[instanceUuid]; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
162 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
163 catch (const Orthanc::OrthancException& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 if (e.HasDetails()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
167 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
168 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
169 else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
170 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
171 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
172 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
173 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
174 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
175 catch (const std::exception& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
176 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
177 LOG(ERROR) << "std::exception in LoaderCache: " << e.what(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
178 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
179 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
180 catch (...) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
181 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
182 LOG(ERROR) << "Unknown exception in LoaderCache"; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
183 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
184 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
185 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
186 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
187 boost::shared_ptr<DicomStructureSetLoader> LoaderCache::GetDicomStructureSetLoader(std::string instanceUuid) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
188 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
189 try |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
190 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
191 // normalize keys a little |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
192 instanceUuid = Orthanc::Toolbox::StripSpaces(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
193 Orthanc::Toolbox::ToLowerCase(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
194 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
195 // find in cache |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
196 if (dicomStructureSetLoaders_.find(instanceUuid) == dicomStructureSetLoaders_.end()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
197 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
198 boost::shared_ptr<DicomStructureSetLoader> loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
199 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
200 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
201 #if ORTHANC_ENABLE_WASM == 1 |
930 | 202 loader.reset(new DicomStructureSetLoader(oracle_, oracle_)); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
203 #else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
204 LockingEmitter::WriterLock lock(lockingEmitter_); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
205 loader.reset(new DicomStructureSetLoader(oracle_, lock.GetOracleObservable())); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
206 #endif |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
207 loader->LoadInstance(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
208 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
209 dicomStructureSetLoaders_[instanceUuid] = loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
210 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
211 return dicomStructureSetLoaders_[instanceUuid]; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
212 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
213 catch (const Orthanc::OrthancException& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
214 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
215 if (e.HasDetails()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
216 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
217 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
218 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
219 else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
220 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
221 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
222 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
223 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
224 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
225 catch (const std::exception& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
226 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
227 LOG(ERROR) << "std::exception in LoaderCache: " << e.what(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
228 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
229 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
230 catch (...) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
231 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
232 LOG(ERROR) << "Unknown exception in LoaderCache"; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
233 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
234 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
235 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
236 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
237 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
238 void LoaderCache::ClearCache() |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
239 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
240 #if ORTHANC_ENABLE_WASM != 1 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
241 LockingEmitter::WriterLock lock(lockingEmitter_); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
242 #endif |
961
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
243 |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
244 //#ifndef NDEBUG |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
245 // ISO way of checking for debug builds |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
246 DebugDisplayObjRefCounts(); |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
247 //#endif |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
248 seriesVolumeProgressiveLoaders_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
249 multiframeVolumeLoaders_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
250 dicomVolumeImageMPRSlicers_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
251 dicomStructureSetLoaders_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
252 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
253 |
961
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
254 |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
255 template<typename T> void DebugDisplayObjRefCountsInMap( |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
256 const std::string& name, const std::map<std::string, boost::shared_ptr<T> >& myMap) |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
257 { |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
258 LOG(TRACE) << "Map \"" << name << "\" ref counts:"; |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
259 size_t i = 0; |
963
d358593820b8
removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
961
diff
changeset
|
260 for (typename std::map<std::string, boost::shared_ptr<T> >::const_iterator |
d358593820b8
removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
961
diff
changeset
|
261 it = myMap.begin(); it != myMap.end(); ++it) |
961
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
262 { |
963
d358593820b8
removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
961
diff
changeset
|
263 LOG(TRACE) << " element #" << i << ": ref count = " << it->second.use_count(); |
961
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
264 i++; |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
265 } |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
266 } |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
267 |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
268 void LoaderCache::DebugDisplayObjRefCounts() |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
269 { |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
270 DebugDisplayObjRefCountsInMap("seriesVolumeProgressiveLoaders_", seriesVolumeProgressiveLoaders_); |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
271 DebugDisplayObjRefCountsInMap("multiframeVolumeLoaders_", multiframeVolumeLoaders_); |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
272 DebugDisplayObjRefCountsInMap("dicomVolumeImageMPRSlicers_", dicomVolumeImageMPRSlicers_); |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
273 DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders_", dicomStructureSetLoaders_); |
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
274 } |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
275 } |