|
||||
File indexing completed on 2025-01-18 09:57:45
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 // ============================================================================ 0012 #ifndef GAUDIPYTHON_INTERFACE_H 0013 #define GAUDIPYTHON_INTERFACE_H 1 0014 // ============================================================================ 0015 // Include files 0016 // ============================================================================ 0017 // STD & STL 0018 // ============================================================================ 0019 #include <functional> 0020 // ============================================================================ 0021 // GaudiKernel 0022 // ============================================================================ 0023 #include "GaudiKernel/IInterface.h" 0024 #include "GaudiKernel/SmartIF.h" 0025 // ============================================================================ 0026 // GaudiPython 0027 // ============================================================================ 0028 #include "GaudiPython/GaudiPython.h" 0029 // ============================================================================ 0030 0031 namespace GaudiPython { 0032 /** @struct Interface Interface.h GaudiPython/Interface.h 0033 * 0034 * Minor mofidication of original Pere's structure 0035 * GaudiPython::Interface 0036 * This helper class is nesessary to perform C++ 0037 * castings from python. 0038 * 0039 * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr 0040 * @date 2005-08-03 0041 */ 0042 template <class TYPE> 0043 struct Interface { 0044 /** the only one important method 0045 * @param in input interface 0046 * @return resutl of "cast" 0047 */ 0048 TYPE* operator()( const IInterface* in ) const { 0049 return SmartIF<TYPE>( TYPE::interfaceID(), const_cast<IInterface*>( in ) ); 0050 } 0051 0052 /** the only one important method (static) 0053 * @param in input interface 0054 * @return resutl of "cast" 0055 */ 0056 static TYPE* cast( const IInterface* in ) { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); } 0057 0058 /** the only one important method (static) 0059 * @param iid unique identifier of 'target' interface 0060 * @param in input interface 0061 * @return resutl of "cast" 0062 */ 0063 static TYPE* cast( const InterfaceID& iid, const IInterface* in ) { 0064 return SmartIF<TYPE>( iid, const_cast<IInterface*>( in ) ); 0065 } 0066 }; 0067 0068 template <> 0069 struct Interface<IInterface> { 0070 typedef IInterface TYPE; 0071 /** the only one important method 0072 * @param in input interface 0073 * @return resutl of "cast" 0074 */ 0075 TYPE* operator()( const IInterface* in ) const { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); } 0076 0077 /** the only one important method (static) 0078 * @param in input interface 0079 * @return resutl of "cast" 0080 */ 0081 static TYPE* cast( const IInterface* in ) { return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); } 0082 0083 /** the only one important method (static) 0084 * @param iid unique identifier of 'target' interface 0085 * @param in input interface 0086 * @return resutl of "cast" 0087 */ 0088 static TYPE* cast( const InterfaceID& /* iid */, const IInterface* in ) { 0089 return SmartIF<TYPE>( const_cast<IInterface*>( in ) ); 0090 } 0091 }; 0092 0093 } // end of namespace GaudiPython 0094 0095 #endif // GAUDIPYTHON_INTERFACE_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |