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

Method validityReport

src/utilities/idf/IdfFile.cpp:237–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237ValidityReport IdfFile::validityReport(StrictnessLevel level) const {
238 ValidityReport report(level);
239
240 // StrictnessLevel::Minimal
241 // DataErrorType::NoIdd
242 // \todo Only way there can be no IddFile is if IddFileType is set to UserCustom
243
244 // by-object items
245 for (const IdfObject& object : m_objects) {
246 // object-level report
247 ValidityReport objectReport = object.validityReport(level);
248 OptionalDataError oError = objectReport.nextError();
249 while (oError) {
250 report.insertError(*oError);
251 oError = objectReport.nextError();
252 }
253
254 // StrictnessLevel::Draft
255 if (level > StrictnessLevel::Minimal) {
256 // DataErrorType::NoIdd
257 // object-level
258 if (!m_iddFileAndFactoryWrapper.isInFile(object.iddObject().type())) {
259 report.insertError(DataError(object, DataErrorType(DataErrorType::NoIdd)));
260 }
261 } // StrictnessLevel::Draft
262 }
263
264 // StrictnessLevel::Final
265 if (level > StrictnessLevel::Draft) {
266 // DataErrorType::NullAndRequired
267 // collection-level: required object missing
268 IddObjectVector requiredObjects = m_iddFileAndFactoryWrapper.requiredObjects();
269 for (const IddObject& iddObject : requiredObjects) {
270 if (numObjectsOfType(iddObject.type()) < 1) {
271 report.insertError(DataError(DataErrorType(DataErrorType::NullAndRequired), iddObject.type()));
272 }
273 }
274
275 // DataErrorType::Duplicate
276 // collection-level: unique object duplicated
277 IddObjectVector uniqueObjects = m_iddFileAndFactoryWrapper.uniqueObjects();
278 for (const IddObject& iddObject : uniqueObjects) {
279 if (numObjectsOfType(iddObject.type()) > 1) {
280 report.insertError(DataError(DataErrorType(DataErrorType::Duplicate), iddObject.type()));
281 }
282 }
283
284 } // StrictnessLevel::Final
285
286 return report;
287}
288
289// SERIALIZATON
290

Callers 9

TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
loadModelMethod · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
updateVersionMethod · 0.45

Calls 8

nextErrorMethod · 0.80
insertErrorMethod · 0.80
isInFileMethod · 0.80
iddObjectMethod · 0.80
DataErrorClass · 0.70
typeMethod · 0.45
requiredObjectsMethod · 0.45
uniqueObjectsMethod · 0.45

Tested by 7

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36