Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::NeXus::NXDataSetTyped< T > Class Template Reference

Templated class implementation of NXDataSet. More...

#include <NexusClasses.h>

Inheritance diagram for Mantid::NeXus::NXDataSetTyped< T >:
Mantid::NeXus::NXDataSet Mantid::NeXus::NXObject

Public Member Functions

void load (const int blocksize=1, int i=-1, int j=-1, int k=-1, int l=-1) override
 Implementation of the virtual NXDataSet::load(...) method. More...
 
 NXDataSetTyped (const NXClass &parent, const std::string &name)
 Constructor. More...
 
T * operator() ()
 
const T * operator() () const
 Returns a pointer to the internal data buffer. More...
 
T & operator() (int i, int j)
 
const T & operator() (int i, int j) const
 Returns a value assuming the data is a two-dimensional array. More...
 
T & operator() (int i, int j, int k)
 
const T & operator() (int i, int j, int k) const
 Returns a value assuming the data is a tree-dimensional array. More...
 
T & operator[] (int i)
 
const T & operator[] (int i) const
 Returns the i-th value in the internal buffer. More...
 
int size () const
 Returns the size of the data buffer. More...
 
container_T< T > & vecBuffer ()
 Returns a the internal buffer. More...
 
- Public Member Functions inherited from Mantid::NeXus::NXDataSet
int dim0 () const
 Returns the number of elements along the first dimension. More...
 
int dim1 () const
 Returns the number of elements along the second dimension. More...
 
int dim2 () const
 Returns the number of elements along the third dimension. More...
 
int dim3 () const
 Returns the number of elements along the fourth dimension. More...
 
int dims (int i) const
 Returns the number of elements along i-th dimension. More...
 
virtual void load (const int blocksize=1, int i=-1, int j=-1, int k=-1, int l=-1)
 Load the data from the file. More...
 
std::string name () const
 Returns the name of the data set. More...
 
std::string NX_class () const override
 NX class name. Returns "SDS". More...
 
 NXDataSet (const NXClass &parent, const std::string &name)
 Constructor. More...
 
void open ()
 Opens the data set. More...
 
void openLocal ()
 Opens datasets faster but the parent group must be already open. More...
 
int rank () const
 Returns the rank (number of dimensions) of the data. The maximum is 4. More...
 
int type () const
 Returns the Nexus type of the data. The types are defied in napi.h. 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
 

Private Member Functions

void alloc (int n)
 Allocates memory for the data buffer. More...
 
void rangeError () const
 A shortcut to "throw std::range_error("Nexus dataset range error");". More...
 

Private Attributes

container_T< T > m_data
 The data buffer. More...
 
int m_n
 The buffer size. More...
 
int m_size [4]
 The sizes of the loaded data. More...
 

Additional Inherited Members

- Public Attributes inherited from Mantid::NeXus::NXObject
NXAttributes attributes
 Attributes. More...
 
NXhandle m_fileID
 Nexus file id. More...
 
- Protected Member Functions inherited from Mantid::NeXus::NXDataSet
void getData (void *data)
 Wrapper to the NXgetdata. More...
 
void getSlab (void *data, int start[], int size[])
 Wrapper to the NXgetslab. 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...
 

Detailed Description

template<class T>
class Mantid::NeXus::NXDataSetTyped< T >

Templated class implementation of NXDataSet.

After loading the data it can be accessed via operators () and [].

Definition at line 203 of file NexusClasses.h.

Constructor & Destructor Documentation

◆ NXDataSetTyped()

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

Constructor.

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

Definition at line 211 of file NexusClasses.h.

Member Function Documentation

◆ alloc()

template<class T >
void Mantid::NeXus::NXDataSetTyped< T >::alloc ( int  n)
inlineprivate

Allocates memory for the data buffer.

Parameters
n:: The number of elements to allocate.

Definition at line 439 of file NexusClasses.h.

References Mantid::NeXus::NXDataSetTyped< T >::m_data, Mantid::NeXus::NXDataSetTyped< T >::m_n, n, and Mantid::NeXus::NXObject::path().

Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().

◆ load()

template<class T >
void Mantid::NeXus::NXDataSetTyped< T >::load ( const int  blocksize = 1,
int  i = -1,
int  j = -1,
int  k = -1,
int  l = -1 
)
inlineoverridevirtual

Implementation of the virtual NXDataSet::load(...) method.

Internally the data are stored as a 1d array. If the data are loaded in chunks the newly read in data replace the old ones. The actual rank of the loaded data is equal or less than the rank of the dataset (returned by rank() method).

Parameters
blocksize:: The size of the block of data that should be read. Note that this is only used for rank 2 and 3 datasets currently
i:: Calling load with non-negative i reads in a chunk of dimension rank()-1 and i is the index of the chunk. The rank of the data must be >= 1
j:: Non-negative value makes it read a chunk of dimension rank()-2. i and j are its indeces. The rank of the data must be >= 2
k:: Non-negative value makes it read a chunk of dimension rank()-3. i,j and k are its indeces. The rank of the data must be >= 3
l:: Non-negative value makes it read a chunk of dimension rank()-4. i,j,k and l are its indeces. The rank of the data must be 4

Reimplemented from Mantid::NeXus::NXDataSet.

Definition at line 289 of file NexusClasses.h.

References Mantid::NeXus::NXDataSetTyped< T >::alloc(), Mantid::NeXus::NXDataSet::dim0(), Mantid::NeXus::NXDataSet::dim1(), Mantid::NeXus::NXDataSet::dim2(), Mantid::NeXus::NXDataSet::dim3(), Mantid::NeXus::NXDataSet::getData(), Mantid::NeXus::NXDataSet::getSlab(), Mantid::Geometry::m, Mantid::NeXus::NXDataSetTyped< T >::m_data, Mantid::NeXus::NXDataSetTyped< T >::m_size, n, Mantid::NeXus::NXDataSetTyped< T >::rangeError(), and Mantid::NeXus::NXDataSet::rank().

Referenced by Mantid::NeXus::NXNote::author(), Mantid::NeXus::NXLog::createTimeSeries(), Mantid::NeXus::NXNote::description(), Mantid::DataHandling::LoadNexusProcessed::doAccelleratedMultiPeriodLoading(), Mantid::DataHandling::LoadMuonNexus2::doExec(), Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadQKK::exec(), Mantid::DataHandling::LoadNexusProcessed2::extractMappingInfoNew(), Mantid::DataHandling::LoadISISNexusHelper::findDetectorIDsAndSpectrumNumber(), Mantid::DataHandling::LoadISISNexusHelper::findNumberOfSpectra(), Mantid::NeXus::NXClass::getDouble(), Mantid::NeXus::NXClass::getFloat(), Mantid::NeXus::NXClass::getInt(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getIntVector(), Mantid::DataHandling::LoadILLTOF2::getMonitorInfo(), Mantid::DataHandling::LoadILLSANS::getOmegaBinning(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodTotalCounts(), Mantid::NeXus::NXClass::getString(), Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusPath(), Mantid::DataHandling::LoadILLSANS::getVariableTimeBinning(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLPolarizedDiffraction::initStaticWorkspace(), Mantid::DataHandling::LoadILLSANS::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadNexusProcessed::loadBlock(), Mantid::DataHandling::LoadISISNexus2::loadBlock(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLSANS::loadDataFromD16ScanMonitors(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadLLB::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadSINQFocus::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLIndirect2::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadMLZ::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLTOF2::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadMuonNexus1::loadDeadTimes(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDeadTimesFromNexus(), Mantid::DataHandling::LoadMuonNexus1::loadDetectorGrouping(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDetectorGroupingFromNexus(), Mantid::DataHandling::LoadILLIndirect2::loadDiffractionData(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadGoodFramesDataFromNexus(), Mantid::DataHandling::LoadNexusProcessed::loadLeanElasticPeaksEntry(), Mantid::DataHandling::LoadNexusProcessed::loadNonSpectraAxis(), Mantid::DataHandling::LoadNexusProcessed::loadNumericColumn(), Mantid::DataHandling::LoadBBY::loadNXDataSet(), Mantid::DataHandling::loadNXDataSet(), Mantid::DataHandling::LoadBBY::loadNXString(), Mantid::DataHandling::loadNXString(), Mantid::DataHandling::LoadNexusProcessed::loadPeaksEntry(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadILLReflectometry::loadSingleMonitor(), Mantid::DataHandling::LoadNexusProcessed::loadTableEntry(), Mantid::DataHandling::LoadILLTOF2::loadTimeDetails(), Mantid::DataHandling::LoadMLZ::loadTimeDetails(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadTwoThetaDetectors(), Mantid::DataHandling::LoadNexusProcessed::loadV3DColumn(), Mantid::DataHandling::LoadNexusProcessed::loadVectorColumn(), Mantid::DataHandling::LoadMLZ::maskDetectors(), Mantid::DataHandling::LoadILLIndirect2::moveSingleDetectors(), Mantid::DataHandling::LoadILLPolarizedDiffraction::moveTwoTheta(), Mantid::DataHandling::LoadILLPolarizedDiffraction::prepareAxes(), Mantid::DataHandling::LoadNexusProcessed::readBinMasking(), and Mantid::DataHandling::LoadILLReflectometry::sampleAngle().

◆ operator()() [1/6]

template<class T >
T * Mantid::NeXus::NXDataSetTyped< T >::operator() ( )
inline

◆ operator()() [2/6]

template<class T >
const T * Mantid::NeXus::NXDataSetTyped< T >::operator() ( ) const
inline

Returns a pointer to the internal data buffer.

Exceptions
runtime_errorexception if the data have not been loaded / initialized.
Returns
a pointer to the array of items

Definition at line 217 of file NexusClasses.h.

References Mantid::NeXus::NXDataSetTyped< T >::m_data, and Mantid::NeXus::NXObject::path().

◆ operator()() [3/6]

template<class T >
T & Mantid::NeXus::NXDataSetTyped< T >::operator() ( int  i,
int  j 
)
inline

Definition at line 252 of file NexusClasses.h.

◆ operator()() [4/6]

template<class T >
const T & Mantid::NeXus::NXDataSetTyped< T >::operator() ( int  i,
int  j 
) const
inline

Returns a value assuming the data is a two-dimensional array.

Parameters
i:: The index along dim0()
j:: The index along dim1()
Exceptions
runtime_errorif the data have not been loaded / initialized.
range_errorif the indeces point outside the buffer.
Returns
A reference to the value

Definition at line 251 of file NexusClasses.h.

References Mantid::NeXus::NXDataSet::dim1(), and Mantid::NeXus::NXDataSetTyped< T >::operator[]().

◆ operator()() [5/6]

template<class T >
T & Mantid::NeXus::NXDataSetTyped< T >::operator() ( int  i,
int  j,
int  k 
)
inline

Definition at line 262 of file NexusClasses.h.

◆ operator()() [6/6]

template<class T >
const T & Mantid::NeXus::NXDataSetTyped< T >::operator() ( int  i,
int  j,
int  k 
) const
inline

Returns a value assuming the data is a tree-dimensional array.

Parameters
i:: The index along dim0()
j:: The index along dim1()
k:: The index along dim2()
Exceptions
runtime_errorif the data have not been loaded / initialized.
range_errorif the indeces point outside the buffer.
Returns
A reference to the value

Definition at line 261 of file NexusClasses.h.

References Mantid::NeXus::NXDataSet::dim1(), Mantid::NeXus::NXDataSet::dim2(), and Mantid::NeXus::NXDataSetTyped< T >::operator[]().

◆ operator[]() [1/2]

template<class T >
T & Mantid::NeXus::NXDataSetTyped< T >::operator[] ( int  i)
inline

Definition at line 243 of file NexusClasses.h.

◆ operator[]() [2/2]

template<class T >
const T & Mantid::NeXus::NXDataSetTyped< T >::operator[] ( int  i) const
inline

Returns the i-th value in the internal buffer.

Parameters
i:: The linear index of the data element
Exceptions
runtime_errorif the data have not been loaded / initialized.
range_errorif the index is greater than the buffer size.
Returns
A reference to the value

Definition at line 235 of file NexusClasses.h.

References Mantid::NeXus::NXDataSetTyped< T >::m_data, Mantid::NeXus::NXDataSetTyped< T >::m_n, Mantid::NeXus::NXObject::path(), and Mantid::NeXus::NXDataSetTyped< T >::rangeError().

Referenced by Mantid::NeXus::NXDataSetTyped< T >::operator()().

◆ rangeError()

template<class T >
void Mantid::NeXus::NXDataSetTyped< T >::rangeError ( ) const
inlineprivate

A shortcut to "throw std::range_error("Nexus dataset range error");".

Definition at line 455 of file NexusClasses.h.

Referenced by Mantid::NeXus::NXDataSetTyped< T >::load(), and Mantid::NeXus::NXDataSetTyped< T >::operator[]().

◆ size()

template<class T >
int Mantid::NeXus::NXDataSetTyped< T >::size ( ) const
inline

◆ vecBuffer()

template<class T >
container_T< T > & Mantid::NeXus::NXDataSetTyped< T >::vecBuffer ( )
inline

Member Data Documentation

◆ m_data

template<class T >
container_T<T> Mantid::NeXus::NXDataSetTyped< T >::m_data
private

◆ m_n

template<class T >
int Mantid::NeXus::NXDataSetTyped< T >::m_n
private

◆ m_size

template<class T >
int Mantid::NeXus::NXDataSetTyped< T >::m_size[4]
private

The sizes of the loaded data.

Definition at line 458 of file NexusClasses.h.

Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().


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