|
Mantid
|
Defines a wrapper around a file whose internal structure can be accessed using the NeXus API. More...
#include <LegacyNexusDescriptor.h>
Public Member Functions | |
| Mantid::LegacyNexus::File & | data () |
| Access the open NeXus File object. | |
| const std::string & | extension () const |
| Access the file extension. | |
| const std::string & | filename () const |
| Access the filename. | |
| const std::pair< std::string, std::string > & | firstEntryNameType () const |
| Returns the name & type of the first entry in the file. | |
| LegacyNexusDescriptor ()=delete | |
| Disable default constructor. | |
| LegacyNexusDescriptor (const LegacyNexusDescriptor &)=delete | |
| Disable copy operator. | |
| LegacyNexusDescriptor (const std::string &filename) | |
| Constructor accepting a filename. | |
| LegacyNexusDescriptor & | operator= (const LegacyNexusDescriptor &)=delete |
| Disable assignment operator. | |
| bool | pathExists (const std::string &path) const |
| Query if a path exists. | |
| ~LegacyNexusDescriptor () | |
| Destructor. | |
Private Member Functions | |
| void | initialize (const std::string &filename) |
| Initialize object with filename. | |
| void | walkFile (Mantid::LegacyNexus::File &file, const std::string &rootPath, const std::string &className, std::map< std::string, std::string > &pmap, int level) |
| Walk the tree and cache the structure. | |
Private Attributes | |
| std::string | m_extension |
| Extension. | |
| std::unique_ptr< Mantid::LegacyNexus::File > | m_file |
| Open NeXus handle. | |
| std::string | m_filename |
| Full filename. | |
| std::pair< std::string, std::string > | m_firstEntryNameType |
| First entry name/type. | |
| std::map< std::string, std::string > | m_pathsToTypes |
| Map of full path strings to types. Can check if path exists quickly. | |
| std::unordered_set< std::string > | m_rootAttrs |
| Root attributes. | |
Defines a wrapper around a file whose internal structure can be accessed using the NeXus API.
On construction the simple details about the layout of the file are cached for faster querying later.
Definition at line 32 of file LegacyNexusDescriptor.h.
| Mantid::Kernel::LegacyNexusDescriptor::LegacyNexusDescriptor | ( | const std::string & | filename | ) |
Constructor accepting a filename.
Constructs the wrapper.
| filename | A string pointing to an existing file |
| std::invalid_argument | if the file is not identified to be hierarchical. This currently involves simply checking for the signature if a HDF file at the start of the file |
Definition at line 29 of file LegacyNexusDescriptor.cpp.
References filename(), and initialize().
|
default |
Destructor.
|
delete |
Disable default constructor.
|
delete |
Disable copy operator.
|
inline |
Access the open NeXus File object.
Definition at line 64 of file LegacyNexusDescriptor.h.
|
inline |
Access the file extension.
Defined as the string after and including the last period character
Definition at line 59 of file LegacyNexusDescriptor.h.
|
inline |
Access the filename.
Definition at line 53 of file LegacyNexusDescriptor.h.
Referenced by initialize(), and LegacyNexusDescriptor().
| const std::pair< std::string, std::string > & Mantid::Kernel::LegacyNexusDescriptor::firstEntryNameType | ( | ) | const |
Returns the name & type of the first entry in the file.
Definition at line 49 of file LegacyNexusDescriptor.cpp.
References m_firstEntryNameType.
|
private |
Initialize object with filename.
Creates the internal cached structure of the file as a tree of nodes.
Definition at line 69 of file LegacyNexusDescriptor.cpp.
References filename(), m_extension, m_file, m_filename, m_pathsToTypes, m_rootAttrs, and walkFile().
Referenced by LegacyNexusDescriptor().
|
delete |
Disable assignment operator.
| bool Mantid::Kernel::LegacyNexusDescriptor::pathExists | ( | const std::string & | path | ) | const |
Query if a path exists.
| path | A string giving a path using UNIX-style path separators (/), e.g. /raw_data_1, /entry/bank1 |
Definition at line 58 of file LegacyNexusDescriptor.cpp.
References m_pathsToTypes.
Referenced by Mantid::DataHandling::LoadILLTOF2::confidence().
|
private |
Walk the tree and cache the structure.
Cache the structure in the given maps.
| file | An open NeXus File object |
| rootPath | The current path that is open in the file |
| className | The class of the current open path |
| pmap | [Out] An output map filled with mappings of path->type |
| level | An integer defining the current level in the file |
Definition at line 89 of file LegacyNexusDescriptor.cpp.
References m_firstEntryNameType, and walkFile().
Referenced by initialize(), and walkFile().
|
private |
|
private |
Open NeXus handle.
Definition at line 90 of file LegacyNexusDescriptor.h.
Referenced by initialize().
|
private |
|
private |
First entry name/type.
Definition at line 83 of file LegacyNexusDescriptor.h.
Referenced by firstEntryNameType(), and walkFile().
|
private |
Map of full path strings to types. Can check if path exists quickly.
Definition at line 87 of file LegacyNexusDescriptor.h.
Referenced by initialize(), and pathExists().
|
private |