46 using std::unique_ptr;
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)} { }
96 template<
class Y>
Handle& operator=(
shared_ptr<Y> && srr) { smPtr_ = move(srr);
return *
this; }
97 template<
class Y>
Handle& operator=(unique_ptr<Y> && urr) { smPtr_ = move(urr);
return *
this; }
100 explicit operator bool()
const {
return bool(smPtr_); }
101 bool isValid()
const {
return bool(smPtr_); }
110 template<
typename DEL>
114 smPtr_.reset (impl, whenDead);
130 smPtr_ = move (impl);
151 REQUIRE (smPtr_.get(),
"Lifecycle-Error");
152 return *(smPtr_.get());
Generic opaque reference counting handle, for accessing a service and managing its lifecycle...
Handle & activate(shared_ptr< IMP > const &impl)
another way of activating a handle by sharing ownership with an existing smart-ptr ...
Trigger the basic NoBug initialisation by placing a static variable.
Implementation namespace for support and library code.
Handle()=default
by default create an Null handle.
Handle(IMP *imp)
directly establish handle from an implementation, which typically way just heap allocated beforehand...
void close()
deactivate this handle, so it isn't tied any longer to the associated implementation or service objec...
Handle & activate(IMP *impl, DEL whenDead)
Activation of the handle by the managing service.