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

Method expandKeyValues

src/utilities/sql/SqlFile_Impl.cpp:3457–3494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3455 }
3456
3457 SqlFileTimeSeriesQueryVector SqlFile_Impl::expandKeyValues(const SqlFileTimeSeriesQuery& query) {
3458 SqlFileTimeSeriesQueryVector result;
3459
3460 // only "expand" regex
3461 result.push_back(query);
3462 if (query.keyValues() && query.keyValues().get().regex()) {
3463 // get available key value names
3464 StringVector kvNames;
3465 if (query.environment() && query.environment().get().name() && query.reportingFrequency() && query.timeSeries()
3466 && query.timeSeries().get().name()) {
3467 kvNames = availableKeyValues(query.environment().get().name().get(), query.reportingFrequency().get().valueDescription(),
3468 query.timeSeries().get().name().get());
3469 } else {
3470 LOG_AND_THROW("Not yet implemented.");
3471 }
3472 // check against regex
3473 boost::regex re = *(query.keyValues().get().regex());
3474 for (auto it = kvNames.begin(); it != kvNames.end();) {
3475 if (!boost::regex_match(*it, re)) {
3476 it = kvNames.erase(it);
3477 continue;
3478 }
3479 ++it;
3480 }
3481 if (kvNames.empty()) {
3482 result.clear();
3483 } else {
3484 // set names
3485 KeyValueIdentifier kvId(kvNames);
3486 result[0].setKeyValues(kvId);
3487 }
3488 }
3489
3490 // check result queries for consistency
3491 mf_makeConsistent(result);
3492
3493 return result;
3494 }
3495
3496 TimeSeriesVector SqlFile_Impl::timeSeries(const SqlFileTimeSeriesQuery& query) {
3497 TimeSeriesVector result;

Callers

nothing calls this directly

Calls 15

regexMethod · 0.80
environmentMethod · 0.80
valueDescriptionMethod · 0.80
beginMethod · 0.80
setKeyValuesMethod · 0.80
push_backMethod · 0.45
keyValuesMethod · 0.45
getMethod · 0.45
nameMethod · 0.45
reportingFrequencyMethod · 0.45
timeSeriesMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected