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

Method removeObject

src/utilities/idf/IdfFile.cpp:170–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170bool IdfFile::removeObject(const IdfObject& object) {
171 auto it =
172 std::find_if(m_objects.begin(), m_objects.end(), [h = object.handle()](const IdfObject& obj) { return handleEquals<IdfObject, Handle>(obj, h); });
173
174 if (it != m_objects.end()) {
175 IdfObjectVector::size_type index(it - m_objects.begin());
176 if (it->iddObject().isVersionObject()
177 || ((object.iddObject().type() == IddObjectType::Catchall) && (object.numFields() > 0u)
178 && (boost::regex_match(object.getString(0).get(), iddRegex::versionObjectName())))) {
179 m_versionObjectIndices.erase(index);
180 }
181 m_objects.erase(it);
182 std::vector<IdfObjectVector::size_type> toModify;
183 for (const auto i : m_versionObjectIndices) {
184 if (i > index) {
185 toModify.push_back(i);
186 }
187 }
188 for (auto i : toModify) {
189 m_versionObjectIndices.erase(i);
190 m_versionObjectIndices.insert(i - 1);
191 }
192 return true;
193 }
194 return false;
195}
196
197int IdfFile::removeObjects(const std::vector<IdfObject>& objects) {
198 int result(0);

Callers 5

translateModelPrivateMethod · 0.45
removeMethod · 0.45
loadMethod · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45

Calls 12

beginMethod · 0.80
isVersionObjectMethod · 0.80
iddObjectMethod · 0.80
endMethod · 0.45
handleMethod · 0.45
typeMethod · 0.45
numFieldsMethod · 0.45
getMethod · 0.45
getStringMethod · 0.45
eraseMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45

Tested by 2

TEST_FFunction · 0.36
TEST_FFunction · 0.36