Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/FindResponse.cpp @ 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 |
rev | line source |
---|---|
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * License, or (at your option) any later version. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * General Public License for more details. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "FindResponse.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../../../OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "../../../OrthancFramework/Sources/OrthancException.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include <cassert> |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 namespace Orthanc |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
33 class FindResponse::DicomTagsAtLevel::DicomValue : public boost::noncopyable |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
34 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
35 public: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
36 enum ValueType |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
37 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
38 ValueType_String, |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
39 ValueType_Null |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
40 }; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
41 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
42 private: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
43 ValueType type_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
44 std::string value_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
45 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
46 public: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
47 DicomValue(ValueType type, |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
48 const std::string& value) : |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
49 type_(type), |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
50 value_(value) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
51 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
52 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
53 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
54 ValueType GetType() const |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
55 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
56 return type_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
57 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
58 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
59 const std::string& GetValue() const |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
60 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
61 switch (type_) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
62 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
63 case ValueType_Null: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
64 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
65 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
66 case ValueType_String: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
67 return value_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
68 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
69 default: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
70 throw OrthancException(ErrorCode_ParameterOutOfRange); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
71 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
72 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
73 }; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
74 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
75 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
76 FindResponse::DicomTagsAtLevel::~DicomTagsAtLevel() |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
77 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
78 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
79 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
80 assert(it->second != NULL); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
81 delete it->second; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
82 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
83 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
84 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
85 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
86 void FindResponse::DicomTagsAtLevel::AddNullValue(uint16_t group, |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
87 uint16_t element) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
88 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
89 const DicomTag tag(group, element); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
90 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
91 if (content_.find(tag) == content_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
92 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
93 content_[tag] = new DicomValue(DicomValue::ValueType_Null, ""); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
94 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
95 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
96 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
97 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
98 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
99 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
100 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
101 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
102 void FindResponse::DicomTagsAtLevel::AddStringValue(uint16_t group, |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
103 uint16_t element, |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
104 const std::string& value) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
105 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
106 const DicomTag tag(group, element); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
107 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
108 if (content_.find(tag) == content_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
109 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
110 content_[tag] = new DicomValue(DicomValue::ValueType_String, value); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
111 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
112 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
113 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
114 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
115 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
116 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
117 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
118 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
119 void FindResponse::DicomTagsAtLevel::Fill(DicomMap& target) const |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
120 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
121 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
122 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
123 assert(it->second != NULL); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
124 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
125 switch (it->second->GetType()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
126 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
127 case DicomValue::ValueType_String: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
128 target.SetValue(it->first, it->second->GetValue(), false /* not binary */); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
129 break; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
130 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
131 case DicomValue::ValueType_Null: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
132 target.SetNullValue(it->first); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
133 break; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
134 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
135 default: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
136 throw OrthancException(ErrorCode_InternalError); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
137 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
138 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
139 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
140 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
141 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
142 void FindResponse::ChildrenAtLevel::AddIdentifier(const std::string& identifier) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
143 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
144 if (identifiers_.find(identifier) == identifiers_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
145 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
146 identifiers_.insert(identifier); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
147 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
148 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
149 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
150 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
151 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
152 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
153 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
154 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
155 FindResponse::DicomTagsAtLevel& FindResponse::Resource::GetDicomTagsAtLevel(ResourceType level) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 switch (level) |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 case ResourceType_Patient: |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
160 return patientTags_; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 case ResourceType_Study: |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
163 return studyTags_; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 case ResourceType_Series: |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
166 return seriesTags_; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 case ResourceType_Instance: |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
169 return instanceTags_; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 default: |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
172 throw OrthancException(ErrorCode_ParameterOutOfRange); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
177 FindResponse::ChildrenAtLevel& FindResponse::Resource::GetChildrenAtLevel(ResourceType level) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
179 switch (level) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
181 case ResourceType_Study: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
182 if (level_ == ResourceType_Patient) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
183 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
184 return childrenStudies_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
185 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
186 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
187 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
188 throw OrthancException(ErrorCode_BadParameterType); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
189 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
190 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
191 case ResourceType_Series: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
192 if (level_ == ResourceType_Patient || |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
193 level_ == ResourceType_Study) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
194 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
195 return childrenSeries_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
196 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
197 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
198 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
199 throw OrthancException(ErrorCode_BadParameterType); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
200 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
201 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
202 case ResourceType_Instance: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
203 if (level_ == ResourceType_Patient || |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
204 level_ == ResourceType_Study || |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
205 level_ == ResourceType_Series) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
206 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
207 return childrenInstances_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
208 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
209 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
210 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
211 throw OrthancException(ErrorCode_BadParameterType); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
212 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
213 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
214 default: |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
215 throw OrthancException(ErrorCode_ParameterOutOfRange); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
220 void FindResponse::Resource::AddMetadata(MetadataType metadata, |
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
221 const std::string& value) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 if (metadata_.find(metadata) != metadata_.end()) |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 throw OrthancException(ErrorCode_BadSequenceOfCalls); // Metadata already present |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 { |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
229 metadata_[metadata] = value; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
234 bool FindResponse::Resource::LookupMetadata(std::string& value, |
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
235 MetadataType metadata) const |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 { |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
237 std::map<MetadataType, std::string>::const_iterator found = metadata_.find(metadata); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 if (found == metadata_.end()) |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 return false; |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 { |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
245 value = found->second; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 return true; |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
251 void FindResponse::Resource::ListMetadata(std::set<MetadataType>& target) const |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 target.clear(); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
255 for (std::map<MetadataType, std::string>::const_iterator it = metadata_.begin(); it != metadata_.end(); ++it) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 target.insert(it->first); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
261 const std::string& FindResponse::Resource::GetParentIdentifier() const |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
262 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
263 if (level_ == ResourceType_Patient) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
264 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
265 throw OrthancException(ErrorCode_BadParameterType); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
266 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
267 else if (HasParentIdentifier()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
268 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
269 return *parentIdentifier_; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
270 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
271 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
272 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
273 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
274 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
275 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
277 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
278 void FindResponse::Resource::SetParentIdentifier(const std::string& id) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
280 if (level_ == ResourceType_Patient) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
281 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
282 throw OrthancException(ErrorCode_BadParameterType); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
283 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
284 else if (HasParentIdentifier()) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
290 parentIdentifier_.reset(new std::string(id)); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
291 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
292 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
293 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
294 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
295 bool FindResponse::Resource::HasParentIdentifier() const |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
296 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
297 if (level_ == ResourceType_Patient) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
298 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
299 throw OrthancException(ErrorCode_BadParameterType); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
300 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
301 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
302 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
303 return parentIdentifier_.get() != NULL; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
304 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
305 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
306 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
307 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
308 void FindResponse::Resource::AddLabel(const std::string& label) |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
309 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
310 if (labels_.find(label) == labels_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
311 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
312 labels_.insert(label); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
313 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
314 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
315 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
316 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
317 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
318 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
319 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
320 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
321 void FindResponse::Resource::AddAttachment(const FileInfo& attachment) |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
322 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
323 if (attachments_.find(attachment.GetContentType()) == attachments_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
324 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
325 attachments_[attachment.GetContentType()] = attachment; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
326 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
327 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
328 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
329 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
330 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
331 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
332 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
333 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
334 bool FindResponse::Resource::LookupAttachment(FileInfo& target, FileContentType type) const |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
335 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
336 std::map<FileContentType, FileInfo>::const_iterator it = attachments_.find(type); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
337 if (it != attachments_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
338 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
339 target = it->second; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
340 return true; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
341 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
342 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
343 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
344 return false; |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 FindResponse::~FindResponse() |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 for (size_t i = 0; i < items_.size(); i++) |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 assert(items_[i] != NULL); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 delete items_[i]; |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
359 void FindResponse::Add(Resource* item /* takes ownership */) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 { |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
361 std::unique_ptr<Resource> protection(item); |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
362 |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 if (item == NULL) |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 throw OrthancException(ErrorCode_NullPointer); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 } |
5588
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
367 else if (!items_.empty() && |
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
368 items_[0]->GetLevel() != item->GetLevel()) |
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
369 { |
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
370 throw OrthancException(ErrorCode_BadParameterType, "A find response must only contain resources of the same type"); |
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
371 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
374 const std::string& id = item->GetIdentifier(); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
375 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
376 if (index_.find(id) == index_.end()) |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
377 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
378 items_.push_back(protection.release()); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
379 index_[id] = item; |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
380 } |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
381 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
382 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
383 throw OrthancException(ErrorCode_BadSequenceOfCalls, "This resource has already been added: " + id); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
384 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
389 const FindResponse::Resource& FindResponse::GetResource(size_t index) const |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 if (index >= items_.size()) |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 throw OrthancException(ErrorCode_ParameterOutOfRange); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 assert(items_[index] != NULL); |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 return *items_[index]; |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 } |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
401 |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
402 |
5589
b51ee994cd6f
renamed FindResponse::Item as FindResponse::Resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5588
diff
changeset
|
403 FindResponse::Resource& FindResponse::GetResource(const std::string& id) |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
404 { |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
405 Index::const_iterator found = index_.find(id); |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
406 |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
407 if (found == index_.end()) |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
408 { |
5588
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
409 throw OrthancException(ErrorCode_InexistentItem); |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
410 } |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
411 else |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
412 { |
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
413 assert(found->second != NULL); |
5588
1b0fc6685f57
add index of resources into FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5586
diff
changeset
|
414 return *found->second; |
5586
fc3914c07dd3
refactoring FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5583
diff
changeset
|
415 } |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5565
diff
changeset
|
416 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 } |