11#include "MantidDataObjects/DllConfig.h"
13#include <nexus/NeXusFile.hpp>
18namespace DataObjects {
32 bool isOpened()
const override {
return m_File.get() !=
nullptr; }
34 const std::string &
getFileName()
const override {
return m_fileName; }
36 void copyFileTo(
const std::string &destFilename)
override;
41 bool openFile(
const std::string &fileName,
const std::string &mode)
override;
43 void saveBlock(
const std::vector<float> & ,
const uint64_t )
const override;
44 void loadBlock(std::vector<float> & ,
const uint64_t ,
45 const size_t )
const override;
46 void saveBlock(
const std::vector<double> & ,
const uint64_t )
const override;
47 void loadBlock(std::vector<double> & ,
const uint64_t ,
48 const size_t )
const override;
50 void flushData()
const override;
51 void closeFile()
override;
56 void setDataType(
const size_t blockSize,
const std::string &typeName)
override;
57 void getDataType(
size_t &CoordSize, std::string &typeName)
const override;
62 ::NeXus::File *
getFile() {
return m_File.get(); }
77 enum class EventDataVersion :
size_t { EDVLean = 2, EDVOriginal = 4, EDVGoniometer = 5 };
81 void setEventDataVersion(
const EventDataVersion &version);
87 void setEventDataVersion(
const size_t &traitsCount);
93 int64_t dataEventCount(
void)
const;
107 template <
typename FloatOrDouble>
108 void adjustEventDataBlock(std::vector<FloatOrDouble> &Block,
const std::string &accessMode)
const;
113 enum { DATA_CHUNK = 10000 };
172 void CreateEventGroup();
173 void OpenAndCheckEventGroup();
174 void getDiskBufferFileData();
175 void prepareNxSToWrite_CurVersion();
176 void prepareNxSdata_CurVersion();
178 static EventType TypeFromString(
const std::vector<std::string> &typesSupported,
const std::string &typeName);
188 template <
typename Type>
189 void saveGenericBlock(
const std::vector<Type> &
DataBlock,
const uint64_t blockPosition)
const;
199 template <
typename Type>
200 void loadGenericBlock(std::vector<Type> &Block,
const uint64_t blockPosition,
const size_t nPoints)
const;
This class is used by MDBox and MDGridBox in order to intelligently determine optimal behavior.
The header describes interface to IO Operations perfomed by the box controller May be replaced by a b...
DataBlock: The DataBlock class holds information about a contiguous block of spectrum numbers.
The class responsible for saving events into nexus file using generic box controller interface Expect...
bool isOpened() const override
EventDataVersion
The version of the "event_data" Nexus dataset.
bool m_ReadOnly
identifier if the file open only for reading or is in read/write
std::vector< std::string > m_EventsTypeHeaders
data headers used for different events types
::NeXus::File * getFile()
EventDataVersion m_EventDataVersion
"data_event" dataset version in the current Nexus file
CoordConversion
the enum, which suggests the way (currently)two possible data types are converted to each other
int64_t getNDataColums() const
std::string m_fileName
full file name (with path) of the Nexis file responsible for the IO operations (as NeXus filename has...
std::unique_ptr<::NeXus::File > m_File
the file Handler responsible for Nexus IO operations;
std::vector< int64_t > m_BlockStart
the start of the current data block to read from.
size_t m_dataChunk
The size of the events block which can be written in the neXus array at once (continuous part of the ...
const std::string & getFileName() const override
get the full file name of the file used for IO operations
EventDataVersion getEventDataVersion() const
static std::string g_DBDataName
the group name to save disk buffer data
EventType
possible event types this class understands.
std::string m_EventsVersion
The version of the md events data block.
size_t getDataChunk() const override
Return the size of the NeXus data block used in NeXus data array.
static std::string g_EventGroupName
the name of the Nexus data group for saving the events
API::BoxController *const m_bc
shared pointer to the box controller, which is repsoponsible for this IO
unsigned int m_CoordSize
number of bytes in the event coordinates (coord_t length).
std::vector< std::string > m_EventsTypesSupported
the symbolic description of the event types currently supported by the class
std::vector< int64_t > m_BlockSize
the vector, which describes the event specific data size, namely how many column an event is composed...
std::mutex m_fileMutex
lock Nexus file operations as Nexus is not thread safe
Helper class which provides the Collimation Length for SANS instruments.