smartmontools SVN Rev 5419
Utility to control and monitor storage systems with "S.M.A.R.T."
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
any_device_auto_ptr< Dev > Class Template Reference

Smart pointer class for device pointers. More...

#include <dev_interface.h>

Collaboration diagram for any_device_auto_ptr< Dev >:
Collaboration graph
[legend]

Public Types

typedef Dev device_type
 

Public Member Functions

 any_device_auto_ptr (device_type *dev=0, smart_device *base_dev=0)
 Construct from optional pointer to device and optional pointer to base device. More...
 
 ~any_device_auto_ptr ()
 Destructor deletes device object. More...
 
void operator= (device_type *dev)
 Assign a new pointer. More...
 
void reset ()
 Delete device object and clear the pointer. More...
 
device_typerelease ()
 Return the pointer and release ownership. More...
 
void replace (device_type *dev)
 Replace the pointer. More...
 
device_typeget () const
 Return the pointer. More...
 
device_typeoperator* () const
 Pointer dereferencing. More...
 
device_typeoperator-> () const
 Pointer dereferencing. More...
 
 operator bool () const
 For (ptr != 0) check. More...
 
bool operator! () const
 For (ptr == 0) check. More...
 

Private Member Functions

void fail () const
 
 any_device_auto_ptr (const any_device_auto_ptr< Dev > &)
 
void operator= (const any_device_auto_ptr< Dev > &)
 

Private Attributes

device_typem_dev
 
smart_devicem_base_dev
 

Detailed Description

template<class Dev>
class any_device_auto_ptr< Dev >

Smart pointer class for device pointers.

Definition at line 721 of file dev_interface.h.

Member Typedef Documentation

◆ device_type

template<class Dev >
typedef Dev any_device_auto_ptr< Dev >::device_type

Definition at line 724 of file dev_interface.h.

Constructor & Destructor Documentation

◆ any_device_auto_ptr() [1/2]

template<class Dev >
any_device_auto_ptr< Dev >::any_device_auto_ptr ( device_type dev = 0,
smart_device base_dev = 0 
)
inlineexplicit

Construct from optional pointer to device and optional pointer to base device.

Definition at line 728 of file dev_interface.h.

◆ ~any_device_auto_ptr()

template<class Dev >
any_device_auto_ptr< Dev >::~any_device_auto_ptr ( )
inline

Destructor deletes device object.

Definition at line 733 of file dev_interface.h.

◆ any_device_auto_ptr() [2/2]

template<class Dev >
any_device_auto_ptr< Dev >::any_device_auto_ptr ( const any_device_auto_ptr< Dev > &  )
private

Member Function Documentation

◆ fail()

template<class Dev >
void any_device_auto_ptr< Dev >::fail ( ) const
inlineprivate

Definition at line 793 of file dev_interface.h.

◆ get()

template<class Dev >
device_type * any_device_auto_ptr< Dev >::get ( ) const
inline

Return the pointer.

Definition at line 770 of file dev_interface.h.

◆ operator bool()

template<class Dev >
any_device_auto_ptr< Dev >::operator bool ( ) const
inline

For (ptr != 0) check.

Definition at line 782 of file dev_interface.h.

◆ operator!()

template<class Dev >
bool any_device_auto_ptr< Dev >::operator! ( ) const
inline

For (ptr == 0) check.

Definition at line 786 of file dev_interface.h.

◆ operator*()

template<class Dev >
device_type & any_device_auto_ptr< Dev >::operator* ( ) const
inline

Pointer dereferencing.

Definition at line 774 of file dev_interface.h.

◆ operator->()

template<class Dev >
device_type * any_device_auto_ptr< Dev >::operator-> ( ) const
inline

Pointer dereferencing.

Definition at line 778 of file dev_interface.h.

◆ operator=() [1/2]

template<class Dev >
void any_device_auto_ptr< Dev >::operator= ( const any_device_auto_ptr< Dev > &  )
private

◆ operator=() [2/2]

template<class Dev >
void any_device_auto_ptr< Dev >::operator= ( device_type dev)
inline

Assign a new pointer.

Throws if a pointer is already assigned.

Definition at line 738 of file dev_interface.h.

◆ release()

template<class Dev >
device_type * any_device_auto_ptr< Dev >::release ( )
inline

Return the pointer and release ownership.

Definition at line 757 of file dev_interface.h.

◆ replace()

template<class Dev >
void any_device_auto_ptr< Dev >::replace ( device_type dev)
inline

Replace the pointer.

Used to call dev->autodetect_open().

Definition at line 766 of file dev_interface.h.

◆ reset()

template<class Dev >
void any_device_auto_ptr< Dev >::reset ( )
inline

Delete device object and clear the pointer.

Definition at line 746 of file dev_interface.h.

Member Data Documentation

◆ m_base_dev

template<class Dev >
smart_device* any_device_auto_ptr< Dev >::m_base_dev
private

Definition at line 791 of file dev_interface.h.

◆ m_dev

template<class Dev >
device_type* any_device_auto_ptr< Dev >::m_dev
private

Definition at line 790 of file dev_interface.h.


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