Mantid
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
NexusIOHelper.h File Reference
#include "MantidIndexing/DllConfig.h"
#include <algorithm>
#include <boost/any.hpp>
#include <cstdint>
#include <nexus/NeXusFile.hpp>
#include <numeric>
#include <string>
#include <utility>

Go to the source code of this file.

Classes

struct  Mantid::NeXus::NeXusIOHelper::AllowNarrowing
 
struct  Mantid::NeXus::NeXusIOHelper::PreventNarrowing
 

Namespaces

namespace  Mantid
 Helper class which provides the Collimation Length for SANS instruments.
 
namespace  Mantid::NeXus
 
namespace  Mantid::NeXus::NeXusIOHelper
 

Macros

#define RUN_NEXUSIOHELPER_FUNCTION(Narrow, type, func_name, ...)
 Macro to run a function depending on the type of data in the Nexus file. More...
 

Functions

template<typename T , typename Narrow = PreventNarrowing>
std::vector< T > Mantid::NeXus::NeXusIOHelper::readNexusSlab (::NeXus::File &file, const std::string &entry, const std::vector< int64_t > &start, const std::vector< int64_t > &size)
 Opens the data group if needed, finds the data type, and calls readNexusAnySlab via the RUN_NEXUSIOHELPER_FUNCTION macro. More...
 
template<typename T , typename Narrow = PreventNarrowing>
void Mantid::NeXus::NeXusIOHelper::readNexusSlab (std::vector< T > &out, ::NeXus::File &file, const std::string &entry, const std::vector< int64_t > &start, const std::vector< int64_t > &size)
 Opens the data group if needed, finds the data type, and calls readNexusAnySlab via the RUN_NEXUSIOHELPER_FUNCTION macro. More...
 
template<typename T , typename Narrow = PreventNarrowing>
Mantid::NeXus::NeXusIOHelper::readNexusValue (::NeXus::File &file, const std::string &entry="")
 
template<typename T , typename Narrow = PreventNarrowing>
std::vector< T > Mantid::NeXus::NeXusIOHelper::readNexusVector (::NeXus::File &file, const std::string &entry="")
 Opens the data group if needed, finds the data type, computes the data size, and calls readNexusAnyVector via the RUN_NEXUSIOHELPER_FUNCTION macro. More...
 
template<typename T , typename Narrow = PreventNarrowing>
void Mantid::NeXus::NeXusIOHelper::readNexusVector (std::vector< T > &out, ::NeXus::File &file, const std::string &entry="")
 Opens the data group if needed, finds the data type, computes the data size, and calls readNexusAnyVector via the RUN_NEXUSIOHELPER_FUNCTION macro. More...
 

Macro Definition Documentation

◆ RUN_NEXUSIOHELPER_FUNCTION

#define RUN_NEXUSIOHELPER_FUNCTION (   Narrow,
  type,
  func_name,
  ... 
)
Value:
switch (type) { \
case ::NeXus::FLOAT32: \
return func_name<T, float, Narrow>(__VA_ARGS__); \
case ::NeXus::FLOAT64: \
return func_name<T, double, Narrow>(__VA_ARGS__); \
case ::NeXus::INT8: \
return func_name<T, int8_t, Narrow>(__VA_ARGS__); \
case ::NeXus::UINT8: \
return func_name<T, uint8_t, Narrow>(__VA_ARGS__); \
case ::NeXus::INT16: \
return func_name<T, int16_t, Narrow>(__VA_ARGS__); \
case ::NeXus::UINT16: \
return func_name<T, uint16_t, Narrow>(__VA_ARGS__); \
case ::NeXus::INT32: \
return func_name<T, int32_t, Narrow>(__VA_ARGS__); \
case ::NeXus::UINT32: \
return func_name<T, uint32_t, Narrow>(__VA_ARGS__); \
case ::NeXus::INT64: \
return func_name<T, int64_t, Narrow>(__VA_ARGS__); \
case ::NeXus::UINT64: \
return func_name<T, uint64_t, Narrow>(__VA_ARGS__); \
default: \
throw std::runtime_error("NeXusIOHelper: Unknown type in Nexus file"); \
}

Macro to run a function depending on the type of data in the Nexus file.

Definition at line 28 of file NexusIOHelper.h.