File indexing completed on 2025-02-21 10:00:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_EXTENDS_H
0012 #define GAUDIKERNEL_EXTENDS_H
0013
0014 #include "GaudiKernel/IInterface.h"
0015
0016
0017
0018
0019 template <typename BASE, typename... Interfaces>
0020 class GAUDI_API extends : public BASE, virtual public extend_interfaces<Interfaces...> {
0021
0022 public:
0023
0024 using base_class = extends;
0025
0026 using extend_interfaces_base = extend_interfaces<Interfaces...>;
0027
0028 using BASE::BASE;
0029
0030
0031 void* i_cast( const InterfaceID& tid ) const override {
0032 using iids = typename extend_interfaces_base::ext_iids;
0033 void* ptr = Gaudi::iid_cast( tid, iids{}, this );
0034 return ptr ? ptr : BASE::i_cast( tid );
0035 }
0036
0037
0038 StatusCode queryInterface( const InterfaceID& ti, void** pp ) override {
0039 if ( !pp ) return StatusCode::FAILURE;
0040 using iids = typename extend_interfaces_base::ext_iids;
0041 *pp = Gaudi::iid_cast( ti, iids{}, this );
0042
0043 if ( !*pp ) return BASE::queryInterface( ti, pp );
0044 this->addRef();
0045 return StatusCode::SUCCESS;
0046 }
0047
0048
0049 std::vector<std::string> getInterfaceNames() const override {
0050 using iids = typename extend_interfaces_base::ext_iids;
0051 auto vb = BASE::getInterfaceNames();
0052 auto vi = Gaudi::getInterfaceNames( iids{} );
0053
0054 vb.insert( vb.end(), std::make_move_iterator( vi.begin() ), std::make_move_iterator( vi.end() ) );
0055 return vb;
0056 }
0057 };
0058
0059 template <typename BASE, typename I1>
0060 using extends1 = extends<BASE, I1>;
0061 template <typename BASE, typename I1, typename I2>
0062 using extends2 = extends<BASE, I1, I2>;
0063 template <typename BASE, typename I1, typename I2, typename I3>
0064 using extends3 = extends<BASE, I1, I2, I3>;
0065 template <typename BASE, typename I1, typename I2, typename I3, typename I4>
0066 using extends4 = extends<BASE, I1, I2, I3, I4>;
0067
0068 #endif