The Gaudi Framework  v30r3 (a5ef0a68)
Interface.h
Go to the documentation of this file.
1 // ============================================================================
2 #ifndef GAUDIPYTHON_INTERFACE_H
3 #define GAUDIPYTHON_INTERFACE_H 1
4 // ============================================================================
5 // Include files
6 // ============================================================================
7 // STD & STL
8 // ============================================================================
9 #include <functional>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
13 #include "GaudiKernel/IInterface.h"
14 #include "GaudiKernel/SmartIF.h"
15 // ============================================================================
16 // GaudiPython
17 // ============================================================================
19 // ============================================================================
20 
21 namespace GaudiPython
22 {
33  template <class TYPE>
34  struct Interface {
39  TYPE* operator()( const IInterface* in ) const
40  {
41  return SmartIF<TYPE>( TYPE::interfaceID(), const_cast<IInterface*>( in ) );
42  }
43 
48  static TYPE* cast( const IInterface* in ) { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); }
49 
55  static TYPE* cast( const InterfaceID& iid, const IInterface* in )
56  {
57  return SmartIF<TYPE>( iid, const_cast<IInterface*>( in ) );
58  }
59  };
60 
61  template <>
63  typedef IInterface TYPE;
68  TYPE* operator()( const IInterface* in ) const { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); }
69 
74  static TYPE* cast( const IInterface* in ) { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); }
75 
81  static TYPE* cast( const InterfaceID& /* iid */, const IInterface* in )
82  {
83  return SmartIF<TYPE>( const_cast<IInterface*>( in ) );
84  }
85  };
86 
87 } // end of namespace GaudiPython
88 
89 #endif // GAUDIPYTHON_INTERFACE_H
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
static TYPE * cast(const InterfaceID &iid, const IInterface *in)
the only one important method (static)
Definition: Interface.h:55
Interface ID class.
Definition: IInterface.h:29
TYPE * operator()(const IInterface *in) const
the only one important method
Definition: Interface.h:68
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:74
Definition of the basic interface.
Definition: IInterface.h:277
GaudiPython.h GaudiPython/GaudiPython.h.
Definition: __init__.py:1
static TYPE * cast(const InterfaceID &, const IInterface *in)
the only one important method (static)
Definition: Interface.h:81
TYPE * operator()(const IInterface *in) const
the only one important method
Definition: Interface.h:39
Minor mofidication of original Pere&#39;s structure GaudiPython::Interface This helper class is nesessary...
Definition: Interface.h:34
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:48