2 #ifndef GAUDI_SMARTIF_H
3 #define GAUDI_SMARTIF_H 1
19 template <
class TYPE>
class SmartIF {
32 template <
class OTHER>
63 #if !defined(GAUDI_V22_API) && !defined(NEW_SMARTIF)
64 inline TYPE*&
pRef() {
74 inline void reset(TYPE* ptr = 0) {
86 template <
class OTHER>
88 if (static_cast<IInterface*>(ptr) == static_cast<IInterface*>(
m_interface))
return;
91 ptr->queryInterface(TYPE::interfaceID(), pp_cast<void>(&
m_interface)).ignore();
122 #if defined(_MSC_VER) && (_MSC_VER < 1500)
123 template <
class TYPE>
132 return rhs ==
reinterpret_cast<TYPE*
>(lhs);
141 template <
class TYPE>
143 return rhs !=
reinterpret_cast<TYPE*
>(lhs);
146 #endif // GAUDI_SMARTIF_H
TYPE * m_interface
Pointer to the instance.
SmartIF()
Default constructor.
bool operator!=(const GaudiUtils::Allocator< T1 > &, const GaudiUtils::Allocator< T2 > &)
Small smart pointer class with automatic reference counting for IInterface.
SmartIF & operator=(IInterface *ptr)
Assignment operator from IInterface pointer.
~SmartIF()
Standard Destructor.
SmartIF(const SmartIF &rhs)
Copy constructor.
SmartIF(const SmartIF< T > &rhs)
Constructor from another SmartIF, with a different type.
SmartIF(OTHER *ptr)
Standard constructor from any (IInterface-derived) pointer.
void reset(OTHER *ptr)
Set the internal pointer to the passed one disposing of the old one.
TYPE *& pRef()
Get reference to the pointer.
bool isValid() const
Allow for check if smart pointer is valid.
bool operator==(const GaudiUtils::Allocator< T1 > &, const GaudiUtils::Allocator< T2 > &)
Definition of the basic interface.
TYPE * get() const
Get interface pointer.
TYPE & operator*() const
Dereference operator.
SmartIF(TYPE *ptr)
Standard constructor from pointer.
TYPE * operator->() const
Dereference operator.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.