annotate OrthancServer/ResourceFinder.h @ 1352:382439943749

ResourceFinder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 11 May 2015 17:25:53 +0200
parents
children d7da97e21161
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
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "ServerContext.h"
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 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class ResourceFinder : public boost::noncopyable
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 public:
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
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 private:
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ServerContext& context_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ResourceType level_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 bool caseSensitive_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 Query query_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 public:
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 ResourceFinder(ServerContext& context);
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 bool IsCaseSensitive() const
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 return caseSensitive_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 void SetCaseSensitive(bool sensitive)
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 caseSensitive_ = true;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 ResourceType GetLevel() const
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return level_;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 void SetLevel(ResourceType level)
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 level_ = level;
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 void AddTag(const DicomTag& tag,
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 const std::string& value)
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 query_.insert(std::make_pair(tag, value));
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 }
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 void AddTag(const std::string& tag,
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 const std::string& value);
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 void Apply(std::list<std::string>& result);
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 };
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }