annotate OrthancServer/Sources/Database/FindResponse.h @ 5568:b0b5546f1b9f find-refactoring

find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
author Alain Mazy <am@orthanc.team>
date Thu, 25 Apr 2024 09:22:07 +0200
parents def06a42e5ef
children 5a13483d12c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 #pragma once
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/DicomMap.h"
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../ServerEnumerations.h"
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "OrthancIdentifiers.h"
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
28 #include "FindRequest.h"
5554
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 #include <boost/noncopyable.hpp>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <deque>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <map>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include <set>
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
34 #include <list>
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 namespace Orthanc
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 class FindResponse : public boost::noncopyable
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 public:
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
42
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
43 // TODO-FIND: does it actually make sense to retrieve revisions for metadata and attachments ?
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
44 class StringWithRevision
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
45 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
46 private:
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
47 std::string value_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
48 int64_t revision_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
49 public:
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
50 StringWithRevision(const std::string& value,
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
51 int64_t revision) :
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
52 value_(value),
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
53 revision_(revision)
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
54 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
55 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
56
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
57 StringWithRevision(const StringWithRevision& other) :
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
58 value_(other.value_),
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
59 revision_(other.revision_)
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
60 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
61 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
62
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
63 StringWithRevision() :
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
64 revision_(-1)
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
65 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
66 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
67
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
68 const std::string& GetValue() const
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
69 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
70 return value_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
71 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
72
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
73 int64_t GetRevision() const
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
74 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
75 return revision_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
76 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
77 };
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
78
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
79
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 class Item : public boost::noncopyable
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 private:
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
83 FindRequest::ResponseContent responseContent_; // what has been requested
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
84 ResourceType level_;
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
85 std::string resourceId_;
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
86 std::string parent_;
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
87 OrthancIdentifiers identifiers_; // TODO-FIND: not convenient to use here. A simple resourceId seems enough
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
88 std::unique_ptr<DicomMap> dicomMap_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
89 std::list<std::string> children_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
90 std::string childInstanceId_;
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
91 std::set<std::string> labels_;
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
92 std::map<MetadataType, std::string> metadata_;
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
93 std::map<uint16_t, std::string> attachments_;
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 public:
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
96 Item(FindRequest::ResponseContent responseContent,
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
97 ResourceType level,
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 const OrthancIdentifiers& identifiers) :
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
99 responseContent_(responseContent),
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 level_(level),
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 identifiers_(identifiers)
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
105 Item(FindRequest::ResponseContent responseContent,
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
106 ResourceType level,
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
107 const std::string& resourceId) :
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
108 responseContent_(responseContent),
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
109 level_(level),
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
110 resourceId_(resourceId)
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
111 {
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
112 }
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
113
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
114 Item(FindRequest::ResponseContent responseContent,
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
115 ResourceType level,
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 DicomMap* dicomMap /* takes ownership */);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 ResourceType GetLevel() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 return level_;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
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
123 const std::string& GetResourceId() const
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
124 {
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
125 return resourceId_;
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
126 }
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
127
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 const OrthancIdentifiers& GetIdentifiers() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 return identifiers_;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
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
133 FindRequest::ResponseContent GetResponseContent() const
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
134 {
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
135 return responseContent_;
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
136 }
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
137
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
138 bool HasResponseContent(FindRequest::ResponseContent content) const
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
139 {
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
140 return (responseContent_ & content) == content;
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
141 }
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
142
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
143 void AddDicomTag(uint16_t group, uint16_t element, const std::string& value, bool isBinary);
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
144
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 void AddMetadata(MetadataType metadata,
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
146 const std::string& value);
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
147 //int64_t revision);
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
148
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
149 const std::map<MetadataType, std::string>& GetMetadata() const
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
150 {
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
151 return metadata_;
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
152 }
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 bool HasMetadata(MetadataType metadata) const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 return metadata_.find(metadata) != metadata_.end();
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
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
159 bool LookupMetadata(std::string& value, /* int64_t revision, */
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 MetadataType metadata) const;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
162 void ListMetadata(std::set<MetadataType>& metadata) const;
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 bool HasDicomMap() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 return dicomMap_.get() != NULL;
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
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 const DicomMap& GetDicomMap() const;
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
170
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
171 void AddChild(const std::string& childId);
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
172
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
173 const std::list<std::string>& GetChildren() const
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
174 {
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
175 return children_;
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
176 }
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
177
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
178 void SetParent(const std::string& parent)
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
179 {
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
180 parent_ = parent;
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
181 }
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
182
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
183 const std::string& GetParent() const
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
184 {
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
185 return parent_;
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
186 }
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
187
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
188 void AddLabel(const std::string& label)
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
189 {
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
190 labels_.insert(label);
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
191 }
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
192
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
193 const std::set<std::string>& GetLabels() const
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
194 {
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
195 return labels_;
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
196 }
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
197 // TODO-FIND: add other getters and setters
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 };
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 private:
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 std::deque<Item*> items_;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 public:
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 ~FindResponse();
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 void Add(Item* item /* takes ownership */);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 size_t GetSize() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 return items_.size();
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 const Item& GetItem(size_t index) const;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 };
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 }