#include <SmartIF.h>
Inheritance diagram for SmartIF< IInterface >:
Public Types | |
typedef IInterface | TYPE |
Public Member Functions | |
SmartIF (const SmartIF< IInterface > ©) | |
Copy constructor. | |
SmartIF (IInterface *iface=0) | |
Standard constructor with initialisation. | |
template<class T> | |
SmartIF (const SmartIF< T > &right) | |
Constructor from other SmartIF. | |
virtual | ~SmartIF () |
Standard Destructor. | |
template<class T> | |
SmartIF< TYPE > & | operator= (const SmartIF< T > &iface) |
Copy assignment operator with conversion to requested interface type. | |
SmartIF< TYPE > & | operator= (const SmartIF< TYPE > &iface) |
Copy assignment operator. | |
SmartIF< TYPE > & | operator= (TYPE *iface) |
Assignment operator. | |
bool | operator! () const |
check the validity of the interface | |
bool | isValid () const |
Allow for check if smart pointer is valid. | |
operator IInterface * () | |
Automatic conversion to constined interface type. | |
operator const IInterface * () const | |
Automatic conversion to constined interface type (CONST). | |
bool | operator!= (const IInterface *test) const |
Check for non-equality. | |
bool | operator== (const IInterface *test) const |
Check for equality. | |
IInterface * | operator-> () |
Dereference operator. | |
const IInterface * | operator-> () const |
Dereference operator (CONST). | |
void ** | operator & () |
Allow for use as void pointer. | |
const IInterface * | get () |
Get reference to interface pointer. | |
IInterface *& | pRef () |
Get reference to interface pointer. | |
const IInterface *const & | pRef () const |
Get reference to interface pointer (CONST). | |
Protected Member Functions | |
void | releaseInterface () |
Release interface. | |
Protected Attributes | |
const InterfaceID | m_iid |
IInterface * | m_interface |
Description: The smart pointer to IInterface is a little bit special, mainly because the IInterface is contained in any other interface. Hence, the exported methodes are only a subset of the generic template.
Base Class: SmartIFBase<TYPE>
History :
+---------+----------------------------------------------+--------+ | Date | Comment | Who | +---------+----------------------------------------------+--------+ | 30/10/99| Initial version. | MF | +---------+----------------------------------------------+--------+Author: M.Frank Version: 1.0
Definition at line 228 of file SmartIF.h.
typedef IInterface SmartIF< IInterface >::TYPE |
SmartIF< IInterface >::SmartIF | ( | const SmartIF< IInterface > & | copy | ) | [inline] |
Copy constructor.
Definition at line 232 of file SmartIF.h.
00233 : SmartIFBase<IInterface>(copy.m_iid) 00234 { 00235 SmartIF<TYPE>::operator=(copy.m_interface); 00236 }
SmartIF< IInterface >::SmartIF | ( | IInterface * | iface = 0 |
) | [inline] |
Standard constructor with initialisation.
Definition at line 238 of file SmartIF.h.
00239 : SmartIFBase<IInterface>(IID_IInterface) 00240 { 00241 SmartIF<TYPE>::operator=(iface); 00242 }
SmartIF< IInterface >::SmartIF | ( | const SmartIF< T > & | right | ) | [inline] |
Constructor from other SmartIF.
Definition at line 245 of file SmartIF.h.
00246 : SmartIFBase<IInterface>(IID_IInterface) 00247 { 00248 SmartIF<TYPE>::operator=(right.m_interface); 00249 }
virtual SmartIF< IInterface >::~SmartIF | ( | ) | [inline, virtual] |
SmartIF<TYPE>& SmartIF< IInterface >::operator= | ( | const SmartIF< T > & | iface | ) | [inline] |
Copy assignment operator with conversion to requested interface type.
Definition at line 255 of file SmartIF.h.
00256 { 00257 T* ptr = iface.m_interface ; 00258 if ( (void*)ptr != (void*)this->m_interface ) { 00259 TYPE* newIF = 0; 00260 if ( ptr != 0 ) { 00261 ptr->queryInterface(this->m_iid, (void**)&newIF).ignore(); 00262 } 00263 this->releaseInterface(); 00264 this->m_interface = newIF; 00265 } 00266 return *this; 00267 }
Copy assignment operator.
Definition at line 269 of file SmartIF.h.
00269 { 00270 TYPE* newIF = iface.m_interface ; 00271 return (*this)=newIF ; 00272 }
SmartIF<TYPE>& SmartIF< IInterface >::operator= | ( | TYPE * | iface | ) | [inline] |
Assignment operator.
Definition at line 274 of file SmartIF.h.
00274 { 00275 if ( iface != m_interface ) { 00276 if ( iface != 0 ) { 00277 iface->addRef(); 00278 } 00279 releaseInterface(); 00280 m_interface = iface; 00281 } 00282 return *this; 00283 }
bool SmartIF< IInterface >::operator! | ( | ) | const [inline] |
check the validity of the interface
Reimplemented from SmartIFBase< IInterface >.
Definition at line 285 of file SmartIF.h.
00285 { return !(this->isValid()) ; }
void SmartIFBase< IInterface >::releaseInterface | ( | ) | [inline, protected, inherited] |
Release interface.
Definition at line 36 of file SmartIF.h.
00036 { 00037 if ( m_interface ) m_interface->release(); 00038 m_interface = 0; 00039 }
bool SmartIFBase< IInterface >::isValid | ( | ) | const [inline, inherited] |
Allow for check if smart pointer is valid.
Definition at line 49 of file SmartIF.h.
00049 { 00050 return ( 0 != m_interface ); 00051 }
SmartIFBase< IInterface >::operator IInterface * | ( | ) | [inline, inherited] |
Automatic conversion to constined interface type.
Definition at line 53 of file SmartIF.h.
00053 { 00054 return m_interface; 00055 }
SmartIFBase< IInterface >::operator const IInterface * | ( | ) | const [inline, inherited] |
Automatic conversion to constined interface type (CONST).
Definition at line 57 of file SmartIF.h.
00057 { 00058 return m_interface; 00059 }
bool SmartIFBase< IInterface >::operator!= | ( | const IInterface * | test | ) | const [inline, inherited] |
Check for non-equality.
Definition at line 61 of file SmartIF.h.
00061 { 00062 return test != m_interface; 00063 }
bool SmartIFBase< IInterface >::operator== | ( | const IInterface * | test | ) | const [inline, inherited] |
Check for equality.
Definition at line 65 of file SmartIF.h.
00065 { 00066 return test == m_interface; 00067 }
IInterface * SmartIFBase< IInterface >::operator-> | ( | ) | [inline, inherited] |
Dereference operator.
Definition at line 69 of file SmartIF.h.
00069 { 00070 return m_interface; 00071 }
const IInterface * SmartIFBase< IInterface >::operator-> | ( | ) | const [inline, inherited] |
Dereference operator (CONST).
Definition at line 73 of file SmartIF.h.
00073 { 00074 return m_interface; 00075 }
void** SmartIFBase< IInterface >::operator & | ( | ) | [inline, inherited] |
Allow for use as void pointer.
Definition at line 77 of file SmartIF.h.
00077 { 00078 return (void**) &m_interface; 00079 }
const IInterface * SmartIFBase< IInterface >::get | ( | ) | [inline, inherited] |
Get reference to interface pointer.
Definition at line 81 of file SmartIF.h.
00081 { 00082 return m_interface; 00083 }
IInterface *& SmartIFBase< IInterface >::pRef | ( | ) | [inline, inherited] |
Get reference to interface pointer.
Definition at line 85 of file SmartIF.h.
00085 { 00086 return this->m_interface; 00087 }
const IInterface * const& SmartIFBase< IInterface >::pRef | ( | ) | const [inline, inherited] |
Get reference to interface pointer (CONST).
Definition at line 89 of file SmartIF.h.
00089 { 00090 return this->m_interface; 00091 }
const InterfaceID SmartIFBase< IInterface >::m_iid [protected, inherited] |
IInterface * SmartIFBase< IInterface >::m_interface [protected, inherited] |