| Report problems to ATLAS LXR Team (with time and IP address indicated) |
|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
||||
|
||||||
| Links to LXR source navigation pages for stable releases | [ 12.*.* ] [ 13.*.* ] [ 14.*.* ] [ 15.*.* ] | |||||
001 // $Id: GetAlg.h,v 1.2 2007/11/20 13:01:06 marcocle Exp $ 002 // ============================================================================ 003 #ifndef GAUDIALG_GETALG_H 004 #define GAUDIALG_GETALG_H 1 005 // ============================================================================ 006 // Include files 007 // ============================================================================ 008 // GaudiKernnel 009 // ============================================================================ 010 #include "GaudiKernel/IAlgorithm.h" 011 // ============================================================================ 012 // forward declarations 013 // ============================================================================ 014 class IAlgContextSvc ; 015 // ============================================================================ 016 namespace Gaudi 017 { 018 namespace Utils 019 { 020 // ======================================================================== 021 /** @class AlgSelector 022 * Simple interface class for selection of algorithms 023 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 024 * @date 2007-09-07 025 */ 026 class AlgSelector 027 { 028 public: 029 /// the only one essential method: 030 virtual bool operator() ( const IAlgorithm* ) const = 0 ; 031 // virtual destructor 032 virtual ~AlgSelector () ; 033 }; 034 // ======================================================================== 035 /** @class AlgTypeSelector 036 * The trivial selector of algorithm by type 037 * @see Gaudi::Utils::AlgSelector 038 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 039 * @date 2007-09-07 040 */ 041 template <class TYPE> 042 class AlgTypeSelector : public AlgSelector 043 { 044 public: 045 /// the only one essential method: 046 virtual bool operator() ( const IAlgorithm* a ) const 047 { return dynamic_cast<const TYPE*>( a ) != 0; } 048 } ; 049 // ======================================================================== 050 template <class TYPE> 051 class AlgTypeSelector<TYPE*> : public AlgTypeSelector<TYPE> {} ; 052 // ======================================================================== 053 template <class TYPE> 054 class AlgTypeSelector<const TYPE*> : public AlgTypeSelector<TYPE> {} ; 055 // ======================================================================== 056 template <class TYPE> 057 class AlgTypeSelector<TYPE&> : public AlgTypeSelector<TYPE> {} ; 058 // ======================================================================== 059 template <class TYPE> 060 class AlgTypeSelector<const TYPE&> : public AlgTypeSelector<TYPE> {} ; 061 // ======================================================================== 062 template <class TYPE> 063 class AlgTypeSelector<const TYPE> : public AlgTypeSelector<TYPE> {} ; 064 // ======================================================================== 065 /** @class AlgNameSelector 066 * The trivial selector of algorithm by type 067 * @see Gaudi::Utils::AlgSelector 068 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 069 * @date 2007-09-07 070 */ 071 class AlgNameSelector : public AlgSelector 072 { 073 public: 074 /// constructor form the name 075 AlgNameSelector ( const std::string& name ) : m_name ( name ) {} ; 076 /// the only one essential method: 077 virtual bool operator() ( const IAlgorithm* a ) const 078 { return 0 != a ? a->name() == m_name : false ; } 079 private: 080 // the default constructor is disabled 081 AlgNameSelector() ; 082 private: 083 // algorithm name 084 std::string m_name ; ///< algorithm name 085 } ; 086 // ======================================================================== 087 } // end of namespace Gaudi::Utils 088 } // end of namespace Gaudi 089 // ============================================================================ 090 namespace Gaudi 091 { 092 namespace Utils 093 { 094 // ======================================================================== 095 /** simple function to get the algorithm from Context Service 096 * 097 * @code 098 * 099 * // get the selector 100 * const AlgSelector& selector = ... ; 101 * 102 * // get the context service: 103 * const IAlgContextSvc* svc = ... ; 104 * 105 * // get the appropriate algorithm: 106 * IAlgorithm* alg = getAlgorithm ( svc , selector ) ; 107 * 108 * @endcode 109 * 110 * @see IAlgContextSvc 111 * @see Gaudi::Utils::AlgSelector 112 * @param svc pointer to Algororithm Contetx Service 113 * @param sel the selection functor 114 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 115 * @date 2007-09-07 116 */ 117 IAlgorithm* getAlgorithm 118 ( const IAlgContextSvc* svc , 119 const AlgSelector& sel ) ; 120 // ======================================================================== 121 /** simple function to get the algorithm from Context Service 122 * 123 * @code 124 * 125 * // get the selector 126 * const AlgSelector& selector = ... ; 127 * 128 * // get the list of algorithms: 129 * const std::vector<IAlgorithm*>& algs = ... ; 130 * 131 * // get the appropriate algorithm: 132 * IAlgorithm* alg = getAlgorithm ( algs , selector ) ; 133 * 134 * @endcode 135 * 136 * @see IAlgContextSvc 137 * @see Gaudi::Utils::AlgSelector 138 * @param lst list of the algorithms 139 * @param sel the selection functor 140 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 141 * @date 2007-09-07 142 */ 143 IAlgorithm* getAlgorithm 144 ( const std::vector<IAlgorithm*>& lst , 145 const AlgSelector& sel ) ; 146 // ======================================================================== 147 } // end of namespace Gaudi::Utils 148 } // end of namespace Gaudi 149 // ============================================================================ 150 // The END 151 // ============================================================================ 152 #endif // GAUDIALG_GETALG_H 153 // ============================================================================ 154
| [ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems | |
| This page was automatically generated by the LXR engine. |
|