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

Method update_measures

src/cli/MeasureManager.cpp:767–785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767MeasureManagerServer::ResponseType MeasureManagerServer::update_measures(const web::json::value& body) {
768 auto measuresDir = get_field<openstudio::path>(body, "measures_dir", my_measures_dir);
769 const bool force_reload = get_field<bool>(body, "force_reload", false);
770
771 // Scan the directory for measures
772 std::vector<web::json::value> result;
773 for (const auto& dirEnt : openstudio::filesystem::directory_iterator{measuresDir}) {
774 if (openstudio::filesystem::is_directory(dirEnt)) {
775 const auto& measureDir = dirEnt.path();
776 if (boost::optional<BCLMeasure> measure_ = m_measureManager.getMeasure(measureDir, force_reload)) {
777 result.emplace_back(toWebJSON(measure_->toJSON()));
778 } else {
779 fmt::print("Directory '{}' is not a measure\n", measureDir.generic_string());
780 }
781 }
782 }
783
784 return {web::http::status_codes::OK, web::json::value::array(result)};
785}
786
787MeasureManagerServer::ResponseType MeasureManagerServer::compute_arguments(const web::json::value& body) {
788 openstudio::path measureDir;

Callers

nothing calls this directly

Calls 4

toWebJSONFunction · 0.85
pathMethod · 0.45
getMeasureMethod · 0.45
toJSONMethod · 0.45

Tested by

no test coverage detected