comparison Framework/Loaders/LoaderCache.cpp @ 1438:96044a18b98d

DicomStructureSetLoader instances are now indexed by their instanceid AND a uniquekey that is passed (*not* depending on the initially visible structures anymore)
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 19 May 2020 15:29:47 +0200
parents 998697c5ec74
children 4e233e3ea53b
comparison
equal deleted inserted replaced
1437:297e57d3508c 1438:96044a18b98d
185 s << "-" << sortedStringList[i]; 185 s << "-" << sortedStringList[i];
186 } 186 }
187 return s.str(); 187 return s.str();
188 } 188 }
189 } 189 }
190 190
191 boost::shared_ptr<DicomStructureSetLoader> 191 std::string LoaderCache::BuildDicomStructureSetLoaderKey(
192 LoaderCache::GetDicomStructureSetLoader( 192 const std::string& instanceUuid,
193 const std::string& uniqueKey)
194 {
195 return instanceUuid + "_" + uniqueKey;
196 }
197
198 boost::shared_ptr<DicomStructureSetLoader> LoaderCache::GetDicomStructureSetLoader(
193 std::string inInstanceUuid, 199 std::string inInstanceUuid,
194 const std::vector<std::string>& initiallyVisibleStructures) 200 const std::vector<std::string>& initiallyVisibleStructures,
201 const std::string& uniqueKey)
195 { 202 {
196 try 203 try
197 { 204 {
198 // normalize keys a little 205 // normalize keys a little
199 NormalizeUuid(inInstanceUuid); 206 NormalizeUuid(inInstanceUuid);
200 207
201 std::string initiallyVisibleStructuresKey = 208 std::string entryKey = BuildDicomStructureSetLoaderKey(inInstanceUuid, uniqueKey);
202 SortAndJoin(initiallyVisibleStructures);
203
204 std::string entryKey = inInstanceUuid + "_" + initiallyVisibleStructuresKey;
205 209
206 // find in cache 210 // find in cache
207 if (dicomStructureSetLoaders_.find(entryKey) == dicomStructureSetLoaders_.end()) 211 if (dicomStructureSetLoaders_.find(entryKey) == dicomStructureSetLoaders_.end())
208 { 212 {
209 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); 213 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock());