annotate OrthancServer/Search/HierarchicalMatcher.cpp @ 1795:af6840eb23ee worklists

HierarchicalMatcher
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Nov 2015 17:41:22 +0100
parents
children 5e08a5fe6b27
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1795
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
af6840eb23ee HierarchicalMatcher
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
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include "../PrecompiledHeadersServer.h"
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "HierarchicalMatcher.h"
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "../../Core/OrthancException.h"
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../FromDcmtkBridge.h"
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include <dcmtk/dcmdata/dcfilefo.h>
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace Orthanc
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 HierarchicalMatcher::HierarchicalMatcher(ParsedDicomFile& query,
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 bool caseSensitivePN)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 Setup(*query.GetDcmtkObject().getDataset(),
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 caseSensitivePN,
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 query.GetEncoding());
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 HierarchicalMatcher::~HierarchicalMatcher()
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 for (Constraints::iterator it = constraints_.begin();
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 it != constraints_.end(); ++it)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 if (it->second != NULL)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 delete it->second;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 for (Sequences::iterator it = sequences_.begin();
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 it != sequences_.end(); ++it)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 if (it->second != NULL)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 delete it->second;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void HierarchicalMatcher::Setup(DcmItem& dataset,
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 bool caseSensitivePN,
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 Encoding encoding)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 for (unsigned long i = 0; i < dataset.card(); i++)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 DcmElement* element = dataset.getElement(i);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 if (element == NULL)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 throw OrthancException(ErrorCode_InternalError);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 DicomTag tag(FromDcmtkBridge::Convert(element->getTag()));
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 if (constraints_.find(tag) != constraints_.end() ||
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 sequences_.find(tag) != sequences_.end())
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 throw OrthancException(ErrorCode_BadRequest);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 if (vr == ValueRepresentation_Sequence)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(*element);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 if (sequence.card() == 0 ||
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 (sequence.card() == 1 && sequence.getItem(0)->card() == 0))
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 // Universal matching of a sequence
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 sequences_[tag] = NULL;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 else if (sequence.card() == 1)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 sequences_[tag] = new HierarchicalMatcher(*sequence.getItem(0), caseSensitivePN, encoding);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 else
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 throw OrthancException(ErrorCode_BadRequest);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 else
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 std::auto_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 (*element, DicomToJsonFlags_None, encoding));
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 if (value->IsBinary() ||
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 value->IsNull())
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 throw OrthancException(ErrorCode_BadRequest);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 else if (value->GetContent().empty())
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 // This is an universal matcher
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 constraints_[tag] = NULL;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 else
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 // DICOM specifies that searches must be case sensitive, except
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 // for tags with a PN value representation
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 bool sensitive = true;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 if (vr == ValueRepresentation_PatientName)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 sensitive = caseSensitivePN;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 constraints_[tag] = IFindConstraint::ParseDicomConstraint(tag, value->GetContent(), sensitive);
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 std::string HierarchicalMatcher::Format(const std::string& prefix) const
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 std::string s;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 for (Constraints::const_iterator it = constraints_.begin();
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 it != constraints_.end(); ++it)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 s += prefix + it->first.Format() + " ";
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 if (it->second == NULL)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 s += "*\n";
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 else
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 s += it->second->Format() + "\n";
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 for (Sequences::const_iterator it = sequences_.begin();
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 it != sequences_.end(); ++it)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 s += prefix + it->first.Format() + " ";
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 if (it->second == NULL)
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 s += "*\n";
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 else
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 s += "Sequence:\n" + it->second->Format(prefix + " ");
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 return s;
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 }
af6840eb23ee HierarchicalMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 }