Mantid
Loading...
Searching...
No Matches
BoxControllerDummyIO.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7/*********************************************************************************
8 * PLEASE READ THIS!!!!!!!
9 *
10 * This header MAY NOT be included in any test from a package below API
11 * (e.g. Kernel, Geometry).
12 * Conversely, this file MAY NOT be modified to use anything from a package
13 *higher
14 * than API (e.g. any algorithm or concrete workspace), even if via the
15 *factory.
16 *********************************************************************************/
17#pragma once
18
22#include <mutex>
23
25
26//===============================================================================================
34public:
37 bool isOpened() const override { return (m_isOpened); }
39 const std::string &getFileName() const override { return m_fileName; }
40 void copyFileTo(const std::string &) override {}
42 size_t getDataChunk() const override { return 1; }
43
44 bool openFile(const std::string &fileName, const std::string &mode) override;
45 void saveBlock(const std::vector<float> & /* DataBlock */, const uint64_t /*blockPosition*/) const override;
46 void saveBlock(const std::vector<double> & /* DataBlock */, const uint64_t /*blockPosition*/) const override {
48 "Saving double presision events blocks is not supported at the moment");
49 }
50 void loadBlock(std::vector<float> & /* Block */, const uint64_t /*blockPosition*/,
51 const size_t /*BlockSize*/) const override;
52 void loadBlock(std::vector<double> & /* Block */, const uint64_t /*blockPosition*/,
53 const size_t /*BlockSize*/) const override {
55 "Loading double presision events blocks is not supported at the "
56 "moment");
57 }
58 void flushData() const override {};
59 void closeFile() override { m_isOpened = false; }
60
61 ~BoxControllerDummyIO() override;
62 // Auxiliary functions. Used to change default state of this object which is
63 // not fully supported. Should be replaced by some IBoxControllerIO factory
64 void setDataType(const size_t blockSize, const std::string &typeName) override;
65 void getDataType(size_t &CoordSize, std::string &typeName) const override;
66
67 // Auxiliary functions (non-virtual, used at testing)
68 int64_t getNDataColums() const { return 2; }
69
70private:
74 std::string m_fileName;
75 // the file Handler responsible for Nexus IO operations;
76 mutable std::vector<float> fileContents;
79
80 mutable std::mutex m_fileMutex;
83 unsigned int m_CoordSize;
84 unsigned int m_EventSize;
85 std::string m_TypeName;
86
91};
92} // namespace MantidTestHelpers
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition System.h:37
The class responsible for dummy IO operations, which mimic saving events into a direct access file us...
bool m_isOpened
identified of the file state, if it is open or not.
size_t getDataChunk() const override
Return the size of the NeXus data block used in NeXus data array.
void copyFileTo(const std::string &) override
Copy the file contents to a new location.
void saveBlock(const std::vector< double > &, const uint64_t) const override
Save a double data block in the specified file position.
void closeFile() override
Close the file.
bool m_ReadOnly
identifier if the file open only for reading or is in read/write
std::string m_fileName
full file name (with path) of the Nexis file responsible for the IO operations (as NeXus filename has...
unsigned int m_CoordSize
number of bytes in the event coorinates (coord_t length).
void flushData() const override
flush the IO buffers
void loadBlock(std::vector< double > &, const uint64_t, const size_t) const override
const std::string & getFileName() const override
get the full file name of the file used for IO operations
const Mantid::API::BoxController * m_bc
shared pointer to the box controller, which is repsoponsible for this IO
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...
Marks code as not implemented yet.
Definition Exception.h:138