DataItem.cpp 1.22 KB
Newer Older
1
2
3
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4
5
//   NScD Oak Ridge National Laboratory, European Spallation Source,
//   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
8
9
10
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "MantidKernel/DataItem.h"
11
#include <Poco/RWLock.h>
12

13
namespace Mantid::Kernel {
14

15
16
/** Default constructor
 */
17
DataItem::DataItem() : m_lock(std::make_unique<Poco::RWLock>()) {}
18

19
/** Copy constructor
20
 * Always makes a unique lock
21
 */
22
DataItem::DataItem(const DataItem & /*other*/) : m_lock(std::make_unique<Poco::RWLock>()) {}
23

24
25
26
27
/**
 * Destructor. Required in cpp do avoid linker errors when other projects try to
 * inherit from DataItem
 */
28
DataItem::~DataItem() {}
29

30
31
32
void DataItem::readLock() { getLock()->readLock(); }
void DataItem::unlock() { getLock()->unlock(); }

33
34
35
36
/** Private method to access the RWLock object.
 *
 * @return the RWLock object.
 */
37
Poco::RWLock *DataItem::getLock() const { return m_lock.get(); }
38

39
} // namespace Mantid::Kernel