|
Mantid
|
#include <NexusDescriptorLazy.h>
Public Member Functions | |
| bool | classTypeExists (std::string const &classType) const |
| Query if a given type exists somewhere in the file. | |
| bool | classTypeExistsChild (const std::string &parentPath, const std::string &classType) const |
| Query if a given type exists as a decendant of the supplied parentPath. | |
| std::string const & | extension () const noexcept |
| Access the file extension. | |
| std::string const & | filename () const noexcept |
| Returns a constant reference to the current file name. | |
| std::pair< std::string, std::string > const & | firstEntryNameType () const noexcept |
| Returns the name & type of the first entry in the file. | |
| 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::string | getStrData (std::string const &address) |
| Get string data from a dataset at address. | |
| bool | hasRootAttr (std::string const &name) const |
| Query if the given attribute exists on the root node. | |
| bool | isEntry (std::string const &entryName) const |
| Checks if a full-address entry exists in a Nexus dataset. | |
| 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 ()=delete | |
| NexusDescriptorLazy (NexusDescriptorLazy &&nd)=delete | |
| NexusDescriptorLazy (NexusDescriptorLazy const &nd)=delete | |
| NexusDescriptorLazy (std::string const &filename) | |
| Unique constructor. | |
| NexusDescriptorLazy & | operator= (NexusDescriptorLazy &&nd)=delete |
| NexusDescriptorLazy & | operator= (NexusDescriptorLazy const &nd)=delete |
| ~NexusDescriptorLazy ()=default | |
| Using RAII components, no need to deallocate explicitly. | |
Private Member Functions | |
| std::map< std::string, std::string > | initAllEntries () |
| Sets m_allEntries, called in HDF5 constructor. | |
| void | loadGroups (std::map< std::string, std::string > &allEntries, std::string const &address, unsigned int depth, const unsigned int maxDepth) |
Private Attributes | |
| std::map< std::string, std::string > | m_allEntries |
| All entries metadata. | |
| std::unordered_set< std::string > | m_allMisses |
| the set of non-existent entries that have been checked | |
| std::string const | m_extension |
| Extension. | |
| UniqueID<&H5Fclose > | m_fileID |
| HDF5 File Handle. | |
| std::string const | m_filename |
| Nexus HDF5 file name. | |
| std::pair< std::string, std::string > | m_firstEntryNameType |
| 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. | |
Definition at line 21 of file NexusDescriptorLazy.h.
| Mantid::Nexus::NexusDescriptorLazy::NexusDescriptorLazy | ( | std::string const & | filename | ) |
Unique constructor.
| filename | input HDF5 Nexus file name |
Definition at line 63 of file NexusDescriptorLazy.cpp.
|
delete |
|
delete |
|
delete |
|
default |
Using RAII components, no need to deallocate explicitly.
| bool Mantid::Nexus::NexusDescriptorLazy::classTypeExists | ( | std::string const & | classType | ) | const |
Query if a given type exists somewhere in the file.
Check if a class type exists in the file.
| classType | the NX_class type to check for |
Definition at line 112 of file NexusDescriptorLazy.cpp.
References m_allEntries, and m_readNexusMutex.
Referenced by Mantid::DataHandling::LoadEventNexus::confidence(), and Mantid::MDAlgorithms::LoadMD::confidence().
| bool Mantid::Nexus::NexusDescriptorLazy::classTypeExistsChild | ( | const std::string & | parentPath, |
| const std::string & | classType | ||
| ) | const |
Query if a given type exists as a decendant of the supplied parentPath.
It is expected to be used only to check for direct children.
Definition at line 119 of file NexusDescriptorLazy.cpp.
References isEntry(), m_allEntries, m_readNexusMutex, and name.
Referenced by Mantid::DataHandling::LoadTOFRawNexus::confidence().
|
inlinenoexcept |
Access the file extension.
Defined as the string after and including the last period character
Definition at line 55 of file NexusDescriptorLazy.h.
Referenced by Mantid::DataHandling::LoadEMUHdf::confidence(), Mantid::DataHandling::NXcanSAS::LoadNXcanSAS::confidence(), and Mantid::DataHandling::LoadPLN::confidence().
|
inlinenoexcept |
Returns a constant reference to the current file name.
Definition at line 48 of file NexusDescriptorLazy.h.
|
inlinenoexcept |
Returns the name & type of the first entry in the file.
Definition at line 58 of file NexusDescriptorLazy.h.
Referenced by Mantid::DataHandling::LoadMcStasNexus::confidence(), and Mantid::DataHandling::LoadEmptyInstrument::runLoadIDFFromNexus().
|
inlinenoexcept |
Returns a const reference of the internal map holding all entries in the Nexus HDF5 file.
key: group address (absolute entry name, e.g., /entry/log) value: group class (e.g., NXentry, NXlog)
Definition at line 72 of file NexusDescriptorLazy.h.
Referenced by Mantid::DataHandling::NXcanSAS::LoadNXcanSAS::confidence(), and Mantid::DataHandling::LoadNXSPE::confidence().
| std::string Mantid::Nexus::NexusDescriptorLazy::getStrData | ( | std::string const & | address | ) |
Get string data from a dataset at address.
| address | Full HDF5 address of the dataset |
Definition at line 160 of file NexusDescriptorLazy.cpp.
References isEntry(), m_fileID, and Mantid::Nexus::SCIENTIFIC_DATA_SET().
Referenced by Mantid::DataHandling::LoadMcStas::confidence(), Mantid::DataHandling::NXcanSAS::LoadNXcanSAS::confidence(), and Mantid::DataHandling::LoadNXSPE::confidence().
| bool Mantid::Nexus::NexusDescriptorLazy::hasRootAttr | ( | std::string const & | name | ) | const |
Query if the given attribute exists on the root node.
Definition at line 138 of file NexusDescriptorLazy.cpp.
References m_fileID, m_readNexusMutex, m_rootAttrs, and name.
|
private |
Sets m_allEntries, called in HDF5 constructor.
m_filename must be set
Definition at line 213 of file NexusDescriptorLazy.cpp.
References Mantid::Nexus::H5Util::defaultFileAcc(), ENTRY_DEPTH, INIT_DEPTH, INSTR_DEPTH, Mantid::Nexus::Hdf5ID< D >::isValid(), loadGroups(), m_fileID, m_filename, m_firstEntryNameType, SPECIAL_ADDRESS, and UNKNOWN_CLASS.
| bool Mantid::Nexus::NexusDescriptorLazy::isEntry | ( | std::string const & | entryName | ) | const |
Checks if a full-address entry exists in a Nexus dataset.
| entryName | full address for an entry name /entry/NXlogs |
Definition at line 68 of file NexusDescriptorLazy.cpp.
References m_allEntries, m_allMisses, m_fileID, m_readNexusMutex, and Mantid::Nexus::SCIENTIFIC_DATA_SET().
|
inline |
Checks if a full-address entry exists for a particular groupClass in a Nexus dataset.
| entryName | full address for an entry name /entry/NXlogs |
| groupClass | e.g. NxLog , Nexus entry attribute |
Definition at line 81 of file NexusDescriptorLazy.h.
Referenced by classTypeExistsChild(), Mantid::DataHandling::LoadEMUHdf::confidence(), Mantid::DataHandling::LoadEventNexus::confidence(), Mantid::DataHandling::LoadILLIndirect2::confidence(), Mantid::DataHandling::LoadILLSALSA::confidence(), Mantid::DataHandling::LoadILLSANS::confidence(), Mantid::DataHandling::LoadISISNexus2::confidence(), Mantid::DataHandling::LoadMcStas::confidence(), Mantid::DataHandling::LoadMcStasNexus::confidence(), Mantid::DataHandling::LoadMLZ::confidence(), Mantid::DataHandling::LoadNexusProcessed::confidence(), Mantid::DataHandling::LoadNexusProcessed2::confidence(), Mantid::DataHandling::LoadNXSPE::confidence(), Mantid::DataHandling::LoadPLN::confidence(), Mantid::DataHandling::LoadSINQFocus::confidence(), Mantid::DataHandling::LoadTOFRawNexus::confidence(), Mantid::MDAlgorithms::LoadMD::confidence(), getStrData(), and Mantid::DataHandling::LoadEmptyInstrument::runLoadIDFFromNexus().
|
private |
Definition at line 177 of file NexusDescriptorLazy.cpp.
References Mantid::Nexus::Hdf5ID< D >::get(), Mantid::Nexus::Hdf5ID< D >::isValid(), loadGroups(), m_fileID, and Mantid::Nexus::SCIENTIFIC_DATA_SET().
Referenced by initAllEntries(), and loadGroups().
|
delete |
|
delete |
|
mutableprivate |
All entries metadata.
The map is mutable because additional values can be added lazily.
key: group address value: group class (e.g. NXentry, NXlog)
Definition at line 136 of file NexusDescriptorLazy.h.
Referenced by classTypeExists(), classTypeExistsChild(), and isEntry().
|
mutableprivate |
the set of non-existent entries that have been checked
Definition at line 142 of file NexusDescriptorLazy.h.
Referenced by isEntry().
|
private |
Extension.
Definition at line 120 of file NexusDescriptorLazy.h.
HDF5 File Handle.
Definition at line 122 of file NexusDescriptorLazy.h.
Referenced by getStrData(), hasRootAttr(), initAllEntries(), isEntry(), and loadGroups().
|
private |
Nexus HDF5 file name.
Definition at line 118 of file NexusDescriptorLazy.h.
Referenced by initAllEntries().
|
private |
Definition at line 127 of file NexusDescriptorLazy.h.
Referenced by initAllEntries().
|
mutableprivate |
mutex to protect reading from file after initialization in const methods
Definition at line 139 of file NexusDescriptorLazy.h.
Referenced by classTypeExists(), classTypeExistsChild(), hasRootAttr(), and isEntry().
|
mutableprivate |
Root attributes cache.
This is mutable because it is modified in a const method.
Definition at line 125 of file NexusDescriptorLazy.h.
Referenced by hasRootAttr().