annotate OrthancServer/Sources/Database/FindResponse.h @ 5582:17da828f9443 find-refactoring

removed FindResponse::Item::level_
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 27 Apr 2024 21:42:32 +0200
parents 4ad301c35f6e
children 74cc31c8db2b
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"
5574
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
26 #include "../../../OrthancFramework/Sources/Enumerations.h"
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
27 #include "../../../OrthancFramework/Sources/FileStorage/FileInfo.h"
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include "../ServerEnumerations.h"
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "OrthancIdentifiers.h"
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
30 #include "FindRequest.h"
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <boost/noncopyable.hpp>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include <deque>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include <map>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include <set>
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
36 #include <list>
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
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 namespace Orthanc
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 class FindResponse : public boost::noncopyable
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 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
44
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
45 // 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
46 class StringWithRevision
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
47 {
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
48 private:
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
49 std::string value_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
50 int64_t revision_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
51 public:
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
52 StringWithRevision(const std::string& value,
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
53 int64_t revision) :
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
54 value_(value),
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
55 revision_(revision)
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 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
58
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
59 StringWithRevision(const StringWithRevision& other) :
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
60 value_(other.value_),
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
61 revision_(other.revision_)
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 }
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
64
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
65 StringWithRevision() :
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
66 revision_(-1)
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 }
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 const std::string& GetValue() const
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 return value_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
73 }
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 int64_t GetRevision() const
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 return revision_;
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 };
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
80
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
81
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 class Item : public boost::noncopyable
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 private:
5581
4ad301c35f6e refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5580
diff changeset
85 FindRequest::ResponseContent responseContent_; // TODO REMOVE // what has been requested
5580
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
86 OrthancIdentifiers identifiers_;
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
87 std::unique_ptr<DicomMap> dicomMap_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
88 std::list<std::string> children_;
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
89 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
90 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
91 std::map<MetadataType, std::string> metadata_;
5574
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
92 std::map<FileContentType, FileInfo> attachments_;
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 public:
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
95 Item(FindRequest::ResponseContent responseContent,
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 const OrthancIdentifiers& identifiers) :
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
97 responseContent_(responseContent),
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 identifiers_(identifiers)
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
102 Item(FindRequest::ResponseContent responseContent,
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
103 ResourceType level,
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 DicomMap* dicomMap /* takes ownership */);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 const OrthancIdentifiers& GetIdentifiers() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 return identifiers_;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
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
111 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
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 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
114 }
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
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
116 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
117 {
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
118 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
119 }
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
120
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
121 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
122
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 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
124 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
125 //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
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 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
128 {
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
129 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
130 }
5554
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 bool HasMetadata(MetadataType metadata) const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 return metadata_.find(metadata) != metadata_.end();
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
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
137 bool LookupMetadata(std::string& value, /* int64_t revision, */
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 MetadataType metadata) const;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
140 void ListMetadata(std::set<MetadataType>& metadata) const;
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 bool HasDicomMap() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 return dicomMap_.get() != NULL;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 const DicomMap& GetDicomMap() const;
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
148
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
149 void AddChild(const std::string& childId);
5565
def06a42e5ef Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
150
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
151 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
152 {
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
153 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
154 }
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
155
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
156 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
157 {
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
158 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
159 }
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
160
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
161 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
162 {
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
163 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
164 }
5574
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
165
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
166 void AddAttachment(const FileInfo& attachment)
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
167 {
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
168 attachments_[attachment.GetContentType()] = attachment;
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
169 }
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
170
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
171 const std::map<FileContentType, FileInfo>& GetAttachments() const
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
172 {
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
173 return attachments_;
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
174 }
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
175
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
176 bool LookupAttachment(FileInfo& target, FileContentType type) const
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
177 {
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
178 std::map<FileContentType, FileInfo>::const_iterator it = attachments_.find(type);
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
179 if (it != attachments_.end())
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
180 {
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
181 target = it->second;
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
182 return true;
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
183 }
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
184
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
185 return false;
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
186 }
5a13483d12c5 find-refactoring: attachments
Alain Mazy <am@orthanc.team>
parents: 5568
diff changeset
187
5580
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
188 void SetIdentifier(ResourceType level,
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
189 const std::string& id)
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
190 {
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
191 identifiers_.SetLevel(level, id);
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
192 }
df7324d6e728 removed redundant FindResponse::parent_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5579
diff changeset
193
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
194 // TODO-FIND: add other getters and setters
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 };
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 private:
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 std::deque<Item*> items_;
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 public:
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 ~FindResponse();
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 void Add(Item* item /* takes ownership */);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 size_t GetSize() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 return items_.size();
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }
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 const Item& GetItem(size_t index) const;
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 }