Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::DataObjects::MDBoxSaveable Class Reference

Two classes responsible for implementing methods which automatically save/load MDBox in conjuction with DiskBuffer One class responsible for saving events into nexus and another one – for identifying the data positions in a file in conjuction with DB. More...

#include <MDBoxSaveable.h>

Inheritance diagram for Mantid::DataObjects::MDBoxSaveable:
Mantid::Kernel::ISaveable

Public Member Functions

void clearDataFromMemory () override
 remove objects data from memory but keep all averages More...
 
void flushData () const override
 Method to flush the data to disk and ensure it is written. More...
 
size_t getDataMemorySize () const override
 
uint64_t getTotalDataSize () const override
 
void load () override
 Load the data which are not in memory yet and merge them with the data in memory;. More...
 
 MDBoxSaveable (API::IMDNode *const)
 
void save () const override
 Save the data to the place, specified by the object. More...
 
- Public Member Functions inherited from Mantid::Kernel::ISaveable
void clearDataChanged ()
 this method has to be called if the object has been discarded from memory and is not changed any more. More...
 
virtual void clearDataFromMemory ()=0
 remove objects data from memory More...
 
virtual void flushData () const =0
 Method to flush the data to disk and ensure it is written. More...
 
virtual size_t getDataMemorySize () const =0
 the data size kept in memory More...
 
virtual uint64_t getFilePosition () const
 
uint64_t getFileSize () const
 Return the number of units this block occipies on file. More...
 
virtual uint64_t getTotalDataSize () const =0
 
 ISaveable ()
 Constructor
More...
 
 ISaveable (const ISaveable &other)
 Copy constructor --> needed for std containers and not to copy mutexes Note setting isLoaded to false to break connection with the file object which is not copyale. More...
 
bool isBusy () const
 
bool isDataChanged () const
 
bool isLoaded () const
 
virtual void load ()=0
 Load the data - to be overriden. More...
 
virtual void save () const =0
 Save the data - to be overriden. More...
 
void setBusy (bool On)
 @ set the data busy to prevent from removing them from memory. More...
 
void setDataChanged ()
 Call this method from the method which changes the object but keeps the object size the same to tell DiskBuffer to write it back the dataChanged ID is reset after save from the DataBuffer is emptied
More...
 
void setFilePosition (uint64_t newPos, size_t newSize, bool wasSaved)
 Sets the location of the object on HDD. More...
 
void setLoaded (bool Yes)
 sets the value of the isLoad parameter, indicating that data from HDD have its image in memory More...
 
bool wasSaved () const
 
virtual ~ISaveable ()=default
 

Private Attributes

API::IMDNode *const m_MDNode
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Kernel::ISaveable
bool m_Busy
 a user needs to set this variable to true preventing from deleting data from buffer More...
 
bool m_dataChanged
 a user needs to set this variable to true to allow DiskBuffer saving the object to HDD when it decides it suitable, if the size of iSavable object in cache is unchanged from the previous save/load operation More...
 
bool m_isLoaded
 this boolean indicates, if the data have its copy in memory More...
 
bool m_wasSaved
 this boolean indicates if the data were saved on HDD and have physical representation on it (though this representation may be incorrect as data changed in memory) More...
 

Detailed Description

Two classes responsible for implementing methods which automatically save/load MDBox in conjuction with DiskBuffer One class responsible for saving events into nexus and another one – for identifying the data positions in a file in conjuction with DB.

Date
March 15, 2013

Definition at line 25 of file MDBoxSaveable.h.

Constructor & Destructor Documentation

◆ MDBoxSaveable()

Mantid::DataObjects::MDBoxSaveable::MDBoxSaveable ( API::IMDNode * const  Host)

Definition at line 12 of file MDBoxSaveable.cpp.

Member Function Documentation

◆ clearDataFromMemory()

void Mantid::DataObjects::MDBoxSaveable::clearDataFromMemory ( )
inlineoverridevirtual

remove objects data from memory but keep all averages

Implements Mantid::Kernel::ISaveable.

Definition at line 38 of file MDBoxSaveable.h.

◆ flushData()

void Mantid::DataObjects::MDBoxSaveable::flushData ( ) const
overridevirtual

Method to flush the data to disk and ensure it is written.

flush data out of the file buffer to the HDD

Implements Mantid::Kernel::ISaveable.

Definition at line 15 of file MDBoxSaveable.cpp.

References Mantid::API::IBoxControllerIO::flushData(), Mantid::API::IMDNode::getBoxController(), Mantid::API::BoxController::getFileIO(), and m_MDNode.

◆ getDataMemorySize()

size_t Mantid::DataObjects::MDBoxSaveable::getDataMemorySize ( ) const
inlineoverridevirtual
Returns
the size of the event vector. ! Note that this is NOT necessarily the same as the number of points (because it might be cached to disk) or the size on disk (because you might have called AddEvents)

Implements Mantid::Kernel::ISaveable.

Definition at line 46 of file MDBoxSaveable.h.

◆ getTotalDataSize()

uint64_t Mantid::DataObjects::MDBoxSaveable::getTotalDataSize ( ) const
inlineoverridevirtual
Returns
the amount of memory that the object takes up in the MRU.

Implements Mantid::Kernel::ISaveable.

Definition at line 41 of file MDBoxSaveable.h.

◆ load()

void Mantid::DataObjects::MDBoxSaveable::load ( )
overridevirtual

Load the data which are not in memory yet and merge them with the data in memory;.

Loads the data from HDD if these data has not been loaded before.

private function called from the DiskBuffer

Implements Mantid::Kernel::ISaveable.

Definition at line 37 of file MDBoxSaveable.cpp.

References Mantid::API::IMDNode::getBoxController(), Mantid::API::BoxController::getFileIO(), Mantid::Kernel::ISaveable::getFilePosition(), Mantid::Kernel::ISaveable::getFileSize(), Mantid::API::IMDNode::loadAndAddFrom(), Mantid::Kernel::ISaveable::m_isLoaded, m_MDNode, and Mantid::Kernel::ISaveable::setLoaded().

Referenced by save().

◆ save()

void Mantid::DataObjects::MDBoxSaveable::save ( ) const
overridevirtual

Save the data to the place, specified by the object.

Physically save the box data.

Tries to load any previous data from HDD Private function called from the DiskBuffer.

Save the box at the disk position defined by this class. The IMDNode has to be file backed for this method to work

Implements Mantid::Kernel::ISaveable.

Definition at line 21 of file MDBoxSaveable.cpp.

References Mantid::API::IMDNode::getBoxController(), Mantid::API::BoxController::getFileIO(), Mantid::Kernel::ISaveable::getFilePosition(), load(), m_MDNode, Mantid::Kernel::ISaveable::m_wasSaved, Mantid::API::IMDNode::saveAt(), and Mantid::Kernel::ISaveable::wasSaved().

Member Data Documentation

◆ m_MDNode

API::IMDNode* const Mantid::DataObjects::MDBoxSaveable::m_MDNode
private

Definition at line 49 of file MDBoxSaveable.h.

Referenced by flushData(), load(), and save().


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