55 using std::unique_ptr;
99 template<
class Y>
explicit Handle (weak_ptr<Y>
const& wr) : smPtr_{wr} { }
100 template<
class Y>
explicit Handle (unique_ptr<Y> && urr) : smPtr_{move(urr)} { }
104 template<
class Y>
Handle& operator=(
shared_ptr<Y> const& sr) { smPtr_ = sr;
return *
this; }
105 template<
class Y>
Handle& operator=(
shared_ptr<Y> && srr) { smPtr_ = move(srr);
return *
this; }
106 template<
class Y>
Handle& operator=(unique_ptr<Y> && urr) { smPtr_ = move(urr);
return *
this; }
109 explicit operator bool()
const {
return bool(smPtr_); }
110 bool isValid()
const {
return bool(smPtr_); }
119 template<
typename DEL>
123 smPtr_.reset (impl, whenDead);
139 smPtr_ = move (impl);
160 REQUIRE (smPtr_.get(),
"Lifecycle-Error");
161 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.