MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / checkForMeasureUpdates

Method checkForMeasureUpdates

src/utilities/bcl/RemoteBCL.cpp:238–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238int RemoteBCL::checkForMeasureUpdates() {
239 m_measuresWithUpdates.clear();
240
241 for (const BCLMeasure& measure : LocalBCL::instance().measures()) {
242 // can't start another request until last one is done
243 if (m_httpResponse && !m_httpResponse->is_done()) {
244 return 0;
245 }
246
247 m_lastSearch.clear();
248
249 auto client = getClient(remoteUrl(), m_timeOutSeconds);
250 web::uri_builder builder(to_string_t("/api/search/"));
251
252 builder.append_path(to_string_t("*.xml"));
253
254 builder.append_query(to_string_t("fq[]"), to_string_t("ss_uuid:" + measure.uid()));
255
256 builder.append_query(to_string_t("api_version"), to_string_t(m_apiVersion));
257
258 // LOG(Debug, m_remoteUrl << builder.to_string());
259
260 m_httpResponse = client.request(web::http::methods::GET, builder.to_string())
261 .then([](web::http::http_response resp) { return resp.extract_utf8string(); })
262 .then([this](const std::string& xml) {
263 auto remoteQueryResponse = processReply(xml);
264
265 if (remoteQueryResponse) {
266 m_lastSearch = processSearchResponse(*remoteQueryResponse);
267 }
268 });
269
270 std::vector<BCLSearchResult> result = waitForSearch();
271 if (!result.empty() && result[0].versionId() != measure.versionId()) {
272 m_measuresWithUpdates.push_back(result[0]);
273 }
274 }
275
276 return m_measuresWithUpdates.size();
277}
278
279std::vector<BCLSearchResult> RemoteBCL::componentsWithUpdates() const {
280 return m_componentsWithUpdates;

Callers

nothing calls this directly

Calls 9

measuresMethod · 0.80
requestMethod · 0.80
to_stringMethod · 0.80
clearMethod · 0.45
uidMethod · 0.45
emptyMethod · 0.45
versionIdMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected