bool IddFileAndFactoryWrapper::isInFile(const std::string& objectName) const { if (m_iddFile) { OptionalIddObject candidate = m_iddFile->getObject(objectName); return candidate; } else if (m_iddFileType) { OptionalIddObject candidate = IddFactory::instance().getObject(objectName); if (candidate) { return IddFactory::instance().isInFile(candidate->type(),*m_iddFileType); } else { return false; } } LOG_AND_THROW("Invalid IddFactoryWrapper has no IddFile set."); return false; }
boost::optional<IddObject> IddFileAndFactoryWrapper::getObject(const std::string& objectName) const { OptionalIddObject result; if (m_iddFile) { result = m_iddFile->getObject(objectName); } else if (m_iddFileType) { OptionalIddObject candidate = IddFactory::instance().getObject(objectName); if (candidate) { if (isInFile(candidate->type())) { result = candidate; } } } else { LOG_AND_THROW("Invalid IddFactoryWrapper has no IddFile set."); } return result; }
TEST_F(IddFixture,IddFactory_RoomAir_TemperaturePattern_TwoGradient) { // there seems to be a problem with this object OptionalIddObject object = IddFactory::instance().getObject("RoomAir:TemperaturePattern:TwoGradient"); ASSERT_TRUE(object); ASSERT_TRUE(object->type() == IddObjectType::RoomAir_TemperaturePattern_TwoGradient); }