DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Pointer to lock a class derived from ISynchronizedPointerLockable
for synchronizing between threads. Instances of this class are not intended to be stored somewhere since they make other threads block. Only use as temporary objects.
More...
Public Member Functions | |
SynchronizedPointer () noexcept | |
Contructs an instance with an empty pointer. More... | |
SynchronizedPointer (T *const LockableObject, const std::chrono::milliseconds Timeout=ILockable::DefaultTimeout) | |
Constructs a pointer locking LockableObject . Blocks until LockableObject's mutex is locked or until the timeout duration is exceeded. Recursive locking is allowed. More... | |
SynchronizedPointer (SynchronizedPointer &&Other) noexcept | |
Moves the LockableObject from another SynchronizedPointer instance Other to a new instance. Other becomes empty. More... | |
SynchronizedPointer & | operator= (SynchronizedPointer &&Other) noexcept |
Move-assigns the LockableObject from another SynchronizedPointer instance Other to this instance. Other becomes empty. More... | |
template<typename U > | |
SynchronizedPointer (SynchronizedPointer< U > &&Other) | |
Moves the LockableObject from a SynchronizedPointer<U> of another type U to a new instance of SynchronizedPointer<T> using dynamic_cast. Other becomes empty. More... | |
~SynchronizedPointer () | |
auto | get () const noexcept |
Returns the managed (locked) object. More... | |
bool | operator== (const T *rhs) const noexcept |
bool | operator!= (const T *rhs) const noexcept |
bool | operator== (const SynchronizedPointer &rhs) const noexcept |
bool | operator!= (const SynchronizedPointer &rhs) const noexcept |
operator bool () const noexcept | |
auto | operator-> () const noexcept |
auto & | operator* () const noexcept |
Public Member Functions inherited from Util::INonCopyable | |
INonCopyable (const INonCopyable &)=delete | |
INonCopyable & | operator= (const INonCopyable &)=delete |
Private Attributes | |
T * | LockableObject |
Pointer to the locakable object managed by this class. More... | |
Friends | |
template<typename > | |
class | SynchronizedPointer |
Additional Inherited Members | |
Protected Member Functions inherited from Util::INonCopyable | |
constexpr | INonCopyable ()=default |
~INonCopyable ()=default | |
Pointer to lock a class derived from ISynchronizedPointerLockable
for synchronizing between threads. Instances of this class are not intended to be stored somewhere since they make other threads block. Only use as temporary objects.
T | Type derived from ISynchronizedPointerLockable to be managed by this pointer. |
|
inlinenoexcept |
|
inline |
Constructs a pointer locking LockableObject
. Blocks until LockableObject's
mutex is locked or until the timeout duration is exceeded. Recursive locking is allowed.
LockableObject | Pointer to an instance of a class derived from ISynchronizedPointerLockable to be locked. |
Timeout | Time to wait trying to lock the internal mutex. 0 ms means that the functions waits for the mutex without timing out ever. |
|
inlinenoexcept |
Moves the LockableObject
from another SynchronizedPointer instance Other
to a new instance. Other
becomes empty.
Other | SynchronizedPointer instance to move from |
|
inlineexplicit |
Moves the LockableObject
from a SynchronizedPointer<U> of another type U
to a new instance of SynchronizedPointer<T> using dynamic_cast. Other
becomes empty.
U | Type derived from ISynchronizedPointerLockable managed by Other |
Other | SynchronizedPointer instance to move from |
TypeErrorException | is thrown if dynamic_cast fails due to an incompatible type U . |
|
inline |
|
inlinenoexcept |
Returns the managed (locked) object.
ISynchronizedPointerLockable
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Move-assigns the LockableObject
from another SynchronizedPointer instance Other
to this instance. Other
becomes empty.
Other | SynchronizedPointer instance to move from |
|
inlinenoexcept |
|
inlinenoexcept |
|
private |