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

Method referencedObjects

src/model/EnergyManagementSystemProgram.cpp:284–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 }
283
284 std::vector<ModelObject> EnergyManagementSystemProgram_Impl::referencedObjects() const {
285 //return vector of model objects that are referenced in program
286 std::vector<ModelObject> result;
287 const int subs[] = {1};
288 std::string possible_uid;
289
290 const Model m = this->model();
291 boost::optional<ModelObject> modelObject;
292
293 boost::optional<std::vector<std::string>> body = this->lines();
294 if (body.is_initialized()) {
295 //assume body is a vector of strings
296 for (size_t i = 0; i < body.get().size(); i++) {
297 //find uids
298 boost::sregex_token_iterator j(body.get().at(i).begin(), body.get().at(i).end(), uuidInString(), subs);
299
300 while (j != boost::sregex_token_iterator()) {
301 possible_uid = *j++;
302 //look to see if uid is in the model and return the object
303 UUID uid = toUUID(possible_uid);
304 modelObject = m.getModelObject<model::ModelObject>(uid);
305 if (modelObject) {
306 result.push_back(modelObject.get());
307 }
308 }
309 }
310 }
311 return result;
312 }
313
314 std::vector<std::string> EnergyManagementSystemProgram_Impl::invalidReferencedObjects() const {
315 //return vector of body lines that contain missing uid strings for invalid referenced objects

Callers 3

TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45

Calls 8

linesMethod · 0.95
toUUIDFunction · 0.85
beginMethod · 0.80
modelMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by 3

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36