9#include "MantidNexus/DllConfig.h"
14#include <shared_mutex>
16#include <unordered_set>
24concept entryTypes = std::integral<T> || std::floating_point<T> || std::same_as<T, std::string>;
39 using CacheValue_t = std::variant<float, double, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t,
66 inline std::string
const &
filename() const noexcept {
return m_filename; }
73 inline std::string
const &
extension() const noexcept {
return m_extension; }
76 std::pair<std::string, std::string>
const &
firstEntryNameType() const noexcept {
return m_firstEntryNameType; };
79 bool hasRootAttr(std::string
const &
name)
const;
90 std::map<std::string, std::string>
const &
getAllEntries() const noexcept {
return m_allEntries; }
99 bool isEntry(std::string
const &entryName, std::string
const &groupClass)
const {
100 if (isEntry(entryName)) {
101 return m_allEntries.at(entryName) == groupClass;
112 bool isEntry(std::string
const &entryName)
const;
120 template <
typename T>
121 std::pair<T, NexusDescriptorLazy::CacheReturnStatus_t> getDataValue(
const std::string &datasetAddress)
const;
124 bool classTypeExists(std::string
const &classType)
const;
128 bool classTypeExistsChild(
const std::string &parentPath,
const std::string &classType)
const;
133 std::string getStrData(std::string
const &address);
140 std::map<std::string, std::string> initAllEntries();
141 void loadGroups(std::map<std::string, std::string> &allEntries, std::string
const &address,
unsigned int depth,
142 const unsigned int maxDepth);
144 const CacheValue_t _getDataValue(
const std::string &datasetAddress)
const;
std::string const m_filename
Nexus HDF5 file name.
NexusDescriptorLazy & operator=(NexusDescriptorLazy const &nd)=delete
std::string const & filename() const noexcept
Returns a constant reference to the current file name.
~NexusDescriptorLazy()=default
Using RAII components, no need to deallocate explicitly.
std::unordered_set< std::string > m_allMisses
the set of non-existent entries that have been checked
std::pair< std::string, std::string > m_firstEntryNameType
std::string const & extension() const noexcept
Access the file extension.
std::map< std::string, std::string > const & getAllEntries() const noexcept
Returns a const reference of the internal map holding all entries in the Nexus HDF5 file.
std::shared_mutex m_readNexusMutex
mutex to protect reading from file after initialization in const methods
std::unordered_set< std::string > m_rootAttrs
Root attributes cache.
bool isEntry(std::string const &entryName, std::string const &groupClass) const
Checks if a full-address entry exists for a particular groupClass in a Nexus dataset.
NexusDescriptorLazy(NexusDescriptorLazy &&nd)=delete
std::variant< float, double, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, std::string, CacheReturnStatus_t > CacheValue_t
NexusDescriptorLazy()=delete
std::string const m_extension
Extension.
std::pair< std::string, std::string > const & firstEntryNameType() const noexcept
Returns the name & type of the first entry in the file.
NexusDescriptorLazy(NexusDescriptorLazy const &nd)=delete
std::map< std::string, std::string > m_allEntries
All entries metadata.
UniqueID<&H5Fclose > m_fileID
HDF5 File Handle.
std::map< std::string, CacheValue_t > m_readEntries
the map of all read entry values that have been checked
NexusDescriptorLazy & operator=(NexusDescriptorLazy &&nd)=delete
A wrapper class for managing HDF5 object handles (hid_t).
Helper class which provides the Collimation Length for SANS instruments.