| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 // ============================================================================
18 #include "GaudiPython/GaudiPython.h"
19 // ============================================================================
20
21 namespace GaudiPython
22 {
33 template <class TYPE>
34 struct Interface /* :
35 public std::unary_function<const IInterface*,TYPE*> */
36 {
41 TYPE* operator() ( const IInterface* in ) const
42 { return SmartIF<TYPE>( TYPE::interfaceID() ,
43 const_cast<IInterface*> ( in ) ) ; }
44
49 static TYPE* cast ( const IInterface* in )
50 { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
51
57 static TYPE* cast ( const InterfaceID& iid ,
58 const IInterface* in )
59 { return SmartIF<TYPE>( iid , const_cast<IInterface*> ( in ) ) ; }
60
61 };
62
63 template <>
64 struct Interface<IInterface> :
65 public std::unary_function<const IInterface*,IInterface*>
66 {
67 typedef IInterface TYPE ;
72 TYPE* operator() ( const IInterface* in ) const
73 { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
74
79 static TYPE* cast ( const IInterface* in )
80 { return SmartIF<TYPE>( const_cast<IInterface*> ( in ) ) ; }
81
87 static TYPE* cast ( const InterfaceID& /* iid */ ,
88 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
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
GaudiPython::Interface::cast
static TYPE * cast(const InterfaceID &iid, const IInterface *in)
the only one important method (static)
Definition: Interface.h:57
InterfaceID
Interface ID class.
Definition: IInterface.h:30
GaudiPython::Interface< IInterface >::cast
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:79
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
SmartIF.h
GaudiPython.h
GaudiPython
GaudiPython.h GaudiPython/GaudiPython.h.
Definition: AlgDecorators.h:37
GaudiPython::Interface< IInterface >::TYPE
IInterface TYPE
Definition: Interface.h:67
GaudiPython::Interface< IInterface >::cast
static TYPE * cast(const InterfaceID &, const IInterface *in)
the only one important method (static)
Definition: Interface.h:87
GaudiPython::Interface::operator()
TYPE * operator()(const IInterface *in) const
the only one important method
Definition: Interface.h:41
std::unary_function
GaudiPython::Interface
Minor mofidication of original Pere's structure GaudiPython::Interface This helper class is nesessary...
Definition: Interface.h:34
IInterface.h
GaudiPython::Interface::cast
static TYPE * cast(const IInterface *in)
the only one important method (static)
Definition: Interface.h:49