refs #659 Read-only versions of cache value access classes.

This commit is contained in:
Mathew Sutcliffe
2016-06-05 17:10:26 +01:00
parent a2b0602c53
commit aefef81cd7
2 changed files with 42 additions and 0 deletions

View File

@@ -356,6 +356,26 @@ namespace BlackMisc
CStatusMessage save() = delete;
};
/*!
* Class template for read-only access to a specific value in the CDataCache.
* \tparam Trait A subclass of BlackMisc::CDataTrait that identifies the value's key and other metadata.
*/
template <typename Trait>
class CDataReadOnly : public BlackMisc::CData<Trait>
{
public:
//! Inherited constructor.
using CData<Trait>::CData;
//! Deleted mutators.
//! @{
CStatusMessage set(const typename Trait::type &value, qint64 timestamp = 0) = delete;
CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete;
CStatusMessage setDefault() = delete;
void renewTimestamp(qint64 timestamp) = delete;
//! @}
};
/*!
* Base class for traits to be used as template argument to BlackMisc::CData.
*/