Mercurial > hg > orthanc
comparison OrthancServer/ServerContext.h @ 778:aebf0071020e
refactoring of the mutex for the dicom cache
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 May 2014 11:02:23 +0200 |
parents | 537837f50fbb |
children | 331eaf9d9d69 |
comparison
equal
deleted
inserted
replaced
776:be87dd517416 | 778:aebf0071020e |
---|---|
68 ServerIndex index_; | 68 ServerIndex index_; |
69 CompressedFileStorageAccessor accessor_; | 69 CompressedFileStorageAccessor accessor_; |
70 bool compressionEnabled_; | 70 bool compressionEnabled_; |
71 | 71 |
72 DicomCacheProvider provider_; | 72 DicomCacheProvider provider_; |
73 boost::mutex dicomCacheMutex_; | |
73 MemoryCache dicomCache_; | 74 MemoryCache dicomCache_; |
74 ReusableDicomUserConnection scu_; | 75 ReusableDicomUserConnection scu_; |
75 | 76 |
76 LuaContext lua_; | 77 LuaContext lua_; |
77 | 78 |
78 public: | 79 public: |
80 class DicomCacheLocker | |
81 { | |
82 private: | |
83 ServerContext& that_; | |
84 ParsedDicomFile *dicom_; | |
85 | |
86 public: | |
87 DicomCacheLocker(ServerContext& that, | |
88 const std::string& instancePublicId); | |
89 | |
90 ~DicomCacheLocker(); | |
91 | |
92 ParsedDicomFile& GetDicom() | |
93 { | |
94 return *dicom_; | |
95 } | |
96 }; | |
97 | |
79 ServerContext(const boost::filesystem::path& storagePath, | 98 ServerContext(const boost::filesystem::path& storagePath, |
80 const boost::filesystem::path& indexPath); | 99 const boost::filesystem::path& indexPath); |
81 | 100 |
82 ServerIndex& GetIndex() | 101 ServerIndex& GetIndex() |
83 { | 102 { |
136 void ReadFile(std::string& result, | 155 void ReadFile(std::string& result, |
137 const std::string& instancePublicId, | 156 const std::string& instancePublicId, |
138 FileContentType content, | 157 FileContentType content, |
139 bool uncompressIfNeeded = true); | 158 bool uncompressIfNeeded = true); |
140 | 159 |
141 // TODO IMPLEMENT MULTITHREADING FOR THIS METHOD | |
142 ParsedDicomFile& GetDicomFile(const std::string& instancePublicId); | |
143 | |
144 LuaContext& GetLuaContext() | 160 LuaContext& GetLuaContext() |
145 { | 161 { |
146 return lua_; | 162 return lua_; |
147 } | 163 } |
148 | 164 |