| 110 | } |
| 111 | |
| 112 | bool ModelObjectList_Impl::hasModelObject(const ModelObject& modelObject) const { |
| 113 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 114 | |
| 115 | for (const auto& group : groups) { |
| 116 | // DLM: if an object was pointed to by this list but that object was deleted from the model, this list may have an empty field |
| 117 | // in that case getTarget may fail to return an object |
| 118 | boost::optional<WorkspaceObject> wo = group.cast<WorkspaceExtensibleGroup>().getTarget(OS_ModelObjectListExtensibleFields::ModelObject); |
| 119 | |
| 120 | OS_ASSERT(wo); |
| 121 | |
| 122 | if (wo->handle() == modelObject.handle()) { |
| 123 | return true; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | void ModelObjectList_Impl::removeModelObject(const ModelObject& modelObject) { |
| 131 | if (hasModelObject(modelObject)) { |
no test coverage detected