|
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::set< 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 95 of file NexusDescriptor.cpp.
References isEntry(), m_allEntries, and m_filename.
| void Mantid::Nexus::NexusDescriptor::addRootAttr | ( | const std::string & | name | ) |
Definition at line 93 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 172 of file NexusDescriptor.cpp.
References m_allEntries.
|
inline |
| type | A string specifying the required type |
Definition at line 97 of file NexusDescriptor.h.
Referenced by Mantid::DataHandling::AlignAndFocusPowderSlim::AlignAndFocusPowderSlim::determineBanksToLoad(), and Mantid::DataHandling::LoadMcStas::exec().
| bool Mantid::Nexus::NexusDescriptor::classTypeExists | ( | const std::string & | classType | ) | const |
Query if a given type exists somewhere in the file.
Definition at line 191 of file NexusDescriptor.cpp.
References m_allEntries.
| std::string Mantid::Nexus::NexusDescriptor::classTypeForName | ( | std::string const & | name | ) | const |
| name | A address within a Nexus file to an entry |
Definition at line 193 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.
|
noexcept |
Returns a copy of the current file name.
Definition at line 89 of file NexusDescriptor.cpp.
References m_filename.
Referenced by Mantid::DataHandling::LoadMuonNexusV2::confidence().
|
inline |
Returns the name & type of the first entry in the file.
Definition at line 59 of file NexusDescriptor.h.
|
inlinenoexcept |
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 74 of file NexusDescriptor.h.
Referenced by Mantid::DataHandling::LoadGeometry::isNexus(), 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 119 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 167 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 153 of file NexusDescriptor.cpp.
Referenced by addEntry(), Mantid::DataHandling::LoadMuonNexusV2::confidence(), Mantid::DataHandling::LoadErrorEventsNexus::exec(), and Mantid::DataHandling::LoadEventAsWorkspace2D::exec().
|
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 157 of file NexusDescriptor.h.
Referenced by addEntry(), allAddressesAtLevel(), classTypeExists(), classTypeForName(), and NexusDescriptor().
|
private |
Extension.
Definition at line 143 of file NexusDescriptor.h.
|
private |
Nexus HDF5 file name.
Definition at line 141 of file NexusDescriptor.h.
Referenced by addEntry(), classTypeForName(), filename(), initAllEntries(), and NexusDescriptor().
|
private |
First entry name/type.
Definition at line 145 of file NexusDescriptor.h.
Referenced by initAllEntries().
|
private |
Root attributes.
Definition at line 147 of file NexusDescriptor.h.
Referenced by addRootAttr(), hasRootAttr(), and initAllEntries().