|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |
#include <GaudiKernel/SmartIF.h>

Public Member Functions | |
| SmartIF () | |
| Default constructor. | |
| SmartIF (TYPE *ptr) | |
| Standard constructor from pointer. | |
| template<class OTHER> | |
| SmartIF (OTHER *ptr) | |
| Standard constructor from any (IInterface-derived) pointer. | |
| SmartIF (const SmartIF &rhs) | |
| Copy constructor. | |
| template<class T> | |
| SmartIF (const SmartIF< T > &rhs) | |
| Constructor from another SmartIF, with a different type. | |
| ~SmartIF () | |
| Standard Destructor. | |
| bool | isValid () const |
| Allow for check if smart pointer is valid. | |
| operator TYPE * () const | |
| Automatic conversion to pointer. | |
| TYPE * | operator-> () const |
| Dereference operator. | |
| TYPE & | operator* () const |
| Dereference operator. | |
| TYPE * | get () const |
| Get interface pointer. | |
| TYPE *& | pRef () |
| Get reference to the pointer. | |
| void | reset (TYPE *ptr=0) |
| Set the internal pointer to the passed one disposing of the old one. | |
| template<class OTHER> | |
| void | reset (OTHER *ptr) |
| Set the internal pointer to the passed one disposing of the old one. | |
| SmartIF & | operator= (IInterface *ptr) |
| Assignment operator from IInterface pointer. | |
| SmartIF & | operator= (const SmartIF &rhs) |
| Assignment operator. | |
| template<class T> | |
| SmartIF & | operator= (const SmartIF< T > &rhs) |
| Assignment operator from a different SmartIF. | |
Private Attributes | |
| TYPE * | m_interface |
| Pointer to the instance. | |
SmartIF simplifies the interaction with components in Gaudi by implementing an automatic reference counting and the casting (via IInterface::queryInterface).
Definition at line 19 of file SmartIF.h.
Standard constructor from pointer.
Definition at line 28 of file SmartIF.h.
00028 : m_interface(ptr) { 00029 if (m_interface) m_interface->addRef(); 00030 }
Standard constructor from any (IInterface-derived) pointer.
Definition at line 33 of file SmartIF.h.
00033 : m_interface(0) { 00034 if (ptr) reset(ptr); 00035 }
Copy constructor.
Definition at line 37 of file SmartIF.h.
00037 : m_interface(rhs.get()) { 00038 if (m_interface) m_interface->addRef(); 00039 }
Allow for check if smart pointer is valid.
Definition at line 51 of file SmartIF.h.
00051 { return m_interface != 0; }
Automatic conversion to pointer.
It is also used by the compiler for automatic conversion to boolean.
Definition at line 56 of file SmartIF.h.
00056 { return m_interface; }
Get reference to the pointer.
Definition at line 65 of file SmartIF.h.
00065 { 00066 return m_interface; 00067 }
Set the internal pointer to the passed one disposing of the old one.
Version for pointers of the same type of the managed ones (no call to queryInterface needed).
Definition at line 74 of file SmartIF.h.
00074 { 00075 if (ptr == m_interface) return; 00076 if (m_interface) m_interface->release(); 00077 if (ptr) { 00078 m_interface = ptr; 00079 m_interface->addRef(); 00080 } else { 00081 m_interface = 0; 00082 } 00083 }
Set the internal pointer to the passed one disposing of the old one.
Version for pointers of types inheriting from IInterface.
Definition at line 87 of file SmartIF.h.
00087 { 00088 if (static_cast<IInterface*>(ptr) == static_cast<IInterface*>(m_interface)) return; 00089 if (m_interface) m_interface->release(); 00090 if (ptr) { 00091 ptr->queryInterface(TYPE::interfaceID(), pp_cast<void>(&m_interface)).ignore(); 00092 } else { 00093 m_interface = 0; 00094 } 00095 }
| SmartIF& SmartIF< TYPE >::operator= | ( | IInterface * | ptr | ) | [inline] |
Assignment operator from IInterface pointer.
It allows things like SmartIF<T> x; x = 0;
Definition at line 104 of file SmartIF.h.
00104 { 00105 reset(ptr); 00106 return *this; 00107 }
TYPE* SmartIF< TYPE >::m_interface [private] |