comparison OrthancServer/Sources/Database/FindRequest.cpp @ 5568:b0b5546f1b9f find-refactoring

find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
author Alain Mazy <am@orthanc.team>
date Thu, 25 Apr 2024 09:22:07 +0200
parents f3562c1a150d
children 8b32213af23e
comparison
equal deleted inserted replaced
5567:f3562c1a150d 5568:b0b5546f1b9f
71 } 71 }
72 72
73 73
74 FindRequest::~FindRequest() 74 FindRequest::~FindRequest()
75 { 75 {
76 for (std::deque<FilterConstraint*>::iterator it = filterConstraints_.begin(); it != filterConstraints_.end(); ++it) 76
77 for (std::deque<Ordering*>::iterator it = ordering_.begin(); it != ordering_.end(); ++it)
77 { 78 {
78 assert(*it != NULL); 79 assert(*it != NULL);
79 delete *it; 80 delete *it;
80 } 81 }
81 82 }
82 for (std::deque<Ordering*>::iterator it = ordering_.begin(); it != ordering_.end(); ++it) 83
83 { 84 void FindRequest::AddDicomTagConstraint(const DicomTagConstraint& constraint)
84 assert(*it != NULL); 85 {
85 delete *it; 86 dicomTagConstraints_.push_back(constraint);
86 } 87 }
87 } 88
88 89 const DicomTagConstraint& FindRequest::GetDicomTagConstraint(size_t index) const
89 90 {
90 void FindRequest::AddFilterConstraint(FilterConstraint* constraint /* takes ownership */) 91 if (index >= dicomTagConstraints_.size())
91 {
92 if (constraint == NULL)
93 {
94 throw OrthancException(ErrorCode_NullPointer);
95 }
96 else
97 {
98 filterConstraints_.push_back(constraint);
99 }
100 }
101
102
103 const FindRequest::FilterConstraint& FindRequest::GetFilterConstraint(size_t index) const
104 {
105 if (index >= filterConstraints_.size())
106 { 92 {
107 throw OrthancException(ErrorCode_ParameterOutOfRange); 93 throw OrthancException(ErrorCode_ParameterOutOfRange);
108 } 94 }
109 else 95 else
110 { 96 {
111 assert(filterConstraints_[index] != NULL); 97 return dicomTagConstraints_[index];
112 return *filterConstraints_[index];
113 } 98 }
114 } 99 }
115 100
116 101
117 void FindRequest::SetLimits(uint64_t since, 102 void FindRequest::SetLimits(uint64_t since,