45 using std::shared_ptr;
46 using std::unique_ptr;
66 typedef std::shared_ptr<IMP>
SmPtr;
88 template<
class Y>
explicit Handle (shared_ptr<Y>
const& r) :
smPtr_{r} { }
89 template<
class Y>
explicit Handle (shared_ptr<Y> && srr) :
smPtr_{move(srr)} { }
90 template<
class Y>
explicit Handle (weak_ptr<Y>
const& wr) :
smPtr_{wr} { }
91 template<
class Y>
explicit Handle (unique_ptr<Y> && urr) :
smPtr_{move(urr)} { }
100 explicit operator bool()
const {
return bool(
smPtr_); }
110 template<
typename DEL>
151 REQUIRE (
smPtr_.get(),
"Lifecycle-Error");
Generic opaque reference counting handle, for accessing a service and managing its lifecycle.
Handle(weak_ptr< Y > const &wr)
Handle(IMP *imp)
directly establish handle from an implementation, which typically way just heap allocated beforehand.
Handle(Handle const &r)=default
Handle(unique_ptr< Y > &&urr)
void close()
deactivate this handle, so it isn't tied any longer to the associated implementation or service objec...
Handle & operator=(Handle &&rr)=default
Handle(shared_ptr< Y > &&srr)
std::shared_ptr< IMP > SmPtr
Handle & operator=(unique_ptr< Y > &&urr)
Handle & operator=(shared_ptr< Y > &&srr)
Handle(Handle &&rr)=default
Handle & operator=(shared_ptr< Y > const &sr)
Handle()=default
by default create an Null handle.
Handle & activate(shared_ptr< IMP > &&impl)
Handle & operator=(Handle const &r)=default
Handle(shared_ptr< Y > const &r)
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
Implementation namespace for support and library code.
Trigger the basic NoBug initialisation by placing a static variable.