Mantid
Loading...
Searching...
No Matches
LegacyNexusDescriptor.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 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 "MantidKernel/DllConfig.h"
10
11#include <map>
12#include <memory>
13#include <string>
14#include <unordered_set>
15#include <utility>
16#include <vector>
17
18namespace Mantid::LegacyNexus {
19class File;
20}
21
22namespace Mantid {
23namespace Kernel {
24
32class MANTID_KERNEL_DLL LegacyNexusDescriptor {
33
34public:
36 LegacyNexusDescriptor(const std::string &filename);
39
42
45
48
53 inline const std::string &filename() const { return m_filename; }
59 inline const std::string &extension() const { return m_extension; }
64 inline Mantid::LegacyNexus::File &data() { return *m_file; }
65
67 const std::pair<std::string, std::string> &firstEntryNameType() const;
69 bool pathExists(const std::string &path) const;
70
71private:
73 void initialize(const std::string &filename);
75 void walkFile(Mantid::LegacyNexus::File &file, const std::string &rootPath, const std::string &className,
76 std::map<std::string, std::string> &pmap, int level);
77
79 std::string m_filename;
81 std::string m_extension;
83 std::pair<std::string, std::string> m_firstEntryNameType;
85 std::unordered_set<std::string> m_rootAttrs;
87 std::map<std::string, std::string> m_pathsToTypes;
88
90 std::unique_ptr<Mantid::LegacyNexus::File> m_file;
91};
92
93} // namespace Kernel
94} // namespace Mantid
Defines a wrapper around a file whose internal structure can be accessed using the NeXus API.
LegacyNexusDescriptor(const LegacyNexusDescriptor &)=delete
Disable copy operator.
std::map< std::string, std::string > m_pathsToTypes
Map of full path strings to types. Can check if path exists quickly.
std::pair< std::string, std::string > m_firstEntryNameType
First entry name/type.
std::unordered_set< std::string > m_rootAttrs
Root attributes.
LegacyNexusDescriptor()=delete
Disable default constructor.
const std::string & extension() const
Access the file extension.
Mantid::LegacyNexus::File & data()
Access the open NeXus File object.
LegacyNexusDescriptor & operator=(const LegacyNexusDescriptor &)=delete
Disable assignment operator.
const std::string & filename() const
Access the filename.
std::unique_ptr< Mantid::LegacyNexus::File > m_file
Open NeXus handle.
Helper class which provides the Collimation Length for SANS instruments.
Generate a tableworkspace to store the calibration results.