comparison OrthancServer/QueryRetrieveHandler.cpp @ 2590:5e2730c8e23c jobs

getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 15 May 2018 16:28:43 +0200
parents 878b59270859
children 6f9225dcfc32
comparison
equal deleted inserted replaced
2589:a3fdfb6979ed 2590:5e2730c8e23c
74 74
75 void QueryRetrieveHandler::Invalidate() 75 void QueryRetrieveHandler::Invalidate()
76 { 76 {
77 done_ = false; 77 done_ = false;
78 answers_.Clear(); 78 answers_.Clear();
79 connection_.reset(NULL);
80 }
81
82
83 DicomUserConnection& QueryRetrieveHandler::GetConnection()
84 {
85 if (connection_.get() == NULL)
86 {
87 connection_.reset(new DicomUserConnection(localAet_, modality_));
88 connection_->Open();
89 }
90
91 return *connection_;
79 } 92 }
80 93
81 94
82 void QueryRetrieveHandler::Run() 95 void QueryRetrieveHandler::Run()
83 { 96 {
89 FixQuery(fixed, modality_.GetManufacturer()); 102 FixQuery(fixed, modality_.GetManufacturer());
90 103
91 // Secondly, possibly fix the query with the user-provider Lua callback 104 // Secondly, possibly fix the query with the user-provider Lua callback
92 FixQuery(fixed, context_, modality_.GetApplicationEntityTitle()); 105 FixQuery(fixed, context_, modality_.GetApplicationEntityTitle());
93 106
94 { 107 GetConnection().Find(answers_, level_, fixed);
95 // Finally, run the C-FIND SCU against the fixed query
96 ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_);
97 locker.GetConnection().Find(answers_, level_, fixed);
98 }
99 108
100 done_ = true; 109 done_ = true;
101 } 110 }
102 } 111 }
103 112
153 void QueryRetrieveHandler::Retrieve(const std::string& target, 162 void QueryRetrieveHandler::Retrieve(const std::string& target,
154 size_t i) 163 size_t i)
155 { 164 {
156 DicomMap map; 165 DicomMap map;
157 GetAnswer(map, i); 166 GetAnswer(map, i);
158 167 GetConnection().Move(target, map);
159 {
160 ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_);
161 locker.GetConnection().Move(target, map);
162 }
163 } 168 }
164 169
165 170
166 void QueryRetrieveHandler::Retrieve(const std::string& target) 171 void QueryRetrieveHandler::Retrieve(const std::string& target)
167 { 172 {