Small smart pointer class with automatic reference counting for IInterface.
More...
#include <GaudiKernel/SmartIF.h>
template<class T>
class SmartIF< T >
Small smart pointer class with automatic reference counting for IInterface.
SmartIF simplifies the interaction with components in Gaudi by implementing an automatic reference counting and the casting (via IInterface::queryInterface).
- Author
- Markus Frank
-
Sebastien Ponce
-
Marco Clemencic
Definition at line 14 of file IConverter.h.
Default constructor.
Definition at line 26 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
Standard constructor from pointer.
Definition at line 28 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class T>
template<class OTHER >
Standard constructor from any (IInterface-derived) pointer.
Definition at line 33 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Copy constructor.
Definition at line 37 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
TYPE * get() const
Get interface pointer.
template<class T>
template<class T >
Constructor from another SmartIF, with a different type.
- Note
- it cannot replace the copy constructor.
Definition at line 43 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
TYPE * get() const
Get interface pointer.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Standard Destructor.
Definition at line 47 of file SmartIF.h.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Get interface pointer.
Definition at line 62 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class T>
bool SmartIF< T >::isValid |
( |
| ) |
const |
|
inline |
Allow for check if smart pointer is valid.
Definition at line 51 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class T>
SmartIF< T >::operator TYPE * |
( |
| ) |
const |
|
inline |
Automatic conversion to pointer.
It is also used by the compiler for automatic conversion to boolean.
Definition at line 56 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class T>
TYPE& SmartIF< T >::operator* |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 60 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class T>
TYPE* SmartIF< T >::operator-> |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 58 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
Assignment operator from IInterface pointer.
It allows things like SmartIF<T> x; x = 0;
Definition at line 104 of file SmartIF.h.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Assignment operator.
Definition at line 109 of file SmartIF.h.
TYPE * get() const
Get interface pointer.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
template<class T>
template<class T >
Assignment operator from a different SmartIF.
- Note
- it cannot replace the assignment operator.
Definition at line 116 of file SmartIF.h.
TYPE * get() const
Get interface pointer.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Get reference to the pointer.
Definition at line 65 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class T>
void SmartIF< T >::reset |
( |
TYPE * |
ptr = 0 | ) |
|
|
inline |
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.
TYPE * m_interface
Pointer to the instance.
template<class T>
template<class OTHER >
void SmartIF< T >::reset |
( |
OTHER * |
ptr | ) |
|
|
inline |
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.
88 if (static_cast<IInterface*>(ptr) == static_cast<IInterface*>(
m_interface))
return;
91 ptr->queryInterface(TYPE::interfaceID(), pp_cast<void>(&
m_interface)).ignore();
TYPE * m_interface
Pointer to the instance.
Pointer to the instance.
Definition at line 22 of file SmartIF.h.
The documentation for this class was generated from the following files: