DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Holds a shared_ptr to a resource (instance of class Object
) and lets the resource keep track of its usage count by increasing a respective counter of the resource on construction and by decreasing the counter on destruction of the LinkedObjectWrapper
instance again. Not copyable in order not to mess up the usage counter stored in LinkedObjectWrapper::DestinyResource. Only accessed via a thread's instance of class RunnableInstance
in that thread. Also refer to RunnableInstance
.
More...
Public Types | |
using | ObjectType = std::add_const_t< ObjectT > |
Const type of the managed Object . More... | |
Public Member Functions | |
LinkedObjectWrapper (const RunnableInstance &Owner, std::shared_ptr< ObjectType > &&DestinyResource, const std::chrono::milliseconds Timeout) | |
Constructs a LinkedObjectWrapper instance and calls LinkedObjectWrapper::Register(). More... | |
virtual | ~LinkedObjectWrapper () |
Destructor calls LinkedObjectWrapper::Deregister(). More... | |
virtual bool | IsRegistered () const noexcept override |
Returns whether the wrapper has registered its owning Object instance (through Owner) as a user of the target resource (refer to LinkedObjectWrapper::DestinyResource). More... | |
std::string | GetLinkedObjectDesc () const |
Builds and returns a human-readable string uniquely identifying the Object instance DestinyResource. The function does not perform a check whether the owning Object instance has been registered (i.e. IsRegisteredFlag is true). More... | |
decltype(auto) | get () const |
Getter for the target resource which is used by the owning Object instance. More... | |
decltype(auto) | get () |
Getter for the target resource which is used by the owning Object instance. More... | |
const auto & | operator* () const |
Dereferencing getter. More... | |
auto & | operator* () |
const auto | operator-> () const |
Getter for the target resource which is used by the owning Object instance. More... | |
auto | operator-> () |
Getter for the target resource which is used by the owning Object instance. More... | |
Public Member Functions inherited from DynExp::LinkedObjectWrapperBase | |
LinkedObjectWrapperBase (const RunnableInstance &Owner) | |
Constructs a LinkedObjectWrapperBase instance. More... | |
virtual | ~LinkedObjectWrapperBase ()=0 |
const Object & | GetOwner () const noexcept |
Returns the owner of this wrapper. More... | |
Public Member Functions inherited from Util::INonCopyable | |
INonCopyable (const INonCopyable &)=delete | |
INonCopyable & | operator= (const INonCopyable &)=delete |
Private Member Functions | |
virtual void | Register (const std::chrono::milliseconds Timeout) override |
Registers the wrapper's owning Object instance (through Owner) as a user of the target resource (refer to LinkedObjectWrapper::DestinyResource). More... | |
virtual void | Deregister (const std::chrono::milliseconds Timeout) override |
Deregisters the wrapper's owning Object instance (through Owner) as a user of the target resource (refer to LinkedObjectWrapper::DestinyResource). More... | |
Private Attributes | |
const std::shared_ptr< ObjectType > | DestinyResource |
Target resource which is used by the Object instance LinkedObjectWrapperBase::Owner belongs to. More... | |
bool | IsRegisteredFlag |
Indicates whether the wrapper has registered its owning Object instance (through LinkedObjectWrapperBase::Owner) as a user of the target resource DestinyResource. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Util::INonCopyable | |
constexpr | INonCopyable ()=default |
~INonCopyable ()=default | |
Holds a shared_ptr to a resource (instance of class Object
) and lets the resource keep track of its usage count by increasing a respective counter of the resource on construction and by decreasing the counter on destruction of the LinkedObjectWrapper
instance again. Not copyable in order not to mess up the usage counter stored in LinkedObjectWrapper::DestinyResource. Only accessed via a thread's instance of class RunnableInstance
in that thread. Also refer to RunnableInstance
.
ObjectT | Type of the managed Object . |
using DynExp::LinkedObjectWrapper< ObjectT >::ObjectType = std::add_const_t<ObjectT> |
|
inline |
Constructs a LinkedObjectWrapper
instance and calls LinkedObjectWrapper::Register().
Owner | Refer to LinkedObjectWrapperBase::Owner. |
DestinyResource | Refer to DestinyResource. |
Timeout | Timeout of the mutex-locking operation in ObjectUserList |
|
inlinevirtual |
Destructor calls LinkedObjectWrapper::Deregister().
|
inlineoverrideprivatevirtual |
Deregisters the wrapper's owning Object
instance (through Owner) as a user of the target resource (refer to LinkedObjectWrapper::DestinyResource).
Timeout | Timeout of the mutex-locking operation in ObjectUserList |
Implements DynExp::LinkedObjectWrapperBase.
|
inline |
Getter for the target resource which is used by the owning Object
instance.
Util::InvalidStateException | is thrown if the owning Object instance has not been registered (i.e. IsRegisteredFlag is false). Dereferencing getter. Getter for the target resource which is used by the owning Object instance. |
Util::InvalidStateException | is thrown if the owning Object instance has not been registered (i.e. IsRegisteredFlag is false). |
|
inline |
Getter for the target resource which is used by the owning Object
instance.
Util::InvalidStateException | is thrown if the owning Object instance has not been registered (i.e. IsRegisteredFlag is false). |
|
inline |
Builds and returns a human-readable string uniquely identifying the Object
instance DestinyResource. The function does not perform a check whether the owning Object
instance has been registered (i.e. IsRegisteredFlag is true).
|
inlineoverridevirtualnoexcept |
Returns whether the wrapper has registered its owning Object
instance (through Owner) as a user of the target resource (refer to LinkedObjectWrapper::DestinyResource).
Implements DynExp::LinkedObjectWrapperBase.
|
inline |
|
inline |
Dereferencing getter.
Getter for the target resource which is used by the owning Object
instance.
Util::InvalidStateException | is thrown if the owning Object instance has not been registered (i.e. IsRegisteredFlag is false). |
|
inline |
Getter for the target resource which is used by the owning Object
instance.
Util::InvalidStateException | is thrown if the owning Object instance has not been registered (i.e. IsRegisteredFlag is false). |
|
inline |
Getter for the target resource which is used by the owning Object
instance.
Util::InvalidStateException | is thrown if the owning Object instance has not been registered (i.e. IsRegisteredFlag is false). |
|
inlineoverrideprivatevirtual |
Registers the wrapper's owning Object
instance (through Owner) as a user of the target resource (refer to LinkedObjectWrapper::DestinyResource).
Timeout | Timeout of the mutex-locking operation in ObjectUserList |
Implements DynExp::LinkedObjectWrapperBase.
|
private |
Target resource which is used by the Object
instance LinkedObjectWrapperBase::Owner belongs to.
|
private |
Indicates whether the wrapper has registered its owning Object
instance (through LinkedObjectWrapperBase::Owner) as a user of the target resource DestinyResource.