Skip to content
Snippets Groups Projects
Commit 46e6b49a authored by Ricardo Leal's avatar Ricardo Leal
Browse files

Re #6771 added pathOfType method

parent 9ab01da5
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,8 @@ namespace Mantid ...@@ -91,6 +91,8 @@ namespace Mantid
bool pathExists(const std::string& path) const; bool pathExists(const std::string& path) const;
/// Query if a path exists of a given type /// Query if a path exists of a given type
bool pathOfTypeExists(const std::string& path, const std::string &type) const; 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 /// Query if a given type exists somewhere in the file
bool classTypeExists(const std::string & classType) const; bool classTypeExists(const std::string & classType) const;
......
...@@ -165,6 +165,20 @@ namespace Mantid ...@@ -165,6 +165,20 @@ namespace Mantid
else return false; 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 * @param classType A string name giving a class type
* @return True if the type exists in the file, false otherwise * @return True if the type exists in the file, false otherwise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment