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

Method mf_makeConsistent

src/utilities/sql/SqlFile_Impl.cpp:4254–4389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4252 }
4253
4254 void SqlFile_Impl::mf_makeConsistent(std::vector<SqlFileTimeSeriesQuery>& queries) {
4255 // make each query consistent, or delete it if there is no possibility of a matching TimeSeries
4256 // do not check name validity--only cross-validity
4257 for (auto queryIt = queries.begin(); queryIt < queries.end();) {
4258 // environment
4259 OptionalString envName;
4260 if (queryIt->environment() && queryIt->environment()->name()) {
4261 envName = queryIt->environment()->name();
4262 }
4263
4264 // reporting frequency
4265 OptionalReportingFrequency rf;
4266 if (queryIt->reportingFrequency()) {
4267 rf = queryIt->reportingFrequency();
4268 }
4269 ReportingFrequencySet rfSet;
4270 if (envName && rf) {
4271 // check compatibility
4272 rfSet = availableReportingFrequencySet(*this, *envName);
4273 if (rfSet.find(*rf) == rfSet.end()) {
4274 queryIt = queries.erase(queryIt);
4275 continue;
4276 }
4277 }
4278
4279 // time series
4280 OptionalString tsName;
4281 if (queryIt->timeSeries() && queryIt->timeSeries()->name()) {
4282 tsName = queryIt->timeSeries()->name();
4283 }
4284 IStringSet tsSet;
4285 StringVector temp;
4286 StringVector envNames;
4287 if (envName && tsName) {
4288 if (rf) {
4289 temp = availableVariableNames(*envName, rf->valueDescription());
4290 tsSet.insert(temp.begin(), temp.end());
4291 } else {
4292 rfSet = availableReportingFrequencySet(*this, *envName);
4293 for (const ReportingFrequency& rf : rfSet) {
4294 temp = availableVariableNames(*envName, rf.valueDescription());
4295 tsSet.insert(temp.begin(), temp.end());
4296 }
4297 }
4298 } else if (rf && tsName) {
4299 envNames = availableEnvPeriods();
4300 for (const std::string& envName : envNames) {
4301 temp = availableVariableNames(envName, rf->valueDescription());
4302 tsSet.insert(temp.begin(), temp.end());
4303 }
4304 } else if (tsName) {
4305 temp = availableTimeSeries();
4306 tsSet.insert(temp.begin(), temp.end());
4307 }
4308 if (tsName) {
4309 if (tsSet.find(*tsName) == tsSet.end()) {
4310 queryIt = queries.erase(queryIt);
4311 continue;

Callers

nothing calls this directly

Calls 15

istringEqualFunction · 0.85
beginMethod · 0.80
environmentMethod · 0.80
valueDescriptionMethod · 0.80
regexMethod · 0.80
namesMethod · 0.80
cbeginMethod · 0.80
cendMethod · 0.80
setKeyValuesMethod · 0.80
endMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected