Mantid
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
item_struct< T > Class Template Reference

structure to hold a dae item More...

#include <item_struct.h>

Classes

struct  item_t
 structure to hold a dae item More...
 

Public Member Functions

int addItem (const std::string &name, const T *value, bool det_average=false, const int *dim0=nullptr, const int *dim1=nullptr)
 Adds an item. More...
 
const item_tfindItem (const std::string &item_name, bool det_average)
 finds an item More...
 
int getArrayItem (const std::string &item_name, int nspec, T *larray)
 Gets an array of items. More...
 
int getArrayItem (const std::string &item_name, T *larray)
 Gets an array of items. More...
 
int getArrayItemSize (const std::string &item_name, int *dims_array, int &ndims)
 Gets the size of an array of items. More...
 
int getItem (const std::string &item_name, const long *spec_array, int nspec, T *lVal)
 Gets an item nspec number of 0 means no spec average. More...
 
int getItem (const std::string &item_name, T &value)
 Gets an item. More...
 
 item_struct ()
 

Private Types

using items_map_t = std::map< std::string, item_t >
 Type def of internal map of named items. More...
 

Private Attributes

items_map_t m_items
 internal map of named items More...
 
long m_ndet
 with det_average More...
 
unsigned long * m_spec_array
 length m_ndet; used for averaging values More...
 

Detailed Description

template<typename T>
class item_struct< T >

structure to hold a dae item

Definition at line 15 of file item_struct.h.

Member Typedef Documentation

◆ items_map_t

template<typename T >
using item_struct< T >::items_map_t = std::map<std::string, item_t>
private

Type def of internal map of named items.

Definition at line 30 of file item_struct.h.

Constructor & Destructor Documentation

◆ item_struct()

template<typename T >
item_struct< T >::item_struct ( )
inline

Definition at line 27 of file item_struct.h.

Member Function Documentation

◆ addItem()

template<typename T >
int item_struct< T >::addItem ( const std::string &  name,
const T *  value,
bool  det_average = false,
const int *  dim0 = nullptr,
const int *  dim1 = nullptr 
)
inline

Adds an item.

Parameters
name:: the item name
value:: the item
det_average:: Detector average or not
dim0:: Diemnsion array zero
dim1:: Diemnsion array one
Returns
0 on success, -1 if it is a duplicate

Definition at line 45 of file item_struct.h.

References item_struct< T >::m_items, and value.

Referenced by ISISRAW::addItems().

◆ findItem()

template<typename T >
const item_t * item_struct< T >::findItem ( const std::string &  item_name,
bool  det_average 
)
inline

finds an item

Parameters
item_name:: the item name
det_average:: Detector average or not
Returns
The item pointer or NULL

Definition at line 61 of file item_struct.h.

References item_struct< T >::m_items.

◆ getArrayItem() [1/2]

template<typename T >
int item_struct< T >::getArrayItem ( const std::string &  item_name,
int  nspec,
T *  larray 
)

Gets an array of items.

Parameters
item_name:: the item name
nspec:: the number of spectra in the array
larray:: The returned array
Returns
0 on success

Definition at line 118 of file item_struct.cpp.

References item_struct< T >::item_t::dim0, item_struct< T >::item_t::dim1, FAILURE, n, SUCCESS, and item_struct< T >::item_t::value.

◆ getArrayItem() [2/2]

template<typename T >
int item_struct< T >::getArrayItem ( const std::string &  item_name,
T *  larray 
)

Gets an array of items.

Parameters
item_name:: the item name
larray:: The returned array
Returns
0 on success

Definition at line 146 of file item_struct.cpp.

References n.

◆ getArrayItemSize()

template<typename T >
int item_struct< T >::getArrayItemSize ( const std::string &  item_name,
int *  dims_array,
int &  ndims 
)

Gets the size of an array of items.

Parameters
item_name:: the item name
dims_array:: The array of dimensions
ndims:: the number of dimensions in the array
Returns
0 on success

Definition at line 92 of file item_struct.cpp.

References item_struct< T >::item_t::dim0, item_struct< T >::item_t::dim1, FAILURE, and SUCCESS.

◆ getItem() [1/2]

template<typename T >
int item_struct< T >::getItem ( const std::string &  item_name,
const long *  spec_array,
int  nspec,
T *  lVal 
)

Gets an item nspec number of 0 means no spec average.

Parameters
item_name:: the item name
spec_array:: The array of spectra numbers
nspec:: the number of spectra in the array
lVal:: A pointer to the item
Returns
0 on success

Definition at line 42 of file item_struct.cpp.

References item_struct< T >::item_t::dim0, item_struct< T >::item_t::dim1, FAILURE, n, SUCCESS, and item_struct< T >::item_t::value.

◆ getItem() [2/2]

template<typename T >
int item_struct< T >::getItem ( const std::string &  item_name,
T &  value 
)

Gets an item.

Parameters
item_name:: the item name
value:: A pointer to the item
Returns
0 on success

Definition at line 18 of file item_struct.cpp.

References getItem(), n, and value.

Member Data Documentation

◆ m_items

template<typename T >
items_map_t item_struct< T >::m_items
private

internal map of named items

Definition at line 32 of file item_struct.h.

Referenced by item_struct< T >::addItem(), and item_struct< T >::findItem().

◆ m_ndet

template<typename T >
long item_struct< T >::m_ndet
private

with det_average

number of detectors

Definition at line 35 of file item_struct.h.

◆ m_spec_array

template<typename T >
unsigned long* item_struct< T >::m_spec_array
private

length m_ndet; used for averaging values

Definition at line 33 of file item_struct.h.


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