Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Handle< IMP > Class Template Reference

#include "lib/handle.hpp"

Description

template<class IMP>
class lib::Handle< IMP >

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 72 of file handle.hpp.

Public Member Functions

 Handle ()
 by default create an Null handle. More...
 
 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)
 
template<typename DEL >
Handleactivate (IMP *impl, DEL whenDead)
 Activation of the handle by the managing service. More...
 
Handleactivate (shared_ptr< IMP > const &impl)
 another way of activating a handle by sharing ownership with an existing smart-ptr More...
 
Handleactivate (shared_ptr< IMP > &&impl)
 
void close ()
 deactivate this handle, so it isn't tied any longer to the associated implementation or service object. More...
 
bool isValid () const
 
 operator bool () const
 
Handleoperator= (Handle const &r)=default
 
Handleoperator= (Handle &&rr)=default
 
template<class Y >
Handleoperator= (shared_ptr< Y > const &sr)
 
template<class Y >
Handleoperator= (shared_ptr< Y > &&srr)
 
template<class Y >
Handleoperator= (unique_ptr< Y > &&urr)
 

Protected Types

typedef std::shared_ptr< IMP > SmPtr
 

Protected Member Functions

IMP & impl () const
 

Protected Attributes

SmPtr smPtr_
 

Member Typedef Documentation

typedef std::shared_ptr<IMP> SmPtr
protected

Definition at line 75 of file handle.hpp.

Constructor & Destructor Documentation

Handle ( )
inline

by default create an Null handle.

Typically this is followed by activating the handle by the managing service.

Definition at line 85 of file handle.hpp.

Handle ( Handle< IMP > const &  r)
default
Handle ( Handle< IMP > &&  rr)
default
Handle ( shared_ptr< Y > const &  r)
inlineexplicit

Definition at line 91 of file handle.hpp.

Handle ( shared_ptr< Y > &&  srr)
inlineexplicit

Definition at line 92 of file handle.hpp.

Handle ( weak_ptr< Y > const &  wr)
inlineexplicit

Definition at line 93 of file handle.hpp.

Handle ( unique_ptr< Y > &&  urr)
inlineexplicit

Definition at line 94 of file handle.hpp.

Member Function Documentation

Handle& operator= ( Handle< IMP > const &  r)
default
Handle& operator= ( Handle< IMP > &&  rr)
default
Handle& operator= ( shared_ptr< Y > const &  sr)
inline

Definition at line 98 of file handle.hpp.

Handle& operator= ( shared_ptr< Y > &&  srr)
inline

Definition at line 99 of file handle.hpp.

Handle& operator= ( unique_ptr< Y > &&  urr)
inline

Definition at line 100 of file handle.hpp.

operator bool ( ) const
inlineexplicit

Definition at line 103 of file handle.hpp.

bool isValid ( ) const
inline

Definition at line 104 of file handle.hpp.

Referenced by Command::defined(), CommandUse1_test::undef(), and CommandInstanceManager_test::verify_instanceIdentity().

+ Here is the caller graph for this function:

Handle& activate ( IMP *  impl,
DEL  whenDead 
)
inline

Activation of the handle by the managing service.

Parameters
implthe implementation object this handle is tied to
whenDeadfunctor to be invoked when reaching end-of-life
Exceptions
std::bad_alloc,inwhich case whenDead(impl) is invoked

Definition at line 115 of file handle.hpp.

Referenced by OutputSlotImplBase::ConnectionManager< CON >::connectOutputSink(), ProcessImpl::createHandle(), ProcessTable::establishProcess(), and Proxy< IHandle >::getHandle().

+ Here is the caller graph for this function:

Handle& activate ( shared_ptr< IMP > const &  impl)
inline

another way of activating a handle by sharing ownership with an existing smart-ptr

Definition at line 124 of file handle.hpp.

Handle& activate ( shared_ptr< IMP > &&  impl)
inline

Definition at line 131 of file handle.hpp.

void close ( )
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 143 of file handle.hpp.

Referenced by CommandRegistry_test::checkRegistration(), and PlaybackController::stop().

+ Here is the caller graph for this function:

IMP& impl ( ) const
inlineprotected

Definition at line 149 of file handle.hpp.

Referenced by Handle< OutputSlot::Connection >::activate(), Command::equivalentImpl(), proc::control::operator<(), and proc::control::operator==().

+ Here is the caller graph for this function:

Member Data Documentation

SmPtr smPtr_
protected

Definition at line 77 of file handle.hpp.

+ Inheritance diagram for Handle< IMP >:
+ Collaboration diagram for Handle< IMP >:

The documentation for this class was generated from the following file: