![]() |
Lumiera 0.pre.04
»edit your freedom«
|
#include "lib/handle.hpp"
Generic opaque reference counting handle, for accessing a service and managing its lifecycle.
Usually such a handle is created by an service interface and activated by setting up the link to a suitable hidden implementation object. This setup can only be done by a friend or derived class, //////////////////////////TODO: that was the intention. Why didn't this work out as expected? while client code is free to copy and store handle objects. Finally, any handle can be closed, thereby decrementing the use count.
Definition at line 63 of file handle.hpp.
Public Member Functions | |
| Handle ()=default | |
| by default create an Null handle. | |
| Handle (IMP *imp) | |
| directly establish handle from an implementation, which typically way just heap allocated beforehand. | |
| Handle (Handle const &r)=default | |
| Handle (Handle &&rr)=default | |
| template<class Y > | |
| Handle (shared_ptr< Y > const &r) | |
| template<class Y > | |
| Handle (shared_ptr< Y > &&srr) | |
| template<class Y > | |
| Handle (weak_ptr< Y > const &wr) | |
| template<class Y > | |
| Handle (unique_ptr< Y > &&urr) | |
| Handle & | operator= (Handle const &r)=default |
| Handle & | operator= (Handle &&rr)=default |
| template<class Y > | |
| Handle & | operator= (shared_ptr< Y > const &sr) |
| template<class Y > | |
| Handle & | operator= (shared_ptr< Y > &&srr) |
| template<class Y > | |
| Handle & | operator= (unique_ptr< Y > &&urr) |
| operator bool () const | |
| bool | isValid () const |
| template<typename DEL > | |
| Handle & | activate (IMP *impl, DEL whenDead) |
| Activation of the handle by the managing service. | |
| Handle & | activate (shared_ptr< IMP > const &impl) |
| another way of activating a handle by sharing ownership with an existing smart-ptr | |
| Handle & | activate (shared_ptr< IMP > &&impl) |
| void | close () |
| deactivate this handle, so it isn't tied any longer to the associated implementation or service object. | |
Protected Types | |
| typedef std::shared_ptr< IMP > | SmPtr |
Protected Member Functions | |
| IMP & | impl () const |
Protected Attributes | |
| SmPtr | smPtr_ |
|
default |
by default create an Null handle.
Typically this is followed by activating the handle by the managing service.
|
inlineexplicit |
directly establish handle from an implementation, which typically way just heap allocated beforehand.
Definition at line 82 of file handle.hpp.
Definition at line 88 of file handle.hpp.
Definition at line 89 of file handle.hpp.
Definition at line 90 of file handle.hpp.
Definition at line 91 of file handle.hpp.
|
protected |
Definition at line 66 of file handle.hpp.
Definition at line 95 of file handle.hpp.
References Handle< IMP >::smPtr_.
Definition at line 96 of file handle.hpp.
References Handle< IMP >::smPtr_.
Definition at line 97 of file handle.hpp.
References Handle< IMP >::smPtr_.
|
inlineexplicit |
Definition at line 100 of file handle.hpp.
References Handle< IMP >::smPtr_.
|
inline |
Definition at line 101 of file handle.hpp.
References Handle< IMP >::smPtr_.
Referenced by MORef< MO >::isValid().
Here is the caller graph for this function:Activation of the handle by the managing service.
| impl | the implementation object this handle is tied to |
| whenDead | functor to be invoked when reaching end-of-life |
| std::bad_alloc,in | which case whenDead(impl) is invoked |
Definition at line 112 of file handle.hpp.
References Handle< IMP >::impl(), and Handle< IMP >::smPtr_.
Referenced by OutputSlotImplBase::ConnectionManager< CON >::connectOutputSink(), and ProcessTable::establishProcess().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
another way of activating a handle by sharing ownership with an existing smart-ptr
Definition at line 121 of file handle.hpp.
References Handle< IMP >::impl(), and Handle< IMP >::smPtr_.
Here is the call graph for this function:
|
inline |
Definition at line 128 of file handle.hpp.
References Handle< IMP >::impl(), and Handle< IMP >::smPtr_.
Here is the call graph for this function:
|
inline |
deactivate this handle, so it isn't tied any longer to the associated implementation or service object.
When all handles have either been deactivated or went out of scope, the associated implementation reaches end-of-life.
Definition at line 140 of file handle.hpp.
References Handle< IMP >::smPtr_.
Referenced by MObjectRef_test::checkComparison(), MObjectRef_test::checkLifecycle(), MObjectRef_test::checkTypeHandling(), SpecialJobFun::SpecialExecutor< FUN >::invokeJobOperation(), and DummyPlayConnection_test::verify_simulatedPlayback().
Here is the caller graph for this function:
|
inlineprotected |
Definition at line 149 of file handle.hpp.
References Handle< IMP >::smPtr_.
Referenced by Handle< IMP >::activate(), Handle< IMP >::activate(), and Handle< IMP >::activate().
Here is the caller graph for this function:
|
protected |
Definition at line 68 of file handle.hpp.
Referenced by Handle< IMP >::activate(), Handle< IMP >::activate(), Handle< IMP >::activate(), Handle< IMP >::close(), Handle< IMP >::impl(), Handle< IMP >::isValid(), Handle< IMP >::operator bool(), Handle< IMP >::operator=(), Handle< IMP >::operator=(), and Handle< IMP >::operator=().
Inheritance diagram for Handle< IMP >:
Collaboration diagram for Handle< IMP >: