Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Mantid::NeXus::NXClass Class Reference

The base class for a Nexus class (group). More...

#include <NexusClasses.h>

Inheritance diagram for Mantid::NeXus::NXClass:
Mantid::NeXus::NXObject Mantid::NeXus::NXLog Mantid::NeXus::NXMainClass Mantid::NeXus::NXNote Mantid::NeXus::NXRoot Mantid::NeXus::NXData Mantid::NeXus::NXDetector Mantid::NeXus::NXDiskChopper Mantid::NeXus::NXEntry Mantid::NeXus::NXInstrument Mantid::NeXus::NXBinary

Public Member Functions

void close ()
 Close this class. More...
 
bool containsDataSet (const std::string &query) const
 Returns whether an individual dataset is present. More...
 
bool containsGroup (const std::string &query) const
 Returns whether an individual group (or group) is present. More...
 
std::vector< NXInfo > & datasets () const
 Returns a list of all datasets in this NXClass. More...
 
NXInfo getDataSetInfo (const std::string &name) const
 Returns NXInfo for a dataset. More...
 
double getDouble (const std::string &name) const
 Returns a double. More...
 
float getFloat (const std::string &name) const
 Returns a float. More...
 
int getInt (const std::string &name) const
 Returns a int. More...
 
NXClassInfo getNextEntry ()
 Returns the class information about the next entry (class or dataset) in this class. More...
 
std::string getString (const std::string &name) const
 Returns a string. More...
 
std::vector< NXClassInfo > & groups () const
 Returns a list of all classes (or groups) in this NXClass. More...
 
bool isValid (const std::string &path) const
 Check if a path exists relative to the current class path. More...
 
std::string NX_class () const override
 The NX class identifier. More...
 
 NXClass (const NXClass &parent, const std::string &name)
 Constructor. More...
 
void open ()
 Opens this NXClass using NXopengrouppath. Can be slow (or is slow) More...
 
bool openLocal (const std::string &nxclass="")
 Opens this NXClass using NXopengroup. More...
 
NXChar openNXChar (const std::string &name) const
 Creates and opens a char dataset. More...
 
template<class NX >
NX openNXClass (const std::string &name) const
 Templated method for creating derived NX classes. More...
 
template<class T >
NXDataSetTyped< T > openNXDataSet (const std::string &name) const
 Templated method for creating datasets. More...
 
NXDouble openNXDouble (const std::string &name) const
 Creates and opens a double dataset. More...
 
NXFloat openNXFloat (const std::string &name) const
 Creates and opens a float dataset. More...
 
NXClass openNXGroup (const std::string &name) const
 Creates and opens an arbitrary (non-standard) class (group). More...
 
NXInt openNXInt (const std::string &name) const
 Creates and opens an integer dataset. More...
 
NXSize openNXSize (const std::string &name) const
 Creates and opens a size_t dataset. More...
 
void reset ()
 Creates a new object in the NeXus file at path path. More...
 
- Public Member Functions inherited from Mantid::NeXus::NXObject
std::string name () const
 Returns the name of the object. More...
 
virtual std::string NX_class () const =0
 Return the NX class name for a class (HDF group) or "SDS" for a data set;. More...
 
 NXObject (const NXhandle fileID, const NXClass *parent, const std::string &name)
 NXObject constructor. More...
 
std::string path () const
 Returns the absolute path to the object. More...
 
virtual ~NXObject ()=default
 

Protected Member Functions

void clear ()
 Deletes content of m_groups and m_datasets. More...
 
void readAllInfo ()
 Fills in m_groups and m_datasets. More...
 

Protected Attributes

std::shared_ptr< std::vector< NXInfo > > m_datasets
 Holds info about the datasets in this NXClass. More...
 
std::shared_ptr< std::vector< NXClassInfo > > m_groups
 Holds info about the child NXClasses. More...
 
- Protected Attributes inherited from Mantid::NeXus::NXObject
bool m_open
 Set to true if the object has been open. More...
 
std::string m_path
 Keeps the absolute path to the object. More...
 

Private Member Functions

 NXClass ()
 Pricate constructor. More...
 

Friends

class NXRoot
 

Additional Inherited Members

- Public Attributes inherited from Mantid::NeXus::NXObject
NXAttributes attributes
 Attributes. More...
 
NXhandle m_fileID
 Nexus file id. More...
 

Detailed Description

The base class for a Nexus class (group).

A Nexus class can contain datasets and other Nexus classes. The NeXus file format (www.nexusformat.org) specifies the content of the Nexus classes. Derived classes have specialized methods for creating classes and datasets specific for the particular Nexus class. NXClass is a conctrete C++ class so arbitrary, non-standard Nexus classes (groups) can be created and loaded from NeXus files.

Definition at line 487 of file NexusClasses.h.

Constructor & Destructor Documentation

◆ NXClass() [1/2]

Mantid::NeXus::NXClass::NXClass ( const NXClass parent,
const std::string &  name 
)

Constructor.

Parameters
parent:: The parent Nexus class. In terms of HDF it is the group containing the NXClass.
name:: The name of the NXClass relative to its parent

Definition at line 149 of file NexusClasses.cpp.

References clear().

◆ NXClass() [2/2]

Mantid::NeXus::NXClass::NXClass ( )
inlineprivate

Pricate constructor.

Definition at line 622 of file NexusClasses.h.

Member Function Documentation

◆ clear()

void Mantid::NeXus::NXClass::clear ( )
protected

Deletes content of m_groups and m_datasets.

Definition at line 236 of file NexusClasses.cpp.

References m_datasets, and m_groups.

Referenced by NXClass(), and readAllInfo().

◆ close()

void Mantid::NeXus::NXClass::close ( )

◆ containsDataSet()

bool Mantid::NeXus::NXClass::containsDataSet ( const std::string &  query) const

◆ containsGroup()

bool Mantid::NeXus::NXClass::containsGroup ( const std::string &  query) const

◆ datasets()

std::vector< NXInfo > & Mantid::NeXus::NXClass::datasets ( ) const
inline

Returns a list of all datasets in this NXClass.

Definition at line 593 of file NexusClasses.h.

Referenced by getDataSetInfo().

◆ getDataSetInfo()

NXInfo Mantid::NeXus::NXClass::getDataSetInfo ( const std::string &  name) const

◆ getDouble()

double Mantid::NeXus::NXClass::getDouble ( const std::string &  name) const

Returns a double.

Parameters
name:: The name of the NXDouble dataset
Returns
The double

Definition at line 252 of file NexusClasses.cpp.

References Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::NeXus::NXObject::name(), and openNXDouble().

Referenced by Mantid::NeXus::NXLog::createSingleValueProperty().

◆ getFloat()

float Mantid::NeXus::NXClass::getFloat ( const std::string &  name) const

Returns a float.

Parameters
name:: The name of the NXFloat dataset
Returns
The float

Definition at line 258 of file NexusClasses.cpp.

References Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::NeXus::NXObject::name(), and openNXFloat().

Referenced by Mantid::DataHandling::LoadMuonNexus2::doExec(), Mantid::DataHandling::LoadILLSANS::exec(), Mantid::DataHandling::LoadMuonNexus1::exec(), Mantid::DataHandling::LoadQKK::exec(), Mantid::DataHandling::LoadHelper::getDoubleFromNexusPath(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadSINQFocus::loadExperimentDetails(), Mantid::DataHandling::LoadMLZ::loadExperimentDetails(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadFirstGoodDataFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadLastGoodDataFromNexus(), Mantid::DataHandling::LoadILLSANS::loadMetaData(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadMuonNexus1::loadRunDetails(), Mantid::DataHandling::LoadLLB::loadRunDetails(), Mantid::DataHandling::LoadSINQFocus::loadRunDetails(), Mantid::DataHandling::LoadMLZ::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadILLTOF2::loadTimeDetails(), Mantid::DataHandling::LoadLLB::loadTimeDetails(), Mantid::DataHandling::LoadMLZ::loadTimeDetails(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadTimeZeroFromNexusFile(), and Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadTimeZeroListFromNexusFile().

◆ getInt()

int Mantid::NeXus::NXClass::getInt ( const std::string &  name) const

◆ getNextEntry()

NXClassInfo Mantid::NeXus::NXClass::getNextEntry ( )

Returns the class information about the next entry (class or dataset) in this class.

Definition at line 151 of file NexusClasses.cpp.

References Mantid::NeXus::NXClassInfo::datatype, Mantid::NeXus::NXObject::m_fileID, Mantid::NeXus::NXClassInfo::nxclass, Mantid::NeXus::NXClassInfo::nxname, and Mantid::NeXus::NXClassInfo::stat.

Referenced by readAllInfo().

◆ getString()

std::string Mantid::NeXus::NXClass::getString ( const std::string &  name) const

Returns a string.

Parameters
name:: The name of the NXChar dataset
Returns
The string

Definition at line 241 of file NexusClasses.cpp.

References Mantid::NeXus::NXDataSet::dim0(), Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::NeXus::NXObject::name(), and openNXChar().

Referenced by Mantid::NeXus::NXLog::createSingleValueProperty(), Mantid::DataHandling::LoadMuonNexus2::doExec(), Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadMuonNexus1::exec(), Mantid::DataHandling::LoadQKK::exec(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodLabels(), Mantid::DataHandling::LoadHelper::getStringFromNexusPath(), Mantid::DataHandling::handleISISNexusFile(), Mantid::DataHandling::handleMuonNexusFile(), Mantid::DataHandling::handleProcessedNexusFile(), Mantid::DataHandling::handleTofRawNexusFile(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLPolarizedDiffraction::initStaticWorkspace(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), Mantid::DataHandling::LoadMuonNexus2::loadLogs(), Mantid::DataHandling::LoadILLSANS::loadMetaData(), Mantid::DataHandling::LoadNexusProcessed::loadNonEventEntry(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadMuonNexus1::loadRunDetails(), Mantid::DataHandling::LoadMuonNexus2::loadRunDetails(), Mantid::DataHandling::LoadLLB::loadRunDetails(), Mantid::DataHandling::LoadSINQFocus::loadRunDetails(), Mantid::DataHandling::LoadMLZ::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadNexusProcessed::loadWorkspaceName(), and Mantid::DataHandling::LoadMuonNexus1::runLoadLog().

◆ groups()

std::vector< NXClassInfo > & Mantid::NeXus::NXClass::groups ( ) const
inline

◆ isValid()

bool Mantid::NeXus::NXClass::isValid ( const std::string &  path) const

◆ NX_class()

std::string Mantid::NeXus::NXClass::NX_class ( ) const
inlineoverridevirtual

◆ open()

void Mantid::NeXus::NXClass::open ( )

Opens this NXClass using NXopengrouppath. Can be slow (or is slow)

Definition at line 189 of file NexusClasses.cpp.

References Mantid::NeXus::NXObject::m_fileID, Mantid::NeXus::NXObject::m_open, Mantid::NeXus::NXObject::m_path, Mantid::NeXus::NXObject::name(), NX_class(), and readAllInfo().

◆ openLocal()

bool Mantid::NeXus::NXClass::openLocal ( const std::string &  nxclass = "")

Opens this NXClass using NXopengroup.

It is fast, but the parent of this class must be open at the time of calling.

It is fast, but the parent of this class must be open at the time of calling. openNXClass uses open() (the slow one). To open calss using openLocal() do: NXTheClass class(parent,name); class.openLocal(); // work with class class.close();

openNXClass uses open() (the slow one). To open calss using openLocal() do: NXTheClass class(parent,name); class.openLocal(); // work with class class.close();

Parameters
nxclass:: The NX class name. If empty NX_class() will be used
Returns
true if OK

Definition at line 210 of file NexusClasses.cpp.

References Mantid::NeXus::NXObject::m_fileID, Mantid::NeXus::NXObject::m_open, Mantid::NeXus::NXObject::name(), NX_class(), and readAllInfo().

Referenced by Mantid::DataHandling::LoadNexusProcessed::doAccelleratedMultiPeriodLoading().

◆ openNXChar()

NXChar Mantid::NeXus::NXClass::openNXChar ( const std::string &  name) const
inline

◆ openNXClass()

template<class NX >
NX Mantid::NeXus::NXClass::openNXClass ( const std::string &  name) const
inline

Templated method for creating derived NX classes.

It also opens the created class.

Parameters
name:: The name of the class
Template Parameters
NXConcrete Nexus class
Returns
The new object

Definition at line 519 of file NexusClasses.h.

Referenced by Mantid::DataHandling::LoadMuonNexus2::loadLogs().

◆ openNXDataSet()

template<class T >
NXDataSetTyped< T > Mantid::NeXus::NXClass::openNXDataSet ( const std::string &  name) const
inline

◆ openNXDouble()

NXDouble Mantid::NeXus::NXClass::openNXDouble ( const std::string &  name) const
inline

◆ openNXFloat()

NXFloat Mantid::NeXus::NXClass::openNXFloat ( const std::string &  name) const
inline

Creates and opens a float dataset.

Parameters
name:: The name of the dataset
Returns
The float

Definition at line 551 of file NexusClasses.h.

Referenced by Mantid::DataHandling::LoadMuonNexus2::doExec(), getFloat(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodTotalCounts(), Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusPath(), Mantid::DataHandling::LoadILLSANS::getVariableTimeBinning(), Mantid::DataHandling::LoadILLPolarizedDiffraction::initStaticWorkspace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadMuonNexus1::loadDeadTimes(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDeadTimesFromNexus(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadISISNexusHelper::loadTimeData(), Mantid::DataHandling::LoadILLTOF2::loadTimeDetails(), Mantid::DataHandling::LoadMLZ::loadTimeDetails(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadTwoThetaDetectors(), Mantid::DataHandling::LoadILLIndirect2::moveSingleDetectors(), Mantid::DataHandling::LoadILLPolarizedDiffraction::moveTwoTheta(), Mantid::DataHandling::LoadILLPolarizedDiffraction::prepareAxes(), and Mantid::DataHandling::LoadILLReflectometry::sampleAngle().

◆ openNXGroup()

NXClass Mantid::NeXus::NXClass::openNXGroup ( const std::string &  name) const
inline

Creates and opens an arbitrary (non-standard) class (group).

Parameters
name:: The name of the class.
Returns
The opened NXClass

Definition at line 529 of file NexusClasses.h.

Referenced by Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadISISNexusHelper::findDetectorIDsAndSpectrumNumber(), Mantid::DataHandling::LoadISISNexusHelper::findNumberOfSpectra(), Mantid::DataHandling::LoadILLIndirect2::getDataPath(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getIntVector(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getNumberOfPeriods(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodLabels(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodTotalCounts(), Mantid::DataHandling::LoadILLTOF2::initWorkSpace(), Mantid::DataHandling::LoadISISNexus2::isMultipleTimeRegimeFile(), Mantid::DataHandling::LoadILLTOF2::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDeadTimesFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDetectorGroupingFromNexus(), Mantid::DataHandling::LoadILLIndirect2::loadDiffractionData(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadFirstGoodDataFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadGoodFramesDataFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadLastGoodDataFromNexus(), Mantid::DataHandling::LoadNexusProcessed::loadNonEventEntry(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadMuonNexus2::loadRunDetails(), Mantid::DataHandling::LoadMLZ::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadSampleInformationFromNexus(), Mantid::DataHandling::LoadISISNexusHelper::loadTimeData(), Mantid::DataHandling::LoadILLTOF2::loadTimeDetails(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadTimeZeroFromNexusFile(), and Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadTimeZeroListFromNexusFile().

◆ openNXInt()

NXInt Mantid::NeXus::NXClass::openNXInt ( const std::string &  name) const
inline

Creates and opens an integer dataset.

Parameters
name:: The name of the dataset
Returns
The int

Definition at line 546 of file NexusClasses.h.

Referenced by Mantid::DataHandling::LoadMuonNexus2::doExec(), Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadMuonNexus1::exec(), Mantid::DataHandling::LoadNexusProcessed2::extractMappingInfoNew(), Mantid::DataHandling::LoadISISNexusHelper::findDetectorIDsAndSpectrumNumber(), Mantid::DataHandling::LoadISISNexusHelper::findNumberOfSpectra(), Mantid::DataHandling::LoadISISNexus2::findSpectraDetRangeInFile(), getInt(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getIntVector(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLPolarizedDiffraction::initStaticWorkspace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadMuonNexus1::loadDetectorGrouping(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDetectorGroupingFromNexus(), Mantid::DataHandling::LoadMuonNexus2::loadDetectorMapping(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadFirstGoodDataFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadGoodFramesDataFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadLastGoodDataFromNexus(), Mantid::DataHandling::LoadNexusProcessed::loadLeanElasticPeaksEntry(), Mantid::DataHandling::LoadNexusProcessed::loadPeaksEntry(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadMLZ::maskDetectors(), and Mantid::DataHandling::LoadNexusProcessed::readBinMasking().

◆ openNXSize()

NXSize Mantid::NeXus::NXClass::openNXSize ( const std::string &  name) const
inline

Creates and opens a size_t dataset.

Parameters
name:: The name of the dataset
Returns
The size_t

Definition at line 566 of file NexusClasses.h.

Referenced by Mantid::DataHandling::LoadNexusProcessed::readBinMasking().

◆ readAllInfo()

void Mantid::NeXus::NXClass::readAllInfo ( )
protected

◆ reset()

void Mantid::NeXus::NXClass::reset ( )

Creates a new object in the NeXus file at path path.

Resets the current position for getNextEntry() to the beginning

Definition at line 234 of file NexusClasses.cpp.

References Mantid::NeXus::NXObject::m_fileID.

Referenced by readAllInfo().

Friends And Related Function Documentation

◆ NXRoot

friend class NXRoot
friend

Definition at line 488 of file NexusClasses.h.

Member Data Documentation

◆ m_datasets

std::shared_ptr<std::vector<NXInfo> > Mantid::NeXus::NXClass::m_datasets
protected

Holds info about the datasets in this NXClass.

Definition at line 617 of file NexusClasses.h.

Referenced by clear(), and readAllInfo().

◆ m_groups

std::shared_ptr<std::vector<NXClassInfo> > Mantid::NeXus::NXClass::m_groups
protected

Holds info about the child NXClasses.

Definition at line 616 of file NexusClasses.h.

Referenced by clear(), containsGroup(), and readAllInfo().


The documentation for this class was generated from the following files: