The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
extends.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
14
18template <typename BASE, typename... Interfaces>
19class GAUDI_API extends : public BASE, virtual public extend_interfaces<Interfaces...> {
20
21public:
27 using BASE::BASE;
28
30 void const* i_cast( const InterfaceID& tid ) const override {
31 using iids = typename extend_interfaces_base::ext_iids;
32 void* ptr = Gaudi::iid_cast( tid, iids{}, this );
33 return ptr ? ptr : BASE::i_cast( tid );
34 }
35
37 StatusCode queryInterface( const InterfaceID& ti, void** pp ) override {
38 if ( !pp ) return StatusCode::FAILURE;
39 using iids = typename extend_interfaces_base::ext_iids;
40 *pp = Gaudi::iid_cast( ti, iids{}, this );
41 // if cast failed, try the base class
42 if ( !*pp ) return BASE::queryInterface( ti, pp );
43 this->addRef();
45 }
46
48 std::vector<std::string> getInterfaceNames() const override {
49 using iids = typename extend_interfaces_base::ext_iids;
50 auto vb = BASE::getInterfaceNames();
51 auto vi = Gaudi::getInterfaceNames( iids{} );
52 // start with base, and move the rest...
53 vb.insert( vb.end(), std::make_move_iterator( vi.begin() ), std::make_move_iterator( vi.end() ) );
54 return vb;
55 }
56};
57
58template <typename BASE, typename I1>
60template <typename BASE, typename I1, typename I2>
62template <typename BASE, typename I1, typename I2, typename I3>
64template <typename BASE, typename I1, typename I2, typename I3, typename I4>
#define GAUDI_API
Definition Kernel.h:49
Interface ID class.
Definition IInterface.h:38
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
Base class used to extend a class implementing other interfaces.
Definition extends.h:19
void const * i_cast(const InterfaceID &tid) const override
Implementation of IInterface::i_cast.
Definition extends.h:30
extend_interfaces< Interfaces... > extend_interfaces_base
Definition extends.h:25
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
Definition extends.h:37
std::vector< std::string > getInterfaceNames() const override
Implementation of IInterface::getInterfaceNames.
Definition extends.h:48
extends< BASE, I1, I2, I3 > extends3
Definition extends.h:63
extends< BASE, I1, I2 > extends2
Definition extends.h:61
extends< BASE, I1, I2, I3, I4 > extends4
Definition extends.h:65
extends< BASE, I1 > extends1
Definition extends.h:59
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is... >, P *ptr)
Definition IInterface.h:163
std::vector< std::string > getInterfaceNames(Gaudi::interface_list< Is... >)
Definition IInterface.h:158
Base class to be used to extend an interface.
typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type ext_iids