Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/ParsedDicomFileCache.h @ 1124:a8bf81756839 broker
unsuccessful attempt to cache ParseDicomFileCommand
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Nov 2019 18:49:06 +0100 |
parents | a08699daf78b |
children | 42581a6182c8 |
comparison
equal
deleted
inserted
replaced
1117:383aa2a7d426 | 1124:a8bf81756839 |
---|---|
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include <Core/Cache/MemoryObjectCache.h> | 24 #include <Core/Cache/MemoryObjectCache.h> |
25 #include <Core/DicomParsing/ParsedDicomFile.h> | 25 #include <Core/DicomParsing/ParsedDicomFile.h> |
26 | 26 |
27 #include <boost/shared_ptr.hpp> | |
28 | |
27 namespace OrthancStone | 29 namespace OrthancStone |
28 { | 30 { |
29 class ParsedDicomFileCache : public boost::noncopyable | 31 class ParsedDicomFileCache : public boost::noncopyable |
30 { | 32 { |
31 private: | 33 private: |
37 ParsedDicomFileCache(size_t size) | 39 ParsedDicomFileCache(size_t size) |
38 { | 40 { |
39 cache_.SetMaximumSize(size); | 41 cache_.SetMaximumSize(size); |
40 } | 42 } |
41 | 43 |
42 void Acquire(const std::string& sopInstanceUid, | 44 void Acquire(const std::string& path, |
43 Orthanc::ParsedDicomFile* dicom, // Takes ownership | 45 boost::shared_ptr<Orthanc::ParsedDicomFile> dicom, |
44 size_t fileSize); | 46 size_t fileSize, |
47 bool hasPixelData); | |
45 | 48 |
46 class Reader : public boost::noncopyable | 49 class Reader : public boost::noncopyable |
47 { | 50 { |
48 private: | 51 private: |
49 Orthanc::MemoryObjectCache::Reader reader_; | 52 Orthanc::MemoryObjectCache::Reader reader_; |
53 std::auto_ptr<boost::mutex::scoped_lock> lock_; | |
54 Item* item_; | |
50 | 55 |
51 public: | 56 public: |
52 Reader(ParsedDicomFileCache& cache, | 57 Reader(ParsedDicomFileCache& cache, |
53 const std::string& sopInstanceUid) : | 58 const std::string& path); |
54 reader_(cache.cache_, sopInstanceUid) | |
55 { | |
56 } | |
57 | 59 |
58 bool IsValid() const | 60 bool IsValid() const |
59 { | 61 { |
60 return reader_.IsValid(); | 62 return item_ != NULL; |
61 } | 63 } |
62 | 64 |
63 const Orthanc::ParsedDicomFile& GetDicom() const; | 65 bool HasPixelData() const; |
66 | |
67 boost::shared_ptr<Orthanc::ParsedDicomFile> GetDicom() const; | |
68 | |
69 size_t GetFileSize() const; | |
64 }; | 70 }; |
65 }; | 71 }; |
66 } | 72 } |