Small smart pointer class with automatic reference counting for IInterface.
More...
#include <GaudiKernel/SmartIF.h>
template<class TYPE>
class SmartIF< TYPE >
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 15 of file IConverter.h.
Standard constructor from pointer.
Definition at line 30 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
template<class OTHER >
Standard constructor from any (IInterface-derived) pointer.
Definition at line 36 of file SmartIF.h.
38 if ( ptr )
reset( ptr );
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Copy constructor.
Definition at line 41 of file SmartIF.h.
TYPE * get() const
Get interface pointer.
TYPE * m_interface
Pointer to the instance.
Move constructor.
Definition at line 46 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
template<class T >
Constructor from another SmartIF, with a different type.
- Note
- it cannot replace the copy constructor.
Definition at line 59 of file SmartIF.h.
TYPE * get() const
Get interface pointer.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Standard Destructor.
Definition at line 64 of file SmartIF.h.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
template<class TYPE>
template<typename IFace >
return a new SmartIF instance to another interface
Definition at line 115 of file SmartIF.h.
Small smart pointer class with automatic reference counting for IInterface.
template<class TYPE>
TYPE* SmartIF< TYPE >::get |
( |
| ) |
const |
|
inline |
Get interface pointer.
Definition at line 82 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
bool SmartIF< TYPE >::isValid |
( |
| ) |
const |
|
inline |
Allow for check if smart pointer is valid.
Definition at line 68 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
SmartIF< TYPE >::operator bool |
( |
| ) |
const |
|
inlineexplicit |
Definition at line 70 of file SmartIF.h.
bool isValid() const
Allow for check if smart pointer is valid.
template<class TYPE>
SmartIF< TYPE >::operator TYPE * |
( |
| ) |
const |
|
inline |
Automatic conversion to pointer.
It is also used by the compiler for automatic conversion to boolean.
Definition at line 76 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
bool SmartIF< TYPE >::operator! |
( |
| ) |
const |
|
inline |
Definition at line 71 of file SmartIF.h.
bool isValid() const
Allow for check if smart pointer is valid.
template<class TYPE>
TYPE& SmartIF< TYPE >::operator* |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 80 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
TYPE* SmartIF< TYPE >::operator-> |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 78 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
Move assignement.
Definition at line 48 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 127 of file SmartIF.h.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Assignment operator.
Definition at line 133 of file SmartIF.h.
TYPE * get() const
Get interface pointer.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
template<class TYPE>
template<class T >
Assignment operator from a different SmartIF.
- Note
- it cannot replace the assignment operator.
Definition at line 141 of file SmartIF.h.
TYPE * get() const
Get interface pointer.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Get reference to the pointer.
Definition at line 85 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
void SmartIF< TYPE >::reset |
( |
TYPE * |
ptr = nullptr | ) |
|
|
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 92 of file SmartIF.h.
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
template<class OTHER >
void SmartIF< TYPE >::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 102 of file SmartIF.h.
104 if ( static_cast<IInterface*>( ptr ) == static_cast<IInterface*>(
m_interface ) )
return;
107 ptr->queryInterface( TYPE::interfaceID(), pp_cast<void>( &
m_interface ) ).ignore();
TYPE * m_interface
Pointer to the instance.
template<class TYPE>
TYPE* SmartIF< TYPE >::m_interface = nullptr |
|
private |
Pointer to the instance.
Definition at line 23 of file SmartIF.h.
The documentation for this class was generated from the following files: