All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Interface.h
Go to the documentation of this file.
1 // $Id: Interface.h,v 1.8 2005/11/08 16:31:03 mato Exp $
2 // ============================================================================
3 #ifndef GAUDIPYTHON_INTERFACE_H
4 #define GAUDIPYTHON_INTERFACE_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // STD & STL
9 // ============================================================================
10 #include <functional>
11 // ============================================================================
12 // GaudiKernel
13 // ============================================================================
14 #include "GaudiKernel/IInterface.h"
15 #include "GaudiKernel/SmartIF.h"
16 // ============================================================================
17 // GaudiPython
18 // ============================================================================
20 // ============================================================================
21 
22 namespace GaudiPython
23 {
34  template <class TYPE>
35  struct Interface /* :
36  public std::unary_function<const IInterface*,TYPE*> */
37  {
42  TYPE* operator() ( const IInterface* in ) const
43  { return SmartIF<TYPE>( TYPE::interfaceID() ,
44  const_cast<IInterface*> ( in ) ) ; }
45 
50  static TYPE* cast ( const IInterface* in )
51  { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
52 
58  static TYPE* cast ( const InterfaceID& iid ,
59  const IInterface* in )
60  { return SmartIF<TYPE>( iid , const_cast<IInterface*> ( in ) ) ; }
61 
62  };
63 
64  template <>
65  struct Interface<IInterface> :
66  public std::unary_function<const IInterface*,IInterface*>
67  {
68  typedef IInterface TYPE ;
73  TYPE* operator() ( const IInterface* in ) const
74  { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
75 
80  static TYPE* cast ( const IInterface* in )
81  { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
82 
88  static TYPE* cast ( const InterfaceID& /* iid */ ,
89  const IInterface* in )
90  { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
91 
92  };
93 
94 } // end of namespace GaudiPython
95 
96 #endif // GAUDIPYTHON_INTERFACE_H
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
static TYPE * cast(const InterfaceID &iid, const IInterface *in)
the only one important method (static)
Definition: Interface.h:58
Interface ID class.
Definition: IInterface.h:55
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:80
Definition of the basic interface.
Definition: IInterface.h:160
static TYPE * cast(const InterfaceID &, const IInterface *in)
the only one important method (static)
Definition: Interface.h:88
TYPE * operator()(const IInterface *in) const
the only one important method
Definition: Interface.h:42
Minor mofidication of original Pere's structure GaudiPython::Interface This helper class is nesessary...
Definition: Interface.h:35
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:50