annotate OrthancServer/ExactResourceFinder.h @ 1356:ab9f3d5910bd

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 May 2015 13:19:28 +0200
parents OrthancServer/ResourceFinder.h@28563d910039
children 216db29c5aa9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #pragma once
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
1354
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
35 #include "ServerIndex.h"
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include <boost/noncopyable.hpp>
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Orthanc
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
1356
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1355
diff changeset
41 class ExactResourceFinder : public boost::noncopyable
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
1353
d7da97e21161 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1352
diff changeset
43 private:
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 typedef std::map<DicomTag, std::string> Query;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
1354
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
46 class CandidateResources;
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
47
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
48 ServerIndex& index_;
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
49 ResourceType level_;
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
50 bool caseSensitive_;
1355
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
51 bool nonMainTagsIgnored_;
1354
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
52 Query query_;
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
1354
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
54 static void ExtractTagsForLevel(Query& result,
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
55 Query& source,
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
56 ResourceType level);
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
57
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
58 void ApplyAtLevel(CandidateResources& candidates,
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
59 ResourceType level);
1353
d7da97e21161 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1352
diff changeset
60
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 public:
1356
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1355
diff changeset
62 ExactResourceFinder(ServerIndex& index);
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 bool IsCaseSensitive() const
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 return caseSensitive_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 void SetCaseSensitive(bool sensitive)
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 {
1354
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1353
diff changeset
71 caseSensitive_ = sensitive;
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
1355
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
74 bool NonMainTagsIgnored() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
75 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
76 return nonMainTagsIgnored_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
77 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
78
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
79 void SetNonMainTagsIgnored(bool ignored)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
80 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
81 nonMainTagsIgnored_ = ignored;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
82 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
83
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ResourceType GetLevel() const
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 return level_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 void SetLevel(ResourceType level)
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 level_ = level;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 void AddTag(const DicomTag& tag,
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 const std::string& value)
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 query_.insert(std::make_pair(tag, value));
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 void AddTag(const std::string& tag,
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 const std::string& value);
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 void Apply(std::list<std::string>& result);
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 };
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }