Mantid
|
The header describes interface to IO Operations perfomed by the box controller May be replaced by a boost filestream in a future. More...
#include <IBoxControllerIO.h>
Public Member Functions | |
virtual void | closeFile ()=0 |
Close the file. More... | |
virtual void | copyFileTo (const std::string &destFilename)=0 |
Copy the file contents to a new location. More... | |
virtual void | flushData () const =0 |
flush the IO buffers More... | |
virtual size_t | getDataChunk () const =0 |
the method which returns the size of data block used in IO operations More... | |
virtual void | getDataType (size_t &blockSize, std::string &typeName) const =0 |
virtual const std::string & | getFileName () const =0 |
virtual bool | isOpened () const =0 |
virtual void | loadBlock (std::vector< double > &, const uint64_t, const size_t) const =0 |
virtual void | loadBlock (std::vector< float > &, const uint64_t, const size_t) const =0 |
load known size float data block from spefied file position More... | |
virtual bool | openFile (const std::string &fileName, const std::string &mode)=0 |
open file for i/o operations More... | |
virtual void | saveBlock (const std::vector< double > &, const uint64_t) const =0 |
Save a double data block in the specified file position. More... | |
virtual void | saveBlock (const std::vector< float > &, const uint64_t) const =0 |
Save a float data block in the specified file position. More... | |
virtual void | setDataType (const size_t blockSize, const std::string &typeName)=0 |
As save/load operations use void data type, these function allow set up/get the type name provided for the IO operations and the size of the data type in bytes (e.g. More... | |
Public Member Functions inherited from Mantid::Kernel::DiskBuffer | |
uint64_t | allocate (uint64_t const newSize) |
Allocate a block of the given size in a free spot in the file, or at the end of the file if there is no space. More... | |
void | defragFreeBlocks () |
Method that defrags free blocks by combining adjacent ones together NOTE: This is not necessary to run since the freeBlock() methods automatically defrags neighboring blocks. More... | |
DiskBuffer () | |
Constructor. More... | |
DiskBuffer (const DiskBuffer &)=delete | |
DiskBuffer (uint64_t m_writeBufferSize) | |
Constructor. More... | |
void | flushCache () |
Flush out all the data in the memory; and writes out everything in the to-write cache. More... | |
void | freeBlock (uint64_t const pos, uint64_t const size) |
This method is called by this->relocate when object that has shrunk and so has left a bit of free space after itself on the file; or when an object gets moved to a new spot. More... | |
uint64_t | getFileLength () const |
freeSpace_t & | getFreeSpaceMap () |
void | getFreeSpaceVector (std::vector< uint64_t > &free) const |
Returns a vector with two entries per free block: position and size. More... | |
std::string | getMemoryStr () const |
uint64_t | getWriteBufferSize () const |
uint64_t | getWriteBufferUsed () const |
void | objectDeleted (ISaveable *item) |
Call this method when an object that might be in the cache is getting deleted. More... | |
DiskBuffer & | operator= (const DiskBuffer &)=delete |
uint64_t | relocate (uint64_t const oldPos, uint64_t const oldSize, const uint64_t newSize) |
This method is called by an ISaveable object that has outgrown its space allocated on file and needs to relocate. More... | |
void | setFileLength (const uint64_t length) const |
Set the length of the file that this MRU writes to. More... | |
void | setFreeSpaceVector (std::vector< uint64_t > &free) |
Sets the free space map. More... | |
void | setWriteBufferSize (uint64_t buffer) |
Set the size of the to-write buffer, in number of events. More... | |
void | toWrite (ISaveable *item) |
Call this method when an object is ready to be written out to disk. More... | |
virtual | ~DiskBuffer ()=default |
Additional Inherited Members | |
Public Types inherited from Mantid::Kernel::DiskBuffer | |
using | freeSpace_bySize_t = freeSpace_t::nth_index< 1 >::type |
A way to index the free space by their size. More... | |
using | freeSpace_t = boost::multi_index::multi_index_container< FreeBlock, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< ::boost::multi_index::const_mem_fun< FreeBlock, uint64_t, &FreeBlock::getFilePosition > >, boost::multi_index::ordered_non_unique< ::boost::multi_index::const_mem_fun< FreeBlock, uint64_t, &FreeBlock::getSize > > > > |
A map for the list of free space blocks in the file. More... | |
Protected Member Functions inherited from Mantid::Kernel::DiskBuffer | |
void | writeOldObjects () |
Method to write out the old objects that have been stored in the "toWrite" buffer. More... | |
Protected Attributes inherited from Mantid::Kernel::DiskBuffer | |
uint64_t | m_fileLength |
Length of the file. This is where new blocks that don't fit get placed. More... | |
freeSpace_t | m_free |
Map of the free blocks in the file. More... | |
freeSpace_bySize_t & | m_free_bySize |
Index into m_free, but indexed by block size. More... | |
std::mutex | m_freeMutex |
Mutex for modifying the free space list. More... | |
std::mutex | m_mutex |
Mutex for modifying the the toWrite buffer. More... | |
size_t | m_nObjectsToWrite |
number of objects stored in to write buffer list More... | |
std::list< ISaveable * > | m_toWriteBuffer |
A forward list for the buffer of "toWrite" objects. More... | |
size_t | m_writeBufferSize |
Do we use the write buffer? Always now. More... | |
size_t | m_writeBufferUsed |
Total amount of memory in the "toWrite" buffer. More... | |
The header describes interface to IO Operations perfomed by the box controller May be replaced by a boost filestream in a future.
It also currently assumes disk buffer usage. Disk buffer also assumes that actual IO operations performed by the class, inhereted from this one are thread-safe
Definition at line 26 of file IBoxControllerIO.h.
|
pure virtual |
Close the file.
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Copy the file contents to a new location.
Implemented in MantidTestHelpers::BoxControllerDummyIO, and Mantid::DataObjects::BoxControllerNeXusIO.
|
pure virtual |
flush the IO buffers
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
Referenced by Mantid::DataObjects::MDBoxSaveable::flushData().
|
pure virtual |
the method which returns the size of data block used in IO operations
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
load known size float data block from spefied file position
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
open file for i/o operations
fileName | – the name of the file to open |
mode | – the string describing file access mode. if w or W is present in the string file is opened in read/write mode. it is opened in read mode otherwise |
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Save a double data block in the specified file position.
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
Save a float data block in the specified file position.
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.
|
pure virtual |
As save/load operations use void data type, these function allow set up/get the type name provided for the IO operations and the size of the data type in bytes (e.g.
the class dependant physical meaning of the blockSize and blockPosition used by save/load operations
Implemented in Mantid::DataObjects::BoxControllerNeXusIO, and MantidTestHelpers::BoxControllerDummyIO.