![]() |
JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
template class that wraps any datatype and combines it with a mutex, exposes the lock()/unlock() interface, so access to the contained data can be synchronized More...
#include <jkqtpconcurrencytools.h>
Classes | |
| struct | AdoptLockType |
| type of AdoptLock tag, which is used in ReadLocker and WriteLocker to adopt a pre-locked JKQTPSynchronized<T> More... | |
| class | ReadLocker |
| type of a lock_guard for a JKQTPSynchronized<T> for reading More... | |
| class | WriteLocker |
| type of a lock_guard for a JKQTPSynchronized<T> for writing More... | |
Public Types | |
| typedef T | data_type |
| contained data type T | |
| typedef JKQTPSynchronized< T >::WriteLocker | Locker |
| type of a lock_guard for a JKQTPSynchronized<T> for writing | |
| typedef QReadWriteLock | MutexType |
| Mutex used by this temmplate. | |
Public Member Functions | |
| JKQTPSynchronized () | |
| default constructor, the internal data is default-initialized | |
| JKQTPSynchronized (const JKQTPSynchronized< T > &other) | |
| locks other and copies its contents to this new class | |
| JKQTPSynchronized (const T &d) | |
| initializing constructor, the internal data is initialized with d | |
| JKQTPSynchronized (JKQTPSynchronized< T > &&other) | |
| locks other and moves its contents to this new class. The mutex in other is NOT moved! | |
| JKQTPSynchronized (T &&d) | |
| initializing constructor, the internal data is initialized with d | |
| T & | get () |
| returns the internal data as a mutable reference, not thread-safe. | |
| const T & | get () const |
| returns the internal data as a mutable reference, not thread-safe. | |
| T | get_safe () const |
| returns the value in the internal data storage, thread-safe. | |
| void | lock () const |
| locks the internal mutex for writing, until unlock() is called | |
| void | lockForRead () const |
| locks the internal mutex for writing, until unlock() is called | |
| void | lockForWrite () const |
| locks the internal mutex for writing, until unlock() is called | |
| T * | operator-> () |
| gives access to the internal data, not thread-safe. | |
| const T * | operator-> () const |
| gives access to the internal data, not thread-safe. | |
| void | set (const T &d) |
| assign a value to the internal data storage, not thread-safe. | |
| void | set (T &&d) |
| assign a value to the internal data storage, not thread-safe. | |
| void | set_safe (const T &d) |
| assign a value to the internal data storage, thread-safe. | |
| void | set_safe (T &&d) |
| assign a value to the internal data storage, thread-safe. | |
| void | unlock () const |
| unlocks the internal mutex from a previous lock(), lockForWrite() or lockForRead() call | |
Static Public Attributes | |
| static constexpr AdoptLockType | AdoptLock { } |
| tag, which is used in ReadLocker and WriteLocker to adopt a pre-locked JKQTPSynchronized<T> | |
Private Attributes | |
| T | m_data |
| MutexType | m_mutex |
template class that wraps any datatype and combines it with a mutex, exposes the lock()/unlock() interface, so access to the contained data can be synchronized
| typedef T JKQTPSynchronized< T >::data_type |
contained data type T
| typedef JKQTPSynchronized<T>::WriteLocker JKQTPSynchronized< T >::Locker |
type of a lock_guard for a JKQTPSynchronized<T> for writing
| typedef QReadWriteLock JKQTPSynchronized< T >::MutexType |
Mutex used by this temmplate.
|
inline |
default constructor, the internal data is default-initialized
|
inline |
initializing constructor, the internal data is initialized with d
|
inline |
initializing constructor, the internal data is initialized with d
|
inline |
locks other and copies its contents to this new class
|
inline |
locks other and moves its contents to this new class. The mutex in other is NOT moved!
|
inline |
returns the internal data as a mutable reference, not thread-safe.
|
inline |
returns the internal data as a mutable reference, not thread-safe.
|
inline |
returns the value in the internal data storage, thread-safe.
|
inline |
locks the internal mutex for writing, until unlock() is called
|
inline |
locks the internal mutex for writing, until unlock() is called
|
inline |
locks the internal mutex for writing, until unlock() is called
|
inline |
gives access to the internal data, not thread-safe.
|
inline |
gives access to the internal data, not thread-safe.
|
inline |
assign a value to the internal data storage, not thread-safe.
|
inline |
assign a value to the internal data storage, not thread-safe.
|
inline |
assign a value to the internal data storage, thread-safe.
|
inline |
assign a value to the internal data storage, thread-safe.
|
inline |
unlocks the internal mutex from a previous lock(), lockForWrite() or lockForRead() call
|
staticconstexpr |
tag, which is used in ReadLocker and WriteLocker to adopt a pre-locked JKQTPSynchronized<T>
|
private |
|
mutableprivate |