comparison OrthancServer/ResourceFinder.h @ 1359:4378a6636187

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 15 May 2015 13:17:37 +0200
parents 62d2d35b725e
children 0649c5aef34a
comparison
equal deleted inserted replaced
1358:62d2d35b725e 1359:4378a6636187
30 **/ 30 **/
31 31
32 32
33 #pragma once 33 #pragma once
34 34
35 #include "BaseResourceFinder.h" 35 #include "ServerIndex.h"
36
37 #include <boost/noncopyable.hpp>
36 38
37 namespace Orthanc 39 namespace Orthanc
38 { 40 {
39 class ResourceFinder : public boost::noncopyable 41 class BaseResourceFinder : public boost::noncopyable
40 { 42 {
43 public:
44 class IMainTagsFilter : public boost::noncopyable
45 {
46 public:
47 virtual ~IMainTagsFilter()
48 {
49 }
50
51 virtual bool Apply(const DicomMap& mainTags,
52 ResourceType level) = 0;
53 };
54
55
56 class IInstanceFilter : public boost::noncopyable
57 {
58 public:
59 virtual ~IInstanceFilter()
60 {
61 }
62
63 virtual bool Apply(const std::string& instanceId,
64 const Json::Value& content) = 0;
65 };
66
67
41 private: 68 private:
42 BaseResourceFinder finder_; 69 typedef std::map<DicomTag, std::string> Identifiers;
70
71 class CandidateResources;
72
73 ServerContext& context_;
74 ResourceType level_;
75 size_t maxResults_;
76 Identifiers identifiers_;
77 IMainTagsFilter *mainTagsFilter_;
78 IInstanceFilter *instanceFilter_;
79
80 void ApplyAtLevel(CandidateResources& candidates,
81 ResourceType level);
43 82
44 public: 83 public:
45 ResourceFinder(ServerContext& context) : 84 BaseResourceFinder(ServerContext& context);
46 finder_(context)
47 {
48 }
49 85
50 ResourceType GetLevel() const 86 ResourceType GetLevel() const
51 { 87 {
52 return finder_.GetLevel(); 88 return level_;
53 } 89 }
54 90
55 void SetLevel(ResourceType level) 91 void SetLevel(ResourceType level)
56 { 92 {
57 finder_.SetLevel(level); 93 level_ = level;
94 }
95
96 void SetIdentifier(const DicomTag& tag,
97 const std::string& value);
98
99 void SetMainTagsFilter(IMainTagsFilter& filter)
100 {
101 mainTagsFilter_ = &filter;
102 }
103
104 void SetInstanceFilter(IInstanceFilter& filter)
105 {
106 instanceFilter_ = &filter;
58 } 107 }
59 108
60 void SetMaxResults(size_t value) 109 void SetMaxResults(size_t value)
61 { 110 {
62 finder_.SetMaxResults(value); 111 maxResults_ = value;
63 } 112 }
64 113
65 size_t GetMaxResults() const 114 size_t GetMaxResults() const
66 { 115 {
67 return finder_.GetMaxResults(); 116 return maxResults_;
68 } 117 }
69 118
70 bool Apply(std::list<std::string>& result) 119 // Returns "true" iff. all the matching resources have been
71 { 120 // returned. Will be "false" if the results were truncated by
72 return finder_.Apply(result); 121 // "SetMaxResults()".
73 } 122 bool Apply(std::list<std::string>& result);
74 }; 123 };
75 124
76 } 125 }