Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/FindResponse.h @ 5589:b51ee994cd6f find-refactoring
renamed FindResponse::Item as FindResponse::Resource
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 03 May 2024 17:26:06 +0200 |
parents | 1b0fc6685f57 |
children | 1e2631b8b9af |
comparison
equal
deleted
inserted
replaced
5588:1b0fc6685f57 | 5589:b51ee994cd6f |
---|---|
78 } | 78 } |
79 }; | 79 }; |
80 | 80 |
81 | 81 |
82 public: | 82 public: |
83 class Item : public boost::noncopyable | 83 class Resource : public boost::noncopyable |
84 { | 84 { |
85 private: | 85 private: |
86 ResourceType level_; | 86 ResourceType level_; |
87 std::string identifier_; | 87 std::string identifier_; |
88 std::unique_ptr<std::string> parentIdentifier_; | 88 std::unique_ptr<std::string> parentIdentifier_; |
100 DicomTagsAtLevel& GetDicomTagsAtLevel(ResourceType level); | 100 DicomTagsAtLevel& GetDicomTagsAtLevel(ResourceType level); |
101 | 101 |
102 ChildrenAtLevel& GetChildrenAtLevel(ResourceType level); | 102 ChildrenAtLevel& GetChildrenAtLevel(ResourceType level); |
103 | 103 |
104 public: | 104 public: |
105 explicit Item(ResourceType level, | 105 explicit Resource(ResourceType level, |
106 const std::string& identifier) : | 106 const std::string& identifier) : |
107 level_(level), | 107 level_(level), |
108 identifier_(identifier) | 108 identifier_(identifier) |
109 { | 109 { |
110 } | 110 } |
111 | 111 |
144 } | 144 } |
145 | 145 |
146 void GetDicomTagsAtLevel(DicomMap& target, | 146 void GetDicomTagsAtLevel(DicomMap& target, |
147 ResourceType level) const | 147 ResourceType level) const |
148 { | 148 { |
149 const_cast<Item&>(*this).GetDicomTagsAtLevel(level).Fill(target); | 149 const_cast<Resource&>(*this).GetDicomTagsAtLevel(level).Fill(target); |
150 } | 150 } |
151 | 151 |
152 void AddChildIdentifier(ResourceType level, | 152 void AddChildIdentifier(ResourceType level, |
153 const std::string& childId) | 153 const std::string& childId) |
154 { | 154 { |
155 GetChildrenAtLevel(level).AddIdentifier(childId); | 155 GetChildrenAtLevel(level).AddIdentifier(childId); |
156 } | 156 } |
157 | 157 |
158 const std::set<std::string>& GetChildrenIdentifiers(ResourceType level) const | 158 const std::set<std::string>& GetChildrenIdentifiers(ResourceType level) const |
159 { | 159 { |
160 return const_cast<Item&>(*this).GetChildrenAtLevel(level).GetIdentifiers(); | 160 return const_cast<Resource&>(*this).GetChildrenAtLevel(level).GetIdentifiers(); |
161 } | 161 } |
162 | 162 |
163 void AddLabel(const std::string& label); | 163 void AddLabel(const std::string& label); |
164 | 164 |
165 const std::set<std::string>& GetLabels() const | 165 const std::set<std::string>& GetLabels() const |
190 bool LookupAttachment(FileInfo& target, | 190 bool LookupAttachment(FileInfo& target, |
191 FileContentType type) const; | 191 FileContentType type) const; |
192 }; | 192 }; |
193 | 193 |
194 private: | 194 private: |
195 typedef std::map<std::string, Item*> Index; | 195 typedef std::map<std::string, Resource*> Index; |
196 | 196 |
197 std::deque<Item*> items_; | 197 std::deque<Resource*> items_; |
198 Index index_; | 198 Index index_; |
199 | 199 |
200 public: | 200 public: |
201 ~FindResponse(); | 201 ~FindResponse(); |
202 | 202 |
203 void Add(Item* item /* takes ownership */); | 203 void Add(Resource* item /* takes ownership */); |
204 | 204 |
205 size_t GetSize() const | 205 size_t GetSize() const |
206 { | 206 { |
207 return items_.size(); | 207 return items_.size(); |
208 } | 208 } |
209 | 209 |
210 const Item& GetItem(size_t index) const; | 210 const Resource& GetResource(size_t index) const; |
211 | 211 |
212 Item& GetItem(const std::string& id); | 212 Resource& GetResource(const std::string& id); |
213 | 213 |
214 const Item& GetItem(const std::string& id) const | 214 const Resource& GetResource(const std::string& id) const |
215 { | 215 { |
216 return const_cast<FindResponse&>(*this).GetItem(id); | 216 return const_cast<FindResponse&>(*this).GetResource(id); |
217 } | 217 } |
218 | 218 |
219 bool HasItem(const std::string& id) const | 219 bool HasResource(const std::string& id) const |
220 { | 220 { |
221 return (index_.find(id) != index_.end()); | 221 return (index_.find(id) != index_.end()); |
222 } | 222 } |
223 }; | 223 }; |
224 } | 224 } |