#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 22 of file IConverter.h.
◆ SmartIF() [1/7]
◆ SmartIF() [2/7]
SmartIF::SmartIF |
( |
TYPE * |
ptr | ) |
|
|
inline |
Standard constructor from pointer.
Definition at line 36 of file SmartIF.h.
◆ SmartIF() [3/7]
template<class OTHER >
SmartIF::SmartIF |
( |
OTHER * |
ptr | ) |
|
|
inline |
Standard constructor from any (IInterface-derived) pointer.
Definition at line 41 of file SmartIF.h.
42 if ( ptr )
reset( ptr );
◆ SmartIF() [4/7]
SmartIF::SmartIF |
( |
const SmartIF & |
rhs | ) |
|
|
inline |
◆ SmartIF() [5/7]
◆ SmartIF() [6/7]
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 58 of file SmartIF.h.
◆ ~SmartIF()
◆ SmartIF() [7/7]
template<class T >
SmartIF::SmartIF |
( |
std::unique_ptr< T > && |
rhs | ) |
|
|
inline |
◆ as()
template<typename IFace >
SmartIF<IFace> SmartIF::as |
( |
| ) |
const |
|
inline |
◆ get()
TYPE* SmartIF::get |
( |
| ) |
const |
|
inline |
Get interface pointer.
Definition at line 82 of file SmartIF.h.
◆ isValid()
bool SmartIF::isValid |
( |
| ) |
const |
|
inline |
Allow for check if smart pointer is valid.
Definition at line 69 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 76 of file SmartIF.h.
◆ operator!()
bool SmartIF::operator! |
( |
| ) |
const |
|
inline |
◆ operator*()
TYPE& SmartIF::operator* |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 80 of file SmartIF.h.
◆ operator->()
TYPE* SmartIF::operator-> |
( |
| ) |
const |
|
inline |
Dereference operator.
Definition at line 78 of file SmartIF.h.
◆ operator=() [1/4]
Assignment operator.
Definition at line 126 of file SmartIF.h.
◆ operator=() [2/4]
Assignment operator from a different SmartIF.
- Note
- it cannot replace the assignment operator.
Definition at line 133 of file SmartIF.h.
◆ operator=() [3/4]
Assignment operator from IInterface pointer.
It allows things like SmartIF<T> x; x = 0;
Definition at line 121 of file SmartIF.h.
◆ operator=() [4/4]
◆ 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 97 of file SmartIF.h.
◆ 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 88 of file SmartIF.h.
◆ m_interface
TYPE* SmartIF::m_interface = nullptr |
|
private |
Pointer to the instance.
Definition at line 31 of file SmartIF.h.
The documentation for this class was generated from the following files: