diff --git a/Framework/API/inc/MantidAPI/AlgorithmFactory.h b/Framework/API/inc/MantidAPI/AlgorithmFactory.h index 16d5e5fe5c3645b69423cceefcf22b6ca7612fe1..2f1a57cb835a14005e87553a23757f13567948b0 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmFactory.h +++ b/Framework/API/inc/MantidAPI/AlgorithmFactory.h @@ -133,9 +133,6 @@ public: /// Get the algorithm categories const std::map<std::string, bool> getCategoriesWithState() const; - /// Returns a single algorithm descriptor - int getAlgLatestVersion(const std::string &algName) const; - /// Returns algorithm descriptors. std::vector<AlgorithmDescriptor> getDescriptors(bool includeHidden = false) const; diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp index 06387b4cac56c9cf5a1c44c336c86631562962ae..dbd4bf8bcd04d3c697b845fb794949d9dd5ce684 100644 --- a/Framework/API/src/AlgorithmFactory.cpp +++ b/Framework/API/src/AlgorithmFactory.cpp @@ -306,26 +306,6 @@ AlgorithmFactoryImpl::getCategories(bool includeHidden) const { return validCategories; } -/** - * Returns a the latest version number of the given algorithm - * - * @param algName The name of the algorithm to get a version for - * @param throwIfNotRegistered (Default true) Throw if the algorithm is not - *registered - * @return Integer of the latest algorithm version or -1 if it does not exist - * @throws std::runtime_error if algorithm does not exist and throw is true - */ -int AlgorithmFactoryImpl::getAlgLatestVersion( - const std::string &algName) const { - auto it = m_vmap.find(algName); - - if (it == m_vmap.end()) { - throw std::runtime_error("Algorithm not registered " + algName); - } - - return it->second; -} - /** * Get a list of descriptor objects used to order the algorithms in the stored * map diff --git a/Framework/API/src/NotebookBuilder.cpp b/Framework/API/src/NotebookBuilder.cpp index 802667f2f78fb70e4c19cc4bb56740c454208474..b5b48a37d76381c47455d084ca4227a509f26942 100644 --- a/Framework/API/src/NotebookBuilder.cpp +++ b/Framework/API/src/NotebookBuilder.cpp @@ -124,7 +124,7 @@ NotebookBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) { //...or only specify algorithm versions when they're not the newest version const auto &algName = algHistory->name(); int latestVersion = - AlgorithmFactory::Instance().getAlgLatestVersion(algName); + AlgorithmFactory::Instance().highestVersion(algName); // If a newer version of this algorithm exists, then this must be an old // version. if (latestVersion > algHistory->version()) { diff --git a/Framework/API/src/ScriptBuilder.cpp b/Framework/API/src/ScriptBuilder.cpp index 7067e6e728dbf30e321fc9b1841c046bbc1109bf..e78460308dbec8c115ed7c814ff4aea5a3e88194 100644 --- a/Framework/API/src/ScriptBuilder.cpp +++ b/Framework/API/src/ScriptBuilder.cpp @@ -198,7 +198,7 @@ ScriptBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) { //...or only specify algorithm versions when they're not the newest version const auto &algName = algHistory->name(); int latestVersion = - AlgorithmFactory::Instance().getAlgLatestVersion(algName); + AlgorithmFactory::Instance().highestVersion(algName); // If a newer version of this algorithm exists, then this must be an old // version. if (latestVersion > algHistory->version()) { diff --git a/Framework/API/test/AlgorithmFactoryTest.h b/Framework/API/test/AlgorithmFactoryTest.h index 12888539c987108fbc75118cc9a9b4294993be9c..a6d7ac51f7c8664036a8b557273b1bdb31a5c015 100644 --- a/Framework/API/test/AlgorithmFactoryTest.h +++ b/Framework/API/test/AlgorithmFactoryTest.h @@ -187,25 +187,6 @@ public: TS_ASSERT_EQUALS(noOfAlgs - 1, descriptors.size()); } - void testGetLatestVersion() { - auto &algFactory = AlgorithmFactory::Instance(); - - const std::string algName = "ToyAlgorithm"; - algFactory.subscribe<ToyAlgorithm>(); - algFactory.subscribe<ToyAlgorithmTwo>(); - - int version = -1; - TS_ASSERT_THROWS_NOTHING(version = algFactory.getAlgLatestVersion(algName)); - - TS_ASSERT_EQUALS(version, 2); - - algFactory.unsubscribe(algName, 1); - algFactory.unsubscribe(algName, 2); - - TS_ASSERT_THROWS(algFactory.getAlgLatestVersion(algName), - std::runtime_error); - } - void testGetCategories() { auto &algFactory = AlgorithmFactory::Instance(); algFactory.subscribe<CategoryAlgorithm>();