The Gaudi Framework  v29r0 (ff2e7097)
implements< Interfaces > Struct Template Reference

Base class used to implement the interfaces. More...

#include <GaudiKernel/implements.h>

Inheritance diagram for implements< Interfaces >:
Collaboration diagram for implements< Interfaces >:

Public Types

using base_class = implements< Interfaces... >
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces... >
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Protected Attributes

std::atomic_ulong m_refCount = {0}
 Reference counter. More...
 

Detailed Description

template<typename... Interfaces>
struct implements< Interfaces >

Base class used to implement the interfaces.

Definition at line 9 of file implements.h.

Member Typedef Documentation

template<typename... Interfaces>
using implements< Interfaces >::base_class = implements<Interfaces...>

Typedef to this class.

Definition at line 11 of file implements.h.

template<typename... Interfaces>
using implements< Interfaces >::extend_interfaces_base = extend_interfaces<Interfaces...>

Typedef to the base of this class.

Definition at line 13 of file implements.h.

template<typename... Interfaces>
using implements< Interfaces >::iids = typename extend_interfaces_base::ext_iids

Definition at line 14 of file implements.h.

Constructor & Destructor Documentation

template<typename... Interfaces>
implements< Interfaces >::implements ( )
default

Default constructor.

template<typename... Interfaces>
implements< Interfaces >::implements ( const implements< Interfaces > &  )
inline

Copy constructor (zero the reference count)

Definition at line 33 of file implements.h.

33 : m_refCount{0} {}
std::atomic_ulong m_refCount
Reference counter.
Definition: implements.h:55
template<typename... Interfaces>
implements< Interfaces >::~implements ( )
overridedefault

Virtual destructor.

Member Function Documentation

template<typename... Interfaces>
unsigned long implements< Interfaces >::addRef ( )
inlineoverride

Reference Interface instance.

Definition at line 41 of file implements.h.

41 { return ++m_refCount; }
std::atomic_ulong m_refCount
Reference counter.
Definition: implements.h:55
template<typename... Interfaces>
std::vector<std::string> implements< Interfaces >::getInterfaceNames ( ) const
inlineoverride

Implementation of IInterface::getInterfaceNames.

Definition at line 29 of file implements.h.

29 { return Gaudi::getInterfaceNames( iids{} ); }
typename extend_interfaces_base::ext_iids iids
Definition: implements.h:14
std::vector< std::string > getInterfaceNames(Gaudi::interface_list< Is... >)
Definition: IInterface.h:206
template<typename... Interfaces>
void* implements< Interfaces >::i_cast ( const InterfaceID tid) const
inlineoverride

Implementation of IInterface::i_cast.

Definition at line 18 of file implements.h.

18 { return Gaudi::iid_cast( tid, iids{}, this ); }
typename extend_interfaces_base::ext_iids iids
Definition: implements.h:14
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is... >, P *ptr)
Definition: IInterface.h:212
template<typename... Interfaces>
implements& implements< Interfaces >::operator= ( const implements< Interfaces > &  )
inline

Assignment operator (do not touch the reference count).

Definition at line 35 of file implements.h.

35 { return *this; }
template<typename... Interfaces>
StatusCode implements< Interfaces >::queryInterface ( const InterfaceID ti,
void **  pp 
)
inlineoverride

Implementation of IInterface::queryInterface.

Definition at line 20 of file implements.h.

21  {
22  if ( !pp ) return StatusCode::FAILURE;
23  *pp = Gaudi::iid_cast( ti, iids{}, this );
24  if ( !*pp ) return StatusCode::FAILURE; /* cast failed */
25  this->addRef();
26  return StatusCode::SUCCESS;
27  }
typename extend_interfaces_base::ext_iids iids
Definition: implements.h:14
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:41
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is... >, P *ptr)
Definition: IInterface.h:212
template<typename... Interfaces>
unsigned long implements< Interfaces >::refCount ( ) const
inlineoverride

Current reference count.

Definition at line 51 of file implements.h.

51 { return m_refCount.load(); }
std::atomic_ulong m_refCount
Reference counter.
Definition: implements.h:55
template<typename... Interfaces>
unsigned long implements< Interfaces >::release ( )
inlineoverride

Release Interface instance.

Definition at line 43 of file implements.h.

44  {
45  /* Avoid to decrement 0 */
46  auto count = ( m_refCount ? --m_refCount : m_refCount.load() );
47  if ( count == 0 ) delete this;
48  return count;
49  }
std::atomic_ulong m_refCount
Reference counter.
Definition: implements.h:55
T count(T...args)

Member Data Documentation

template<typename... Interfaces>
std::atomic_ulong implements< Interfaces >::m_refCount = {0}
protected

Reference counter.

Definition at line 55 of file implements.h.


The documentation for this struct was generated from the following file: