Lumiera  0.pre.03
»edit your freedom«
handle.hpp File Reference

Go to the source code of this file.

Description

A generic opaque handle to an implementation entity, including lifecycle management.

The intended use is for some public interface to return such a handle to track the lifecycle or registration of a dedicated service created for this call. The handle is implemented as refcounting smart-ptr on top of shared_ptr, which especially means for the client code that the handle has value semantics, can be copied and stored, while the referred service will stay alive as long as there is still an handle in use. A handle may be empty ("null handle") or closed; the latter also decreases the ref count and can be used to close a service explicitly.

Possibly a service may use an extension of the handle template carrying dedicated API functions. In this case, the handle acts like a PImpl; the actual definition of the implementation class the handle points at is necessary only in the translation unit implementing such an extended handle.

See also
steam::control::Command usage example

Definition in file handle.hpp.

#include "lib/nobug-init.hpp"
#include <memory>
#include <utility>

Classes

class  Handle< IMP >
 Generic opaque reference counting handle, for accessing a service and managing its lifecycle. More...
 

Namespaces

 lib
 Implementation namespace for support and library code.