Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Mantid::Kernel::DataItem Class Referenceabstract

This class forms the base class of any item that wishes to be stored in the analysis data service. More...

#include <DataItem.h>

Inheritance diagram for Mantid::Kernel::DataItem:
Mantid::API::Workspace FakeWorkspace Mantid::API::IMDWorkspace Mantid::API::ITableWorkspace Mantid::API::WorkspaceGroup Mantid::API::IMDEventWorkspace Mantid::API::IMDHistoWorkspace Mantid::API::MatrixWorkspace Mantid::API::IPeaksWorkspace Mantid::DataObjects::TableWorkspace TableWorkspaceTester Mantid::DataObjects::MDEventWorkspace MDHistoWorkspaceTester Mantid::DataObjects::MDHistoWorkspace AxeslessWorkspaceTester Mantid::API::HistoWorkspace Mantid::API::IEventWorkspace Mantid::DataObjects::LeanElasticPeaksWorkspace Mantid::DataObjects::PeaksWorkspace Mantid::DataObjects::MementoTableWorkspace Mantid::DataObjects::SplittersWorkspace

Public Member Functions

 DataItem ()
 Default constructor. More...
 
 DataItem (const DataItem &other)
 Copy constructor Always makes a unique lock. More...
 
virtual ~DataItem ()
 Destructor. More...
 

Interface

std::unique_ptr< Poco::RWLock > m_lock
 Multiple-reader/single-writer lock to restrict multithreaded access to the data item. More...
 
class ReadLock
 Allow the ReadLock class direct access to the m_lock object. More...
 
class WriteLock
 Allow the WriteLock class direct access to the m_lock object. More...
 
class Mantid::API::Algorithm
 Allow the Algorithm class but NOT its derived classes to get the lock object. More...
 
virtual const std::string id () const =0
 A string ID for the class. More...
 
virtual const std::string & getName () const =0
 The name of the object. More...
 
virtual bool threadSafe () const =0
 Can this object be accessed from multiple threads safely. More...
 
virtual const std::string toString () const =0
 Serializes the object to a string. More...
 
void readLock ()
 Acquires a read lock. More...
 
void unlock ()
 
Poco::RWLock * getLock () const
 Private method to access the RWLock object. More...
 

Detailed Description

This class forms the base class of any item that wishes to be stored in the analysis data service.

Author
Martyn Gigg

Definition at line 39 of file DataItem.h.

Constructor & Destructor Documentation

◆ DataItem() [1/2]

Mantid::Kernel::DataItem::DataItem ( )

Default constructor.

Definition at line 17 of file DataItem.cpp.

◆ DataItem() [2/2]

Mantid::Kernel::DataItem::DataItem ( const DataItem other)

Copy constructor Always makes a unique lock.

Definition at line 22 of file DataItem.cpp.

◆ ~DataItem()

Mantid::Kernel::DataItem::~DataItem ( )
virtualdefault

Destructor.

Required in cpp do avoid linker errors when other projects try to inherit from DataItem

Member Function Documentation

◆ getLock()

Poco::RWLock * Mantid::Kernel::DataItem::getLock ( ) const
protected

Private method to access the RWLock object.

Returns
the RWLock object.

Definition at line 37 of file DataItem.cpp.

References m_lock.

Referenced by readLock(), and unlock().

◆ getName()

virtual const std::string & Mantid::Kernel::DataItem::getName ( ) const
pure virtual

The name of the object.

Implemented in Mantid::API::Workspace, and MDHistoWorkspaceTester.

Referenced by export_DataItem().

◆ id()

virtual const std::string Mantid::Kernel::DataItem::id ( ) const
pure virtual

◆ readLock()

void Mantid::Kernel::DataItem::readLock ( )

Acquires a read lock.

If another thread currently holds a write lock, waits until the write lock is released.

Definition at line 30 of file DataItem.cpp.

References getLock().

◆ threadSafe()

virtual bool Mantid::Kernel::DataItem::threadSafe ( ) const
pure virtual

◆ toString()

virtual const std::string Mantid::Kernel::DataItem::toString ( ) const
pure virtual

◆ unlock()

void Mantid::Kernel::DataItem::unlock ( )

Definition at line 31 of file DataItem.cpp.

References getLock().

Friends And Related Function Documentation

◆ Mantid::API::Algorithm

friend class Mantid::API::Algorithm
friend

Allow the Algorithm class but NOT its derived classes to get the lock object.

Definition at line 76 of file DataItem.h.

◆ ReadLock

friend class ReadLock
friend

Allow the ReadLock class direct access to the m_lock object.

Definition at line 71 of file DataItem.h.

◆ WriteLock

friend class WriteLock
friend

Allow the WriteLock class direct access to the m_lock object.

Definition at line 73 of file DataItem.h.

Member Data Documentation

◆ m_lock

std::unique_ptr<Poco::RWLock> Mantid::Kernel::DataItem::m_lock
private

Multiple-reader/single-writer lock to restrict multithreaded access to the data item.

Definition at line 68 of file DataItem.h.

Referenced by getLock(), Mantid::Kernel::ReadLock::ReadLock(), Mantid::Kernel::WriteLock::WriteLock(), Mantid::Kernel::ReadLock::~ReadLock(), and Mantid::Kernel::WriteLock::~WriteLock().


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