Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args > Struct Template Reference

#include <KisLazySharedCacheStorage.h>

Classes

struct  SharedStorage
 

Public Types

using ConstType = std::add_const_t<T>
 
using FactoryType = T*(Args...)
 

Public Member Functions

 DataWrapperShared ()
 
 DataWrapperShared (const DataWrapperShared &rhs)=default
 
 DataWrapperShared (T *value)
 
bool hasValue () const
 
ConstTypelazyInitialize (const std::function< FactoryType > &factory, Args... args)
 
DataWrapperSharedoperator= (const DataWrapperShared &rhs)=default
 
void reset ()
 

Private Attributes

QSharedPointer< SharedStoragem_sharedStorage
 

Detailed Description

template<typename T, typename... Args>
struct KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >

A policy-like class for sharing DataStorage object between the two different objects. It just ads one more level of locking to ensure thread-safety.

Definition at line 67 of file KisLazySharedCacheStorage.h.

Member Typedef Documentation

◆ ConstType

template<typename T , typename... Args>
using KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::ConstType = std::add_const_t<T>

Definition at line 69 of file KisLazySharedCacheStorage.h.

◆ FactoryType

template<typename T , typename... Args>
using KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::FactoryType = T*(Args...)

Definition at line 70 of file KisLazySharedCacheStorage.h.

Constructor & Destructor Documentation

◆ DataWrapperShared() [1/3]

template<typename T , typename... Args>
KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::DataWrapperShared ( )
inline

Definition at line 87 of file KisLazySharedCacheStorage.h.

87: m_sharedStorage(new SharedStorage()) {}

◆ DataWrapperShared() [2/3]

template<typename T , typename... Args>
KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::DataWrapperShared ( T * value)
inline

Definition at line 88 of file KisLazySharedCacheStorage.h.

88: m_sharedStorage(new SharedStorage(value)) {}
float value(const T *src, size_t ch)

◆ DataWrapperShared() [3/3]

template<typename T , typename... Args>
KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::DataWrapperShared ( const DataWrapperShared< T, Args > & rhs)
default

Member Function Documentation

◆ hasValue()

template<typename T , typename... Args>
bool KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::hasValue ( ) const
inline

Definition at line 97 of file KisLazySharedCacheStorage.h.

97 {
98 QMutexLocker l(&m_sharedStorage->sharedMutex);
99 return m_sharedStorage->m_value.hasValue();
100 }

References KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::m_sharedStorage.

◆ lazyInitialize()

template<typename T , typename... Args>
ConstType * KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::lazyInitialize ( const std::function< FactoryType > & factory,
Args... args )
inline

Definition at line 92 of file KisLazySharedCacheStorage.h.

92 {
93 QMutexLocker l(&m_sharedStorage->sharedMutex);
94 return m_sharedStorage->m_value.lazyInitialize(factory, std::forward<Args...>(args...));
95 }

References KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::m_sharedStorage.

◆ operator=()

template<typename T , typename... Args>
DataWrapperShared & KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::operator= ( const DataWrapperShared< T, Args > & rhs)
default

◆ reset()

template<typename T , typename... Args>
void KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::reset ( )
inline

Definition at line 102 of file KisLazySharedCacheStorage.h.

102 {
103 m_sharedStorage.reset(new SharedStorage());
104 }

References KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::m_sharedStorage.

Member Data Documentation

◆ m_sharedStorage

template<typename T , typename... Args>
QSharedPointer<SharedStorage> KisLazySharedCacheStorageDetail::DataWrapperShared< T, Args >::m_sharedStorage
private

Definition at line 107 of file KisLazySharedCacheStorage.h.


The documentation for this struct was generated from the following file: