The Gaudi Framework  v33r0 (d5ea422b)
Interface.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 // ============================================================================
12 #ifndef GAUDIPYTHON_INTERFACE_H
13 #define GAUDIPYTHON_INTERFACE_H 1
14 // ============================================================================
15 // Include files
16 // ============================================================================
17 // STD & STL
18 // ============================================================================
19 #include <functional>
20 // ============================================================================
21 // GaudiKernel
22 // ============================================================================
23 #include "GaudiKernel/IInterface.h"
24 #include "GaudiKernel/SmartIF.h"
25 // ============================================================================
26 // GaudiPython
27 // ============================================================================
29 // ============================================================================
30 
31 namespace GaudiPython {
42  template <class TYPE>
43  struct Interface {
48  TYPE* operator()( const IInterface* in ) const {
49  return SmartIF<TYPE>( TYPE::interfaceID(), const_cast<IInterface*>( in ) );
50  }
51 
56  static TYPE* cast( const IInterface* in ) { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); }
57 
63  static TYPE* cast( const InterfaceID& iid, const IInterface* in ) {
64  return SmartIF<TYPE>( iid, const_cast<IInterface*>( in ) );
65  }
66  };
67 
68  template <>
70  typedef IInterface TYPE;
75  TYPE* operator()( const IInterface* in ) const { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); }
76 
81  static TYPE* cast( const IInterface* in ) { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); }
82 
88  static TYPE* cast( const InterfaceID& /* iid */, const IInterface* in ) {
89  return SmartIF<TYPE>( const_cast<IInterface*>( in ) );
90  }
91  };
92 
93 } // end of namespace GaudiPython
94 
95 #endif // GAUDIPYTHON_INTERFACE_H
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:25
TYPE * operator()(const IInterface *in) const
the only one important method
Definition: Interface.h:75
TYPE * operator()(const IInterface *in) const
the only one important method
Definition: Interface.h:48
static TYPE * cast(const InterfaceID &iid, const IInterface *in)
the only one important method (static)
Definition: Interface.h:63
Interface ID class.
Definition: IInterface.h:39
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:81
Definition of the basic interface.
Definition: IInterface.h:254
GaudiPython.h GaudiPython/GaudiPython.h.
Definition: AlgDecorators.h:47
static TYPE * cast(const InterfaceID &, const IInterface *in)
the only one important method (static)
Definition: Interface.h:88
Minor mofidication of original Pere's structure GaudiPython::Interface This helper class is nesessary...
Definition: Interface.h:43
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:56