#include <GaudiKernel/SmartIF.h>
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 25 of file IConverter.h.
◆ SmartIF() [1/6]
◆ SmartIF() [2/6]
SmartIF::SmartIF |
( |
TYPE * |
ptr | ) |
|
|
inline |
Standard constructor from pointer.
Definition at line 39 of file SmartIF.h.
◆ SmartIF() [3/6]
template<class OTHER >
SmartIF::SmartIF |
( |
OTHER * |
ptr | ) |
|
|
inline |
Standard constructor from any (IInterface-derived) pointer.
Definition at line 44 of file SmartIF.h.
45 if ( ptr )
reset( ptr );
◆ SmartIF() [4/6]
SmartIF::SmartIF |
( |
const SmartIF & |
rhs | ) |
|
|
inline |
Copy constructor.
Definition at line 48 of file SmartIF.h.
◆ SmartIF() [5/6]
Move constructor.
Definition at line 52 of file SmartIF.h.
◆ SmartIF() [6/6]
template<class T >
SmartIF::SmartIF |
( |
const SmartIF< T > & |
rhs | ) |
|
|
inlineexplicit |
Constructor from another SmartIF, with a different type.
- Note
- it cannot replace the copy constructor.
Definition at line 64 of file SmartIF.h.
◆ ~SmartIF()
Standard Destructor.
Definition at line 68 of file SmartIF.h.
◆ as()
template<typename IFace >
SmartIF<IFace> SmartIF::as |
( |
| ) |
const |
|
inline |
◆ get()
TYPE* SmartIF::get |
( |
| ) |
const |
|
inline |
Get interface pointer.
Definition at line 86 of file SmartIF.h.
◆ isValid()
bool SmartIF::isValid |
( |
| ) |
const |
|
inline |
Allow for check if smart pointer is valid.
Definition at line 72 of file SmartIF.h.
◆ operator bool()
SmartIF::operator bool |
( |
| ) |
const |
|
inlineexplicit |
◆ operator TYPE *()
SmartIF::operator TYPE * |
( |
| ) |
const |
|
inline |
Automatic conversion to pointer.
It is also used by the compiler for automatic conversion to boolean.
Definition at line 80 of file SmartIF.h.
◆ operator!()
bool SmartIF::operator! |
( |
| ) |
const |
|
inline |
◆ operator*()
TYPE& SmartIF::operator* |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 84 of file SmartIF.h.
◆ operator->()
TYPE* SmartIF::operator-> |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 82 of file SmartIF.h.
◆ operator=() [1/4]
Assignment operator.
Definition at line 133 of file SmartIF.h.
◆ operator=() [2/4]
Assignment operator from a different SmartIF.
- Note
- it cannot replace the assignment operator.
Definition at line 140 of file SmartIF.h.
◆ operator=() [3/4]
Assignment operator from IInterface pointer.
It allows things like SmartIF<T> x; x = 0;
Definition at line 128 of file SmartIF.h.
◆ operator=() [4/4]
Move assignement.
Definition at line 54 of file SmartIF.h.
◆ pRef()
Get reference to the pointer.
Definition at line 89 of file SmartIF.h.
◆ reset() [1/2]
template<class OTHER >
void SmartIF::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 105 of file SmartIF.h.
109 ptr->queryInterface( TYPE::interfaceID(), pp_cast<void>( &
m_interface ) ).ignore();
◆ reset() [2/2]
void SmartIF::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 96 of file SmartIF.h.
◆ m_interface
TYPE* SmartIF::m_interface = nullptr |
|
private |
Pointer to the instance.
Definition at line 32 of file SmartIF.h.
The documentation for this class was generated from the following files: