Go to the documentation of this file.
11 #ifndef GAUDI_SMARTIF_H
12 #define GAUDI_SMARTIF_H 1
43 template <
class OTHER>
45 if ( ptr )
reset( ptr );
57 rhs.m_interface =
nullptr;
74 inline explicit operator bool()
const {
return isValid(); }
87 #if !defined( GAUDI_V22_API ) && !defined( NEW_SMARTIF )
96 inline void reset( TYPE* ptr =
nullptr ) {
104 template <
class OTHER>
109 ptr->queryInterface( TYPE::interfaceID(), pp_cast<void>( &
m_interface ) ).ignore();
116 template <
typename IFace>
149 template <
typename IFace>
154 #endif // GAUDI_SMARTIF_H
TYPE & operator*() const
Dereference operator.
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()
Standard Destructor.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
SmartIF & operator=(SmartIF &&rhs)
Move assignement.
SmartIF & operator=(const SmartIF< T > &rhs)
Assignment operator from a different SmartIF.
SmartIF(SmartIF &&rhs)
Move constructor.
SmartIF(OTHER *ptr)
Standard constructor from any (IInterface-derived) pointer.
TYPE *& pRef()
Get reference to the pointer.
bool isValid() const
Allow for check if smart pointer is valid.
SmartIF(const SmartIF &rhs)
Copy constructor.
TYPE * m_interface
Pointer to the instance.
SmartIF(TYPE *ptr)
Standard constructor from pointer.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
SmartIF< IFace > make_SmartIF(IFace *iface)
TYPE * get() const
Get interface pointer.
TYPE * operator->() const
Dereference operator.
SmartIF()=default
Default constructor.
SmartIF(const SmartIF< T > &rhs)
Constructor from another SmartIF, with a different type.
SmartIF & operator=(const SmartIF &rhs)
Assignment operator.