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

Method directUseCount

src/model/ResourceObject.cpp:25–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 : ParentObject_Impl(other, model, keepHandle) {}
24
25 unsigned ResourceObject_Impl::directUseCount(bool excludeChildren) const {
26
27 unsigned result = 0;
28
29 ModelObjectVector children;
30 if (excludeChildren) {
31 children = this->children();
32 }
33
34 WorkspaceObjectVector sources = this->sources();
35 for (const WorkspaceObject& source : sources) {
36 if (excludeChildren) {
37 // check if this is a child
38 auto it = std::find_if(children.cbegin(), children.cend(),
39 [h = source.handle()](const ModelObject& mo) { return handleEquals<ModelObject, Handle>(mo, h); });
40 if (it == children.end()) {
41 // non-Child--count the use
42 ++result;
43 }
44 } else {
45 // count the use
46 ++result;
47 }
48 }
49
50 return result;
51 }
52
53 unsigned ResourceObject_Impl::nonResourceObjectUseCount(bool excludeChildren) const {
54

Callers 15

runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
translateBuildingMethod · 0.80
removeMethod · 0.80
getRecursiveChildrenFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 6

sourcesMethod · 0.80
cbeginMethod · 0.80
cendMethod · 0.80
childrenMethod · 0.45
handleMethod · 0.45
endMethod · 0.45

Tested by 6

TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64