comparison OrthancServer/Sources/Database/FindResponse.h @ 5574:5a13483d12c5 find-refactoring

find-refactoring: attachments
author Alain Mazy <am@orthanc.team>
date Fri, 26 Apr 2024 16:32:18 +0200
parents b0b5546f1b9f
children 77570cce8855
comparison
equal deleted inserted replaced
5569:738f80622e91 5574:5a13483d12c5
21 21
22 22
23 #pragma once 23 #pragma once
24 24
25 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h" 25 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h"
26 #include "../../../OrthancFramework/Sources/Enumerations.h"
27 #include "../../../OrthancFramework/Sources/FileStorage/FileInfo.h"
26 #include "../ServerEnumerations.h" 28 #include "../ServerEnumerations.h"
27 #include "OrthancIdentifiers.h" 29 #include "OrthancIdentifiers.h"
28 #include "FindRequest.h" 30 #include "FindRequest.h"
29 31
30 #include <boost/noncopyable.hpp> 32 #include <boost/noncopyable.hpp>
88 std::unique_ptr<DicomMap> dicomMap_; 90 std::unique_ptr<DicomMap> dicomMap_;
89 std::list<std::string> children_; 91 std::list<std::string> children_;
90 std::string childInstanceId_; 92 std::string childInstanceId_;
91 std::set<std::string> labels_; 93 std::set<std::string> labels_;
92 std::map<MetadataType, std::string> metadata_; 94 std::map<MetadataType, std::string> metadata_;
93 std::map<uint16_t, std::string> attachments_; 95 std::map<FileContentType, FileInfo> attachments_;
94 96
95 public: 97 public:
96 Item(FindRequest::ResponseContent responseContent, 98 Item(FindRequest::ResponseContent responseContent,
97 ResourceType level, 99 ResourceType level,
98 const OrthancIdentifiers& identifiers) : 100 const OrthancIdentifiers& identifiers) :
192 194
193 const std::set<std::string>& GetLabels() const 195 const std::set<std::string>& GetLabels() const
194 { 196 {
195 return labels_; 197 return labels_;
196 } 198 }
199
200 void AddAttachment(const FileInfo& attachment)
201 {
202 attachments_[attachment.GetContentType()] = attachment;
203 }
204
205 const std::map<FileContentType, FileInfo>& GetAttachments() const
206 {
207 return attachments_;
208 }
209
210 bool LookupAttachment(FileInfo& target, FileContentType type) const
211 {
212 std::map<FileContentType, FileInfo>::const_iterator it = attachments_.find(type);
213 if (it != attachments_.end())
214 {
215 target = it->second;
216 return true;
217 }
218
219 return false;
220 }
221
197 // TODO-FIND: add other getters and setters 222 // TODO-FIND: add other getters and setters
198 }; 223 };
199 224
200 private: 225 private:
201 std::deque<Item*> items_; 226 std::deque<Item*> items_;