Mantid
Loading...
Searching...
No Matches
NexusDescriptor.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidNexus/DllConfig.h"
10
11#include <map>
12#include <set>
13#include <string>
14#include <unordered_set>
15#include <vector>
16
17// from NexusFile_fwd.h
18enum class NXaccess : unsigned int;
19
20namespace Mantid {
21namespace Nexus {
22
23class MANTID_NEXUS_DLL NexusDescriptor {
24
25public:
30 NexusDescriptor(std::string const &filename);
31
32 NexusDescriptor(std::string const &filename, NXaccess access);
33
34 NexusDescriptor() = delete;
35
37
38 NexusDescriptor(NexusDescriptor const &nd) = default;
39
43 ~NexusDescriptor() = default;
44
49 const std::string &filename() const noexcept;
50
56 inline const std::string &extension() const { return m_extension; }
57
59 const std::pair<std::string, std::string> &firstEntryNameType() const { return m_firstEntryNameType; };
60
62 bool hasRootAttr(const std::string &name) const;
63
74 const std::map<std::string, std::set<std::string>> &getAllEntries() const noexcept;
75
83 bool isEntry(const std::string &entryName, const std::string &groupClass) const noexcept;
84
90 bool isEntry(const std::string &entryName) const noexcept;
91
97 std::vector<std::string> allAddressesOfType(const std::string &type) const;
98
104 std::map<std::string, std::string> allAddressesAtLevel(const std::string &level) const;
105
107 bool classTypeExists(const std::string &classType) const;
108
113 std::string classTypeForName(std::string const &name) const;
114
122 void addEntry(const std::string &entryName, const std::string &groupClass);
123
124 void addRootAttr(const std::string &name);
125
126private:
131 std::map<std::string, std::set<std::string>> initAllEntries();
132
134 std::string m_filename;
136 std::string m_extension;
138 std::pair<std::string, std::string> m_firstEntryNameType;
140 std::unordered_set<std::string> m_rootAttrs;
141
150 std::map<std::string, std::set<std::string>> m_allEntries;
151};
152
153} // namespace Nexus
154} // namespace Mantid
std::string name
Definition Run.cpp:60
NXaccess
Nexus file access codes.
NexusDescriptor(NexusDescriptor const &nd)=default
const std::pair< std::string, std::string > & firstEntryNameType() const
Returns the name & type of the first entry in the file.
~NexusDescriptor()=default
Using RAII components, no need to deallocate explicitly.
NexusDescriptor & operator=(NexusDescriptor const &nd)=default
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.