Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/FindResponse.h @ 5554:12d8a1a266e9 find-refactoring
introduction of FindRequest and FindResponse
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 15 Apr 2024 16:13:24 +0200 |
parents | |
children | def06a42e5ef |
comparison
equal
deleted
inserted
replaced
5549:dcbf0c776945 | 5554:12d8a1a266e9 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium | |
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
7 * | |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h" | |
26 #include "../ServerEnumerations.h" | |
27 #include "OrthancIdentifiers.h" | |
28 | |
29 #include <boost/noncopyable.hpp> | |
30 #include <deque> | |
31 #include <map> | |
32 #include <set> | |
33 | |
34 | |
35 namespace Orthanc | |
36 { | |
37 class FindResponse : public boost::noncopyable | |
38 { | |
39 public: | |
40 class Item : public boost::noncopyable | |
41 { | |
42 private: | |
43 ResourceType level_; | |
44 OrthancIdentifiers identifiers_; | |
45 std::map<MetadataType, std::string> metadata_; | |
46 std::unique_ptr<DicomMap> dicomMap_; | |
47 | |
48 public: | |
49 Item(ResourceType level, | |
50 const OrthancIdentifiers& identifiers) : | |
51 level_(level), | |
52 identifiers_(identifiers) | |
53 { | |
54 } | |
55 | |
56 Item(ResourceType level, | |
57 DicomMap* dicomMap /* takes ownership */); | |
58 | |
59 ResourceType GetLevel() const | |
60 { | |
61 return level_; | |
62 } | |
63 | |
64 const OrthancIdentifiers& GetIdentifiers() const | |
65 { | |
66 return identifiers_; | |
67 } | |
68 | |
69 void AddMetadata(MetadataType metadata, | |
70 const std::string& value); | |
71 | |
72 bool HasMetadata(MetadataType metadata) const | |
73 { | |
74 return metadata_.find(metadata) != metadata_.end(); | |
75 } | |
76 | |
77 bool LookupMetadata(std::string& value, | |
78 MetadataType metadata) const; | |
79 | |
80 void ListMetadata(std::set<MetadataType> metadata) const; | |
81 | |
82 bool HasDicomMap() const | |
83 { | |
84 return dicomMap_.get() != NULL; | |
85 } | |
86 | |
87 const DicomMap& GetDicomMap() const; | |
88 }; | |
89 | |
90 private: | |
91 std::deque<Item*> items_; | |
92 | |
93 public: | |
94 ~FindResponse(); | |
95 | |
96 void Add(Item* item /* takes ownership */); | |
97 | |
98 size_t GetSize() const | |
99 { | |
100 return items_.size(); | |
101 } | |
102 | |
103 const Item& GetItem(size_t index) const; | |
104 }; | |
105 } |