Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
extends.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EXTENDS_H
2 #define GAUDIKERNEL_EXTENDS_H
3 
5 
9 template <typename BASE, typename... Interfaces>
10 class GAUDI_API extends : public BASE, virtual public extend_interfaces<Interfaces...> {
11 
12 public:
16  using extend_interfaces_base = extend_interfaces<Interfaces...>;
18  using BASE::BASE;
19 
21  void* i_cast( const InterfaceID& tid ) const override {
22  using iids = typename extend_interfaces_base::ext_iids;
23  void* ptr = Gaudi::iid_cast( tid, iids{}, this );
24  return ptr ? ptr : BASE::i_cast( tid );
25  }
26 
28  StatusCode queryInterface( const InterfaceID& ti, void** pp ) override {
29  if ( !pp ) return StatusCode::FAILURE;
30  using iids = typename extend_interfaces_base::ext_iids;
31  *pp = Gaudi::iid_cast( ti, iids{}, this );
32  // if cast failed, try the base class
33  if ( !*pp ) return BASE::queryInterface( ti, pp );
34  this->addRef();
35  return StatusCode::SUCCESS;
36  }
37 
40  using iids = typename extend_interfaces_base::ext_iids;
41  auto vb = BASE::getInterfaceNames();
42  auto vi = Gaudi::getInterfaceNames( iids{} );
43  // start with base, and move the rest...
44  vb.insert( vb.end(), std::make_move_iterator( vi.begin() ), std::make_move_iterator( vi.end() ) );
45  return vb;
46  }
47 };
48 
49 template <typename BASE, typename I1>
51 template <typename BASE, typename I1, typename I2>
53 template <typename BASE, typename I1, typename I2, typename I3>
55 template <typename BASE, typename I1, typename I2, typename I3, typename I4>
57 
58 #endif /* GAUDIKERNEL_EXTENDS_H */
typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type ext_iids
take union of the ext_iids of all Interfaces...
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T make_move_iterator(T...args)
Interface ID class.
Definition: IInterface.h:29
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
Definition: extends.h:28
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Base class to be used to extend an interface.
std::vector< std::string > getInterfaceNames() const override
Implementation of IInterface::getInterfaceNames.
Definition: extends.h:39
void * i_cast(const InterfaceID &tid) const override
Implementation of IInterface::i_cast.
Definition: extends.h:21
T insert(T...args)
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
constexpr static const auto FAILURE
Definition: StatusCode.h:86
std::vector< std::string > getInterfaceNames(Gaudi::interface_list< Is... >)
Definition: IInterface.h:180
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is... >, P *ptr)
Definition: IInterface.h:185
#define GAUDI_API
Definition: Kernel.h:71