The Gaudi Framework  master (37c0b60a)
implements< Interfaces > Struct Template Reference

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

#include </builds/gaudi/Gaudi/GaudiKernel/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...
 
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...
 

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 19 of file implements.h.

Member Typedef Documentation

◆ base_class

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

Typedef to this class.

Definition at line 21 of file implements.h.

◆ extend_interfaces_base

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

Typedef to the base of this class.

Definition at line 23 of file implements.h.

◆ iids

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

Definition at line 24 of file implements.h.

Constructor & Destructor Documentation

◆ implements() [1/2]

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

Default constructor.

◆ implements() [2/2]

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

Copy constructor (zero the reference count)

Definition at line 42 of file implements.h.

42 : m_refCount{ 0 } {}

Member Function Documentation

◆ addRef()

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

Reference Interface instance

Definition at line 48 of file implements.h.

48 { return ++m_refCount; }

◆ getInterfaceNames()

template<typename... Interfaces>
std::vector<std::string> implements< Interfaces >::getInterfaceNames ( ) const
inlineoverride

Implementation of IInterface::getInterfaceNames.

Definition at line 38 of file implements.h.

38 { return Gaudi::getInterfaceNames( iids{} ); }

◆ i_cast()

template<typename... Interfaces>
void* implements< Interfaces >::i_cast ( const InterfaceID tid) const
inlineoverride

Implementation of IInterface::i_cast.

Definition at line 28 of file implements.h.

28 { return Gaudi::iid_cast( tid, iids{}, this ); }

◆ operator=()

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

Assignment operator (do not touch the reference count).

Definition at line 44 of file implements.h.

44 { return *this; } // cppcheck-suppress operatorEqVarError

◆ queryInterface()

template<typename... Interfaces>
StatusCode implements< Interfaces >::queryInterface ( const InterfaceID ti,
void **  pp 
)
inlineoverride

Implementation of IInterface::queryInterface.

Definition at line 30 of file implements.h.

30  {
31  if ( !pp ) return StatusCode::FAILURE;
32  *pp = Gaudi::iid_cast( ti, iids{}, this );
33  if ( !*pp ) return StatusCode::FAILURE; /* cast failed */
34  this->addRef();
35  return StatusCode::SUCCESS;
36  }

◆ refCount()

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

Current reference count

Definition at line 57 of file implements.h.

57 { return m_refCount.load(); }

◆ release()

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

Release Interface instance

Definition at line 50 of file implements.h.

50  {
51  /* Avoid to decrement 0 */
52  auto count = ( m_refCount ? --m_refCount : m_refCount.load() );
53  if ( count == 0 ) delete this;
54  return count;
55  }

Member Data Documentation

◆ m_refCount

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

Reference counter

Definition at line 61 of file implements.h.


The documentation for this struct was generated from the following file:
implements::iids
typename extend_interfaces_base::ext_iids iids
Definition: implements.h:24
implements::m_refCount
std::atomic_ulong m_refCount
Reference counter
Definition: implements.h:61
implements::addRef
unsigned long addRef() override
Reference Interface instance
Definition: implements.h:48
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::iid_cast
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is... >, P *ptr)
Definition: IInterface.h:177
Gaudi::getInterfaceNames
std::vector< std::string > getInterfaceNames(Gaudi::interface_list< Is... >)
Definition: IInterface.h:172
std::count
T count(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:507