Gaudi Framework, version v23r2

Home   Generated: Thu Jun 28 2012

AlgDecorators.cpp

Go to the documentation of this file.
00001 // $Id: AlgDecorators.cpp,v 1.2 2005/11/08 16:31:03 mato Exp $
00002 // ============================================================================
00003 // Include files 
00004 // ============================================================================
00005 // GaudiKernel
00006 // ============================================================================
00007 #include "GaudiKernel/IInterface.h"
00008 #include "GaudiKernel/IProperty.h"
00009 #include "GaudiKernel/IAlgorithm.h"
00010 #include "GaudiKernel/IAlgTool.h"
00011 #include "GaudiKernel/SmartIF.h"
00012 // ============================================================================
00013 // GaudiAlg 
00014 // ============================================================================
00015 #include "GaudiAlg/GaudiAlgorithm.h"
00016 #include "GaudiAlg/GaudiTool.h"
00017 // ============================================================================
00018 // GaudiPython
00019 // ============================================================================
00020 #include "GaudiPython/AlgDecorators.h"
00021 // ============================================================================
00027 // ============================================================================
00028 /*  get the tool from GaudiAlgorithm
00029  *  @param alg GaudiAlgorithm
00030  *  @param type tool type
00031  *  @param name tool name 
00032  *  @param parent tool parent 
00033  *  @param create flag to create 
00034  *  @return the tool 
00035  */
00036 // ============================================================================
00037 IAlgTool* GaudiPython::AlgDecorator::tool_
00038 ( const GaudiAlgorithm* alg    ,
00039   const std::string&    type   , 
00040   const std::string&    name   , 
00041   const IInterface*     parent , 
00042   const bool            create ) 
00043 {
00044   if ( 0 == alg ) { return 0 ; }
00045   return alg -> tool<IAlgTool> ( type , name , parent , create ) ;
00046 }
00047 // ============================================================================
00048 /*  get the tool from GaudiAlgorithm
00049  *  @param alg GaudiAlgorithm
00050  *  @param typeAndName tool type/name 
00051  *  @param parent tool parent 
00052  *  @param create flag to create 
00053  *  @return the tool 
00054  */
00055 // ============================================================================
00056 IAlgTool* GaudiPython::AlgDecorator::tool_
00057 ( const GaudiAlgorithm* alg         ,
00058   const std::string&    typeAndName , 
00059   const IInterface*     parent      , 
00060   const bool            create      ) 
00061 {
00062   if ( 0 == alg ) { return 0 ; }
00063   return alg->tool<IAlgTool>( typeAndName , parent , create ) ;
00064 }
00065 // ============================================================================
00066 /*  get the service from GaudiAlgorithm
00067  *  @param alg GaudiAlgorithm
00068  *  @param name service name 
00069  *  @param create flag to create 
00070  *  @return the tool 
00071  */
00072 // ============================================================================
00073 IInterface* GaudiPython::AlgDecorator::svc_
00074 ( const GaudiAlgorithm* alg    ,
00075   const std::string&    name   ,
00076   const bool            create ) 
00077 {
00078   if ( 0 == alg ) { return 0 ; }
00079   return alg -> svc<IInterface> ( name , create ) ;
00080 }
00081 // ============================================================================
00082 // get all counters form the algorithm
00083 // ============================================================================
00084 size_t GaudiPython::AlgDecorator::_counters_a_
00085 ( const GaudiAlgorithm*                alg   , 
00086   std::vector<std::string>&            names , 
00087   GaudiPython::AlgDecorator::Counters& out   )
00088 {
00089   typedef std::map<std::string,StatEntity> Stats ;
00090   names.clear () ;
00091   out.clear   () ;
00092   if ( 0 == alg ) { return 0 ; }                                      // RETURN 
00093   //
00094   const Stats& counters = alg->counters() ; 
00095   for ( Stats::const_iterator icnt = counters.begin() ; 
00096         counters.end() != icnt ; ++icnt ) 
00097   {
00098     names.push_back (   icnt->first )   ;
00099     out  .push_back ( &(icnt->second) ) ;
00100   }
00101   return out.size() ;
00102 }
00103 // ============================================================================
00104 // get all counters form the tool
00105 // ============================================================================
00106 size_t GaudiPython::AlgDecorator::_counters_t_
00107 ( const GaudiTool*                     alg   , 
00108   std::vector<std::string>&            names , 
00109   GaudiPython::AlgDecorator::Counters& out   )
00110 {
00111   typedef std::map<std::string,StatEntity> Stats ;
00112   names.clear () ;
00113   out.clear   () ;
00114   if ( 0 == alg ) { return 0 ; }                                      // RETURN 
00115   //
00116   const Stats& counters = alg->counters() ; 
00117   for ( Stats::const_iterator icnt = counters.begin() ; 
00118         counters.end() != icnt ; ++icnt ) 
00119   {
00120     names.push_back (   icnt->first )   ;
00121     out  .push_back ( &(icnt->second) ) ;
00122   }
00123   return out.size() ;
00124 }
00125 // ============================================================================
00126 // get all counters form the algorithm
00127 // ============================================================================
00128 size_t GaudiPython::AlgDecorator::_counters_a_
00129 ( const IAlgorithm*                    alg   , 
00130   std::vector<std::string>&            names , 
00131   GaudiPython::AlgDecorator::Counters& out   )
00132 {
00133   names.clear () ;
00134   out.clear   () ;
00135   if ( 0 == alg ) { return 0 ; }                                      // RETURN 
00136   //
00137   return _counters_a_ ( dynamic_cast<const GaudiAlgorithm*>( alg ) , names , out ) ;
00138 }
00139 // ============================================================================
00140 // get all counters form the tool
00141 // ============================================================================
00142 size_t GaudiPython::AlgDecorator::_counters_t_
00143 ( const IAlgTool*                      alg   , 
00144   std::vector<std::string>&            names , 
00145   GaudiPython::AlgDecorator::Counters& out   )
00146 {
00147   names.clear () ;
00148   out.clear   () ;
00149   if ( 0 == alg ) { return 0 ; }                                      // RETURN 
00150   //
00151   return _counters_t_ ( dynamic_cast<const GaudiTool*>( alg ) , names , out ) ;
00152 }
00153 // ============================================================================
00154 // get the counter by name
00155 // ============================================================================
00156 const StatEntity* GaudiPython::AlgDecorator::_counter_a_ 
00157 ( const GaudiAlgorithm* cmp , const std::string& name )
00158 {
00159   if ( 0 == cmp ) { return 0 ; }                                      // RETURN 
00160   return &( cmp -> counter ( name ) ) ;                               // RETURN 
00161 }
00162 // ============================================================================
00163 // get the counter by name
00164 // ============================================================================
00165 const StatEntity* GaudiPython::AlgDecorator::_counter_t_
00166 ( const GaudiTool* cmp , const std::string& name )
00167 {
00168   if ( 0 == cmp ) { return 0 ; }                                      // RETURN 
00169   return &( cmp -> counter ( name ) ) ;                               // RETURN 
00170 }
00171 // ============================================================================
00172 // get the counter by name
00173 // ============================================================================
00174 const StatEntity* GaudiPython::AlgDecorator::_counter_a_ 
00175 ( const IAlgorithm* cmp , const std::string& name )
00176 {
00177   if ( 0 == cmp ) { return 0 ; }                                      // RETURN 
00178   return _counter_a_ ( dynamic_cast<const GaudiAlgorithm*>( cmp ) , name ) ;
00179 }
00180 // ============================================================================
00181 // get the counter by name
00182 // ============================================================================
00183 const StatEntity* GaudiPython::AlgDecorator::_counter_t_ 
00184 ( const IAlgTool* cmp , const std::string& name )
00185 {
00186   if ( 0 == cmp ) { return 0 ; }                                      // RETURN 
00187   return _counter_t_ ( dynamic_cast<const GaudiTool*>( cmp ) , name ) ;
00188 }
00189 // ============================================================================
00190 // get all tools 
00191 // ============================================================================
00192 size_t GaudiPython::AlgDecorator::_tools_a_ 
00193 ( const GaudiAlgorithm* cmp , GaudiPython::AlgDecorator::Tools& tools ) 
00194 {
00195   tools.clear() ;
00196   if ( 0 == cmp ) { return 0 ; }                                      // REUTRN 
00197   tools = cmp->tools() ;
00198   return tools.size() ;                                               // RETURN 
00199 }
00200 // ============================================================================
00201 // get all tools 
00202 // ============================================================================
00203 size_t GaudiPython::AlgDecorator::_tools_t_ 
00204 ( const GaudiTool* cmp , GaudiPython::AlgDecorator::Tools& tools ) 
00205 {
00206   tools.clear() ;
00207   if ( 0 == cmp ) { return 0 ; }                                      // REUTRN 
00208   tools = cmp->tools() ;
00209   return tools.size() ;                                               // RETURN 
00210 }
00211 // ============================================================================
00212 // get all tools 
00213 // ============================================================================
00214 size_t GaudiPython::AlgDecorator::_tools_a_ 
00215 ( const IAlgorithm* cmp , GaudiPython::AlgDecorator::Tools& tools ) 
00216 {
00217   tools.clear() ;
00218   if ( 0 == cmp ) { return 0 ; }                                      // RETURN 
00219   return _tools_a_ ( dynamic_cast<const GaudiAlgorithm*> ( cmp ) , tools ) ;  
00220 }
00221 // ============================================================================
00222 // get all tools 
00223 // ============================================================================
00224 size_t GaudiPython::AlgDecorator::_tools_t_ 
00225 ( const IAlgTool* cmp , GaudiPython::AlgDecorator::Tools& tools ) 
00226 {
00227   tools.clear() ;
00228   if ( 0 == cmp ) { return 0 ; }                                      // RETURN 
00229   return _tools_t_ ( dynamic_cast<const GaudiTool*> ( cmp ) , tools ) ;  
00230 }
00231 // ============================================================================
00232 // The END 
00233 // ============================================================================
00234 
00235 
00236 
00237 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 23:27:27 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004