00001
00002
00003
00004
00005
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 #include "GaudiKernel/DataObject.h"
00013
00014
00015
00016 #include "GaudiAlg/GaudiAlgorithm.h"
00017 #include "GaudiAlg/GaudiTool.h"
00018
00019
00020
00021 #include "GaudiPython/AlgDecorators.h"
00022
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 IAlgTool* GaudiPython::AlgDecorator::tool_
00039 ( const GaudiAlgorithm* alg ,
00040 const std::string& type ,
00041 const std::string& name ,
00042 const IInterface* parent ,
00043 const bool create )
00044 {
00045 if ( 0 == alg ) { return 0 ; }
00046 return alg -> tool<IAlgTool> ( type , name , parent , create ) ;
00047 }
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 IAlgTool* GaudiPython::AlgDecorator::tool_
00058 ( const GaudiAlgorithm* alg ,
00059 const std::string& typeAndName ,
00060 const IInterface* parent ,
00061 const bool create )
00062 {
00063 if ( 0 == alg ) { return 0 ; }
00064 return alg->tool<IAlgTool>( typeAndName , parent , create ) ;
00065 }
00066
00067
00068
00069
00070
00071
00072
00073
00074 IInterface* GaudiPython::AlgDecorator::svc_
00075 ( const GaudiAlgorithm* alg ,
00076 const std::string& name ,
00077 const bool create )
00078 {
00079 if ( 0 == alg ) { return 0 ; }
00080 return alg -> svc<IInterface> ( name , create ) ;
00081 }
00082
00083
00084
00085 size_t GaudiPython::AlgDecorator::_counters_a_
00086 ( const GaudiAlgorithm* alg ,
00087 std::vector<std::string>& names ,
00088 GaudiPython::AlgDecorator::Counters& out )
00089 {
00090 typedef std::map<std::string,StatEntity> Stats ;
00091 names.clear () ;
00092 out.clear () ;
00093 if ( 0 == alg ) { return 0 ; }
00094
00095 const Stats& counters = alg->counters() ;
00096 for ( Stats::const_iterator icnt = counters.begin() ;
00097 counters.end() != icnt ; ++icnt )
00098 {
00099 names.push_back ( icnt->first ) ;
00100 out .push_back ( &(icnt->second) ) ;
00101 }
00102 return out.size() ;
00103 }
00104
00105
00106
00107 size_t GaudiPython::AlgDecorator::_counters_t_
00108 ( const GaudiTool* alg ,
00109 std::vector<std::string>& names ,
00110 GaudiPython::AlgDecorator::Counters& out )
00111 {
00112 typedef std::map<std::string,StatEntity> Stats ;
00113 names.clear () ;
00114 out.clear () ;
00115 if ( 0 == alg ) { return 0 ; }
00116
00117 const Stats& counters = alg->counters() ;
00118 for ( Stats::const_iterator icnt = counters.begin() ;
00119 counters.end() != icnt ; ++icnt )
00120 {
00121 names.push_back ( icnt->first ) ;
00122 out .push_back ( &(icnt->second) ) ;
00123 }
00124 return out.size() ;
00125 }
00126
00127
00128
00129 size_t GaudiPython::AlgDecorator::_counters_a_
00130 ( const IAlgorithm* alg ,
00131 std::vector<std::string>& names ,
00132 GaudiPython::AlgDecorator::Counters& out )
00133 {
00134 names.clear () ;
00135 out.clear () ;
00136 if ( 0 == alg ) { return 0 ; }
00137
00138 return _counters_a_ ( dynamic_cast<const GaudiAlgorithm*>( alg ) , names , out ) ;
00139 }
00140
00141
00142
00143 size_t GaudiPython::AlgDecorator::_counters_t_
00144 ( const IAlgTool* alg ,
00145 std::vector<std::string>& names ,
00146 GaudiPython::AlgDecorator::Counters& out )
00147 {
00148 names.clear () ;
00149 out.clear () ;
00150 if ( 0 == alg ) { return 0 ; }
00151
00152 return _counters_t_ ( dynamic_cast<const GaudiTool*>( alg ) , names , out ) ;
00153 }
00154
00155
00156
00157 const StatEntity* GaudiPython::AlgDecorator::_counter_a_
00158 ( const GaudiAlgorithm* cmp , const std::string& name )
00159 {
00160 if ( 0 == cmp ) { return 0 ; }
00161 return &( cmp -> counter ( name ) ) ;
00162 }
00163
00164
00165
00166 const StatEntity* GaudiPython::AlgDecorator::_counter_t_
00167 ( const GaudiTool* cmp , const std::string& name )
00168 {
00169 if ( 0 == cmp ) { return 0 ; }
00170 return &( cmp -> counter ( name ) ) ;
00171 }
00172
00173
00174
00175 const StatEntity* GaudiPython::AlgDecorator::_counter_a_
00176 ( const IAlgorithm* cmp , const std::string& name )
00177 {
00178 if ( 0 == cmp ) { return 0 ; }
00179 return _counter_a_ ( dynamic_cast<const GaudiAlgorithm*>( cmp ) , name ) ;
00180 }
00181
00182
00183
00184 const StatEntity* GaudiPython::AlgDecorator::_counter_t_
00185 ( const IAlgTool* cmp , const std::string& name )
00186 {
00187 if ( 0 == cmp ) { return 0 ; }
00188 return _counter_t_ ( dynamic_cast<const GaudiTool*>( cmp ) , name ) ;
00189 }
00190
00191
00192
00193 size_t GaudiPython::AlgDecorator::_tools_a_
00194 ( const GaudiAlgorithm* cmp , GaudiPython::AlgDecorator::Tools& tools )
00195 {
00196 tools.clear() ;
00197 if ( 0 == cmp ) { return 0 ; }
00198 tools = cmp->tools() ;
00199 return tools.size() ;
00200 }
00201
00202
00203
00204 size_t GaudiPython::AlgDecorator::_tools_t_
00205 ( const GaudiTool* cmp , GaudiPython::AlgDecorator::Tools& tools )
00206 {
00207 tools.clear() ;
00208 if ( 0 == cmp ) { return 0 ; }
00209 tools = cmp->tools() ;
00210 return tools.size() ;
00211 }
00212
00213
00214
00215 size_t GaudiPython::AlgDecorator::_tools_a_
00216 ( const IAlgorithm* cmp , GaudiPython::AlgDecorator::Tools& tools )
00217 {
00218 tools.clear() ;
00219 if ( 0 == cmp ) { return 0 ; }
00220 return _tools_a_ ( dynamic_cast<const GaudiAlgorithm*> ( cmp ) , tools ) ;
00221 }
00222
00223
00224
00225 size_t GaudiPython::AlgDecorator::_tools_t_
00226 ( const IAlgTool* cmp , GaudiPython::AlgDecorator::Tools& tools )
00227 {
00228 tools.clear() ;
00229 if ( 0 == cmp ) { return 0 ; }
00230 return _tools_t_ ( dynamic_cast<const GaudiTool*> ( cmp ) , tools ) ;
00231 }
00232
00233
00234
00235
00236
00237
00238
00239
00240 bool GaudiPython::AlgDecorator::exist
00241 ( const GaudiAlgorithm* alg ,
00242 const std::string& location ,
00243 const bool useRootInTes )
00244 {
00245 if ( 0 == alg ) { return false ; }
00246 return alg -> exist<DataObject> ( alg->evtSvc() , location , useRootInTes ) ;
00247 }
00248
00249
00250
00251
00252
00253
00254
00255
00256 DataObject* GaudiPython::AlgDecorator::get_
00257 ( const GaudiAlgorithm* alg ,
00258 const std::string& location ,
00259 const bool useRootInTes )
00260 {
00261 if ( 0 == alg ) { return 0 ; }
00262 return alg->get<DataObject> ( alg->evtSvc() , location , useRootInTes ) ;
00263 }
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273