comparison OrthancServer/Search/LookupIdentifierQuery.cpp @ 3001:7695a9c81099

refactoring /tools/find using LookupResource::IVisitor
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Dec 2018 18:36:38 +0100
parents e583478e0c6c
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2998:0a52af0c66e7 3001:7695a9c81099
32 32
33 33
34 #include "../PrecompiledHeadersServer.h" 34 #include "../PrecompiledHeadersServer.h"
35 #include "LookupIdentifierQuery.h" 35 #include "LookupIdentifierQuery.h"
36 36
37 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
37 #include "../../Core/OrthancException.h" 38 #include "../../Core/OrthancException.h"
39 #include "../ServerToolbox.h"
38 #include "SetOfResources.h" 40 #include "SetOfResources.h"
39 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
40 41
41 #include <cassert> 42 #include <cassert>
42 43
43 44
44 45
45 namespace Orthanc 46 namespace Orthanc
46 { 47 {
48 LookupIdentifierQuery::SingleConstraint::
49 SingleConstraint(const DicomTag& tag,
50 IdentifierConstraintType type,
51 const std::string& value) :
52 tag_(tag),
53 type_(type),
54 value_(ServerToolbox::NormalizeIdentifier(value))
55 {
56 }
57
58
59 LookupIdentifierQuery::RangeConstraint::
60 RangeConstraint(const DicomTag& tag,
61 const std::string& start,
62 const std::string& end) :
63 tag_(tag),
64 start_(ServerToolbox::NormalizeIdentifier(start)),
65 end_(ServerToolbox::NormalizeIdentifier(end))
66 {
67 }
68
69
47 LookupIdentifierQuery::Disjunction::~Disjunction() 70 LookupIdentifierQuery::Disjunction::~Disjunction()
48 { 71 {
49 for (size_t i = 0; i < singleConstraints_.size(); i++) 72 for (size_t i = 0; i < singleConstraints_.size(); i++)
50 { 73 {
51 delete singleConstraints_[i]; 74 delete singleConstraints_[i];
79 for (Disjunctions::iterator it = disjunctions_.begin(); 102 for (Disjunctions::iterator it = disjunctions_.begin();
80 it != disjunctions_.end(); ++it) 103 it != disjunctions_.end(); ++it)
81 { 104 {
82 delete *it; 105 delete *it;
83 } 106 }
107 }
108
109
110 bool LookupIdentifierQuery::IsIdentifier(const DicomTag& tag)
111 {
112 return ServerToolbox::IsIdentifier(tag, level_);
84 } 113 }
85 114
86 115
87 void LookupIdentifierQuery::AddConstraint(DicomTag tag, 116 void LookupIdentifierQuery::AddConstraint(DicomTag tag,
88 IdentifierConstraintType type, 117 IdentifierConstraintType type,