comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY > Class Template Reference
[Com type wrappers.Com type wrappers.]

#include <comet/handle.h>

Inheritance diagram for comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >:

Inheritance graph
[legend]
Collaboration diagram for comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef const C_ & ref
 A reference to a handle.

Public Member Functions

 auto_handle_wrap_t () throw ()
 default constructor.
 auto_handle_wrap_t (const impl::auto_attach_t< typename policy_base::value_type > &handle) throw ()
 auto_handle_wrap_t (auto_handle_wrap_t &rhs) throw ()
 auto_handle_wrap_t (policy_base &rhs) throw ()
 ~auto_handle_wrap_t () throw ()
template<typename EP> auto_handle_wrap_t< C_, H,
INVALID_HANDLE_, EP > & 
operator= (auto_handle_wrap_t< C_, H, INVALID_HANDLE_, EP > &rhs) throw ()
 Assignment from similar handles.
C_ & operator= (const impl::auto_attach_t< value_type > &handle)
 Assign by auto_attach.
bool close () throw ()
 Closes the currently held handle (if any).
Accessor methods
policy_base::value_type * out () throw ()
 Fitter method.
policy_base::value_type get () const throw ()
policy_base::value_type in () const throw ()
policy_base::value_type * inout () throw ()

Static Public Member Functions

const C_ & create_const_reference (const value_type &val)
C_ & create_reference (value_type &val)
bool destroy_reference (value_type H)
 Destroy a reference.

Protected Types

typedef handle_policy_base_t<
H, INVALID_HANDLE_ > 
policy_base

Protected Member Functions

void set_handle (value_type h) throw ()

Static Protected Member Functions

bool destroy_ (value_type h)
 Call destroy_handle.
bool destroy_handle (value_type h)
 Destroy the handle passed in.
bool expect_nonzero (BOOL value)

Detailed Description

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
class comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >

Wrapper for a Win32 API/GDI HANDLE. Behaves similarly to an auto_ptr in that it implements single-reference, reference counting, with reference-transferring assignment and copy-construction.


Constructor & Destructor Documentation

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::auto_handle_wrap_t const impl::auto_attach_t< typename policy_base::value_type > &  handle  )  throw () [inline]
 

Assign by auto_attach.

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::auto_handle_wrap_t auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY > &  rhs  )  throw () [inline]
 

Non-const copy constructor - takes control of the reference.

Parameters:
rhs Handle to detach from.

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::auto_handle_wrap_t policy_base rhs  )  throw () [inline]
 

Non-const copy constructor - takes control of the reference.

Parameters:
rhs Handle to detach from.

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::~auto_handle_wrap_t  )  throw () [inline]
 

Destructor - closes the handle.


Member Function Documentation

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
bool comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::destroy_handle value_type  h  )  [static, protected]
 

Destroy the handle passed in.

Must be implemented by the parent class.

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
template<typename EP>
auto_handle_wrap_t<C_, H, INVALID_HANDLE_, EP>& comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::operator= auto_handle_wrap_t< C_, H, INVALID_HANDLE_, EP > &  rhs  )  throw () [inline]
 

Assignment from similar handles.

Typically, there might be a different error policy.

template<typename C_, typename H, long INVALID_HANDLE_, typename ERROR_POLICY>
policy_base::value_type* comet::auto_handle_wrap_t< C_, H, INVALID_HANDLE_, ERROR_POLICY >::out  )  throw () [inline]
 

Fitter method.

Used when calling a function that take a HANDLE* argument.

                          auto_handle read_pipe, write_pipe;

                          CreatePipe(read_pipe.out(), write_pipe.out(), 0, 0));


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