diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/HDFDescriptor.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/HDFDescriptor.h index dc7fe15b9786f55bbbcbcab08ecc2004ae15c03b..ee3c38bd8692466b1afb7215055bc61089e57d59 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/HDFDescriptor.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/HDFDescriptor.h @@ -91,6 +91,8 @@ namespace Mantid bool pathExists(const std::string& path) const; /// Query if a path exists of a given type bool pathOfTypeExists(const std::string& path, const std::string &type) const; + /// return the path of a given type + std::string pathOfType(const std::string & type); /// Query if a given type exists somewhere in the file bool classTypeExists(const std::string & classType) const; diff --git a/Code/Mantid/Framework/Kernel/src/HDFDescriptor.cpp b/Code/Mantid/Framework/Kernel/src/HDFDescriptor.cpp index a4901a0fc8675d18e6cb833eaecb899fbe63b8fe..507dba7c31a14982253eba13e2746bf5d735f7b6 100644 --- a/Code/Mantid/Framework/Kernel/src/HDFDescriptor.cpp +++ b/Code/Mantid/Framework/Kernel/src/HDFDescriptor.cpp @@ -165,6 +165,20 @@ namespace Mantid else return false; } + /** + * @param type A string specifying the required type + * @return path A string giving a path using UNIX-style path separators (/), e.g. /raw_data_1, /entry/bank1 + */ + std::string HDFDescriptor::pathOfType(const std::string & type) { + auto iend = m_pathsToTypes.end(); + for (auto it = m_pathsToTypes.begin(); it != iend; ++it) { + if (type == it->second) + return it->first; + } + return ""; + } + + /** * @param classType A string name giving a class type * @return True if the type exists in the file, false otherwise