|
Mantid
|
#include <NexusDescriptor.h>
Public Member Functions | |
| void | addEntry (const std::string &entryName, const std::string &groupClass) |
| Add an entry to the mapping for the file. | |
| void | addRootAttr (const std::string &name) |
| std::map< std::string, std::string > | allAddressesAtLevel (const std::string &level) const |
| std::vector< std::string > | allAddressesOfType (const std::string &type) const |
| bool | classTypeExists (const std::string &classType) const |
| Query if a given type exists somewhere in the file. | |
| std::string | classTypeForName (std::string const &name) const |
| const std::string & | extension () const |
| Access the file extension. | |
| const std::string & | filename () const noexcept |
| Returns a copy of the current file name. | |
| const std::pair< std::string, std::string > & | firstEntryNameType () const |
| Returns the name & type of the first entry in the file. | |
| const std::map< std::string, std::set< std::string > > & | getAllEntries () const noexcept |
| Returns a const reference of the internal map holding all entries in the Nexus HDF5 file. | |
| bool | hasRootAttr (const std::string &name) const |
| Query if the given attribute exists on the root node. | |
| bool | isEntry (const std::string &entryName) const noexcept |
| Checks if a full-address entry exists in a Nexus dataset. | |
| bool | isEntry (const std::string &entryName, const std::string &groupClass) const noexcept |
| Checks if a full-address entry exists for a particular groupClass in a Nexus dataset. | |
| NexusDescriptor ()=delete | |
| NexusDescriptor (NexusDescriptor const &nd)=default | |
| NexusDescriptor (std::string const &filename) | |
| Unique constructor. | |
| NexusDescriptor (std::string const &filename, NXaccess access) | |
| NexusDescriptor & | operator= (NexusDescriptor const &nd)=default |
| ~NexusDescriptor ()=default | |
| Using RAII components, no need to deallocate explicitly. | |
Private Member Functions | |
| std::map< std::string, std::set< std::string > > | initAllEntries () |
| Sets m_allEntries, called in HDF5 constructor. | |
Private Attributes | |
| std::map< std::string, std::set< std::string > > | m_allEntries |
| All entries metadata. | |
| std::string | m_extension |
| Extension. | |
| std::string | m_filename |
| Nexus HDF5 file name. | |
| std::pair< std::string, std::string > | m_firstEntryNameType |
| First entry name/type. | |
| std::unordered_set< std::string > | m_rootAttrs |
| Root attributes. | |
Definition at line 23 of file NexusDescriptor.h.
| Mantid::Nexus::NexusDescriptor::NexusDescriptor | ( | std::string const & | filename | ) |
Unique constructor.
| filename | input HDF5 Nexus file name |
Definition at line 73 of file NexusDescriptor.cpp.
| Mantid::Nexus::NexusDescriptor::NexusDescriptor | ( | std::string const & | filename, |
| NXaccess | access | ||
| ) |
Definition at line 77 of file NexusDescriptor.cpp.
References CREATE5, initAllEntries(), m_allEntries, and m_filename.
|
delete |
|
default |
|
default |
Using RAII components, no need to deallocate explicitly.
| void Mantid::Nexus::NexusDescriptor::addEntry | ( | const std::string & | entryName, |
| const std::string & | groupClass | ||
| ) |
Add an entry to the mapping for the file.
Since there is no handle to the file after creation, it is up to the caller to only add entries that exist. This should not be used for files that are read-only.
| entryName | full address to the node in the file |
| groupClass | NXclass (for group) or SDS (for dataset) |
Definition at line 99 of file NexusDescriptor.cpp.
References isEntry(), m_allEntries, and m_filename.
| void Mantid::Nexus::NexusDescriptor::addRootAttr | ( | const std::string & | name | ) |
Definition at line 97 of file NexusDescriptor.cpp.
References m_rootAttrs, and name.
| std::map< std::string, std::string > Mantid::Nexus::NexusDescriptor::allAddressesAtLevel | ( | const std::string & | level | ) | const |
| level | A string specifying the parent address |
Definition at line 185 of file NexusDescriptor.cpp.
References m_allEntries.
| std::vector< std::string > Mantid::Nexus::NexusDescriptor::allAddressesOfType | ( | const std::string & | type | ) | const |
| type | A string specifying the required type |
Definition at line 176 of file NexusDescriptor.cpp.
References m_allEntries.
| bool Mantid::Nexus::NexusDescriptor::classTypeExists | ( | const std::string & | classType | ) | const |
Query if a given type exists somewhere in the file.
Definition at line 204 of file NexusDescriptor.cpp.
References m_allEntries.
Referenced by Mantid::DataHandling::LoadTOFRawNexus::confidence().
| std::string Mantid::Nexus::NexusDescriptor::classTypeForName | ( | std::string const & | name | ) | const |
| name | A address within a Nexus file to an entry |
Definition at line 206 of file NexusDescriptor.cpp.
References m_allEntries, and m_filename.
|
inline |
Access the file extension.
Defined as the string after and including the last period character
Definition at line 56 of file NexusDescriptor.h.
Referenced by Mantid::DataHandling::LoadEMUHdf::confidence(), Mantid::DataHandling::NXcanSAS::LoadNXcanSAS::confidence(), and Mantid::DataHandling::LoadPLN::confidence().
|
noexcept |
Returns a copy of the current file name.
Definition at line 89 of file NexusDescriptor.cpp.
References m_filename.
Referenced by Mantid::DataHandling::LoadMcStas::confidence(), Mantid::DataHandling::LoadMuonNexusV2::confidence(), Mantid::DataHandling::NXcanSAS::LoadNXcanSAS::confidence(), and Mantid::DataHandling::LoadNXSPE::confidence().
|
inline |
Returns the name & type of the first entry in the file.
Definition at line 59 of file NexusDescriptor.h.
|
noexcept |
Returns a const reference of the internal map holding all entries in the Nexus HDF5 file.
key: group_class (e.g. NXentry, NXlog)
value: set with absolute entry names for the group_class key
(e.g. /entry/log)
Definition at line 93 of file NexusDescriptor.cpp.
References m_allEntries.
Referenced by Mantid::DataHandling::LoadEventNexus::confidence(), Mantid::DataHandling::LoadMcStasNexus::confidence(), Mantid::MDAlgorithms::LoadMD::confidence(), Mantid::DataHandling::AlignAndFocusPowderSlim::AlignAndFocusPowderSlim::exec(), Mantid::DataHandling::LoadEventAsWorkspace2D::exec(), Mantid::DataHandling::LoadGeometry::isNexus(), Mantid::DataObjects::MDBoxFlatTree::loadExperimentInfos(), Mantid::API::LogManager::loadNexus(), Mantid::API::Run::loadNexus(), and Mantid::DataHandling::LoadEventNexus::runLoadInstrument().
| bool Mantid::Nexus::NexusDescriptor::hasRootAttr | ( | const std::string & | name | ) | const |
Query if the given attribute exists on the root node.
Definition at line 91 of file NexusDescriptor.cpp.
References m_rootAttrs, and name.
|
private |
Sets m_allEntries, called in HDF5 constructor.
m_filename must be set
Definition at line 123 of file NexusDescriptor.cpp.
References Mantid::Nexus::H5Util::defaultFileAcc(), m_filename, m_firstEntryNameType, and m_rootAttrs.
Referenced by NexusDescriptor().
|
noexcept |
Checks if a full-address entry exists in a Nexus dataset.
| entryName | full address for an entry name /entry/NXlogs |
Definition at line 171 of file NexusDescriptor.cpp.
|
noexcept |
Checks if a full-address entry exists for a particular groupClass in a Nexus dataset.
| groupClass | e.g. NxLog , Nexus entry attribute |
| entryName | full address for an entry name /entry/NXlogs |
Definition at line 157 of file NexusDescriptor.cpp.
Referenced by addEntry(), 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::LoadMLZ::confidence(), Mantid::DataHandling::LoadMuonNexusV2::confidence(), Mantid::DataHandling::LoadNexusProcessed::confidence(), Mantid::DataHandling::LoadNexusProcessed2::confidence(), Mantid::DataHandling::LoadPLN::confidence(), Mantid::DataHandling::LoadSINQFocus::confidence(), Mantid::DataHandling::LoadTOFRawNexus::confidence(), Mantid::MDAlgorithms::LoadMD::confidence(), Mantid::DataHandling::LoadErrorEventsNexus::exec(), Mantid::DataHandling::LoadEventAsWorkspace2D::exec(), Mantid::DataHandling::LoadEventNexus::loadEntryMetadata(), Mantid::Kernel::PropertyNexus::loadProperty(), and Mantid::DataHandling::numEvents().
|
default |
|
private |
All entries metadata.
key: group_class (e.g. NXentry, NXlog)
value: set with absolute entry names for the group_class key
(e.g. /entry/log)
Definition at line 150 of file NexusDescriptor.h.
Referenced by addEntry(), allAddressesAtLevel(), allAddressesOfType(), classTypeExists(), classTypeForName(), getAllEntries(), and NexusDescriptor().
|
private |
Extension.
Definition at line 136 of file NexusDescriptor.h.
|
private |
Nexus HDF5 file name.
Definition at line 134 of file NexusDescriptor.h.
Referenced by addEntry(), classTypeForName(), filename(), initAllEntries(), and NexusDescriptor().
|
private |
First entry name/type.
Definition at line 138 of file NexusDescriptor.h.
Referenced by initAllEntries().
|
private |
Root attributes.
Definition at line 140 of file NexusDescriptor.h.
Referenced by addRootAttr(), hasRootAttr(), and initAllEntries().