00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <algorithm>
00012 #include <cstdlib>
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "GaudiKernel/IDataProviderSvc.h"
00026 #include "GaudiKernel/IToolSvc.h"
00027 #include "GaudiKernel/IProperty.h"
00028 #include "GaudiKernel/Property.h"
00029 #include "GaudiKernel/ISvcLocator.h"
00030 #include "GaudiKernel/MsgStream.h"
00031 #include "GaudiKernel/ObjectVector.h"
00032 #include "GaudiKernel/SmartDataPtr.h"
00033 #include "GaudiKernel/SmartRef.h"
00034 #include "GaudiKernel/Stat.h"
00035 #include "GaudiKernel/System.h"
00036 #include "GaudiKernel/IJobOptionsSvc.h"
00037 #include "GaudiKernel/StatEntity.h"
00038 #include "GaudiKernel/Algorithm.h"
00039 #include "GaudiKernel/AlgTool.h"
00040
00041
00042
00043 #include "GaudiAlg/Print.h"
00044 #include "GaudiAlg/GaudiCommon.h"
00045 #include "GaudiAlg/GaudiAlgorithm.h"
00046 #include "GaudiAlg/GaudiTool.h"
00047
00048
00049
00050 #include "GaudiUtils/RegEx.h"
00051
00052
00053
00054 #include "boost/format.hpp"
00055 #include "boost/lexical_cast.hpp"
00056
00057
00058 #ifdef _WIN32
00059 #pragma warning ( disable:4661 ) // incomplete explicit templates
00060 #endif
00061
00062
00063
00064
00065
00066 template <class PBASE>
00067 void
00068 GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
00069 {
00070
00071 m_msgLevel = MSG::NIL;
00072 m_msgStream = 0;
00073 m_updMgrSvc = 0;
00074 m_fastContainersSvc = 0;
00075 m_typePrint = true;
00076 m_propsPrint = false;
00077 m_statPrint = true;
00078 m_errorsPrint = true;
00079 m_context = "" ;
00080 m_rootInTES = "" ;
00081 m_globalTimeOffset = 0.0 ;
00082
00083 m_counterSummarySvc=NULL;
00084 m_counterList=std::vector<std::string>(1,".*");
00085 m_statEntityList=std::vector<std::string>(0);
00086
00087
00088
00089
00090 m_header = " | Counter | # | sum | mean/eff^* | rms/err^* | min | max |" ;
00091
00092 m_format1 = " | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" ;
00093
00094 m_format2 = " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |" ;
00095
00096 m_useEffFormat = true ;
00097
00098
00099
00100 this->declareProperty
00101 ( "ErrorsPrint" , m_errorsPrint ,
00102 "Print the statistics of errors/warnings/exceptions")
00103 -> declareUpdateHandler
00104 ( &GaudiCommon<PBASE>::printErrorHandler, this ) ;
00105
00106 this->declareProperty
00107 ( "PropertiesPrint" , m_propsPrint ,
00108 "Print the properties of the component ")
00109 -> declareUpdateHandler
00110 ( &GaudiCommon<PBASE>::printPropsHandler, this ) ;
00111
00112 this->declareProperty
00113 ( "StatPrint" , m_statPrint ,
00114 "Print the table of counters" )
00115 -> declareUpdateHandler
00116 ( &GaudiCommon<PBASE>::printStatHandler, this ) ;
00117
00118 this->declareProperty
00119 ( "TypePrint" , m_typePrint ,
00120 "Add the actal C++ component type into the messages" ) ;
00121
00122 this->declareProperty ( "Context" , m_context ) ;
00123
00124 this->declareProperty ( "RootInTES" , m_rootInTES ) ;
00125
00126 this->declareProperty ( "RootOnTES" , m_rootOnTES ) ;
00127
00128 this->declareProperty ( "GlobalTimeOffset", m_globalTimeOffset ) ;
00129
00130
00131
00132 this->declareProperty
00133 ( "StatTableHeader" , m_header ,
00134 "The header row for the output Stat-table" ) ;
00135
00136 this->declareProperty
00137 ( "RegularRowFormat" , m_format1 ,
00138 "The format for the regular row in the output Stat-table" ) ;
00139
00140 this->declareProperty
00141 ( "EfficiencyRowFormat" , m_format2 ,
00142 "The format for the regular row in the output Stat-table" ) ;
00143
00144 this->declareProperty
00145 ( "UseEfficiencyRowFormat" , m_useEffFormat ,
00146 "Use the special format for printout of efficiency counters" ) ;
00147
00148
00149
00150 this->declareProperty(
00151 "CounterList",
00152 m_counterList=std::vector<std::string>(1,".*"),
00153 "RegEx list, of simple integer counters for CounterSummary.");
00154
00155 this->declareProperty(
00156 "StatEntityList",
00157 m_statEntityList=std::vector<std::string>(0),
00158 "RegEx list, of StatEntity counters for CounterSummary.");
00159
00160
00161 this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this );
00162
00163
00164 if ( parent )
00165 {
00166 if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>(parent) )
00167 {
00168 m_context = gAlg->context();
00169 m_rootInTES = gAlg->rootInTES();
00170 m_globalTimeOffset = gAlg->globalTimeOffset();
00171 }
00172 else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*> (parent) )
00173 {
00174 m_context = gTool->context();
00175 m_rootInTES = gTool->rootInTES();
00176 m_globalTimeOffset = gTool->globalTimeOffset();
00177 }
00178 }
00179
00180
00181 IJobOptionsSvc* jos = svc<IJobOptionsSvc>( "JobOptionsSvc" );
00182
00183
00184 const std::vector<const Property*>* myList = jos->getProperties( this->name() );
00185 if ( 0 != myList )
00186 {
00187
00188 for ( std::vector<const Property*>::const_iterator iter = myList->begin();
00189 iter != myList->end();
00190 ++iter )
00191 {
00192 const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter);
00193 if ( 0 != sp )
00194 {
00195 if ( "Context" == (*iter)->name() )
00196 {
00197 m_context = sp->value();
00198 } else if ( "RootInTES" == (*iter)->name() ) {
00199 m_rootInTES = sp->value();
00200 } else if ( "GlobalTimeOffset" == (*iter)->name() ) {
00201 m_globalTimeOffset = atof( sp->value().c_str() );
00202 }
00203 }
00204 }
00205 }
00206
00207
00208 release( jos ).ignore();
00209
00210 }
00211
00212
00213
00214
00215
00216 template < class PBASE >
00217 StatusCode GaudiCommon<PBASE>::
00218 #ifdef __ICC
00219 i_gcInitialize
00220 #else
00221 initialize
00222 #endif
00223 ()
00224 {
00225
00226
00227 const StatusCode sc = PBASE::initialize();
00228 if ( sc.isFailure() )
00229 { return Error ( "Failed to initialise base class PBASE", sc ) ; }
00230
00231
00232
00233 if ( msgLevel(MSG::DEBUG) )
00234 {
00235 debug() << "Initialize base class GaudiCommon<" << System::typeinfoName(typeid(PBASE)) << ">" << endmsg;
00236 if ( !context().empty() )
00237 debug() << "Created with context = '" << context() << "'" << endmsg;
00238 }
00239
00240
00241
00242 if ( m_rootInTES.empty() && !m_rootOnTES.empty() )
00243 {
00244 m_rootInTES = m_rootOnTES;
00245 Warning( "RootOnTES option is OBSOLETE -> Use RootInTES instead. RootInTES has been updated to "
00246 + m_rootInTES, StatusCode::SUCCESS ).ignore();
00247 }
00248 else if ( !m_rootInTES.empty() && !m_rootOnTES.empty() )
00249 {
00250 Warning( "Options RootOnTES AND RootInTES are defined ! Use RootInTES. RootOnTES is ignored",
00251 StatusCode::SUCCESS ).ignore();
00252 }
00253
00254
00255 if ( !m_rootInTES.empty() &&
00256 m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/";
00257
00258
00259 this->svcLoc()->service("CounterSummarySvc",m_counterSummarySvc,false).ignore() ;
00260 if (msgLevel(MSG::DEBUG))
00261 {
00262 if (m_counterSummarySvc==NULL )
00263 debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
00264 else debug() << "found CounterSummarySvc OK" << endmsg;
00265 }
00266
00267
00268 if ( propsPrint() ) { printProps(MSG::ALWAYS); }
00269 else if ( msgLevel(MSG::DEBUG) ) { printProps(MSG::DEBUG); }
00270
00271 return sc;
00272 }
00273
00274
00275
00276
00277
00278 template < class PBASE >
00279 StatusCode GaudiCommon<PBASE>::
00280 #ifdef __ICC
00281 i_gcFinalize
00282 #else
00283 finalize
00284 #endif
00285 ()
00286 {
00287 StatusCode sc = StatusCode::SUCCESS;
00288
00289
00290 if ( msgLevel(MSG::DEBUG) || (statPrint() && !counters().empty()) )
00291 {
00292
00293 printStat ( statPrint() ? MSG::ALWAYS : MSG::DEBUG ) ;
00294 }
00295
00296 if(m_counterSummarySvc && this->svcLoc()->existsService("CounterSummarySvc"))
00297 {
00298 if ( msgLevel(MSG::DEBUG) ) debug() << "adding counters to CounterSummarySvc" << endmsg;
00299 for(Statistics::const_iterator i=this->counters().begin();
00300 i!=this->counters().end();
00301 i++)
00302 {
00303 if(Gaudi::Utils::RegEx::matchOr(i->first,m_statEntityList))
00304 m_counterSummarySvc->addCounter(this->name(),i->first,i->second,
00305 Gaudi::CounterSummary::SaveStatEntity);
00306 else if(Gaudi::Utils::RegEx::matchOr(i->first,m_counterList))
00307 m_counterSummarySvc->addCounter(this->name(),i->first,i->second);
00308 }
00309 }
00310
00311 if ( msgLevel(MSG::DEBUG) )
00312 {
00313 debug() << "Tools to release :";
00314 for ( AlgTools::const_iterator i = m_tools.begin();
00315 i != m_tools.end(); ++i )
00316 {
00317 debug() << " " << (*i)->name();
00318 }
00319 debug() << endmsg;
00320 }
00321 while ( !m_tools.empty() ) { sc = sc && releaseTool( m_tools.back() ) ; }
00322
00323
00324 if ( msgLevel(MSG::DEBUG) )
00325 {
00326 debug() << "Services to release :";
00327 for ( Services::const_iterator i = m_services.begin();
00328 i != m_services.end(); ++i )
00329 {
00330 debug() << " " << (*i).first;
00331 }
00332 debug() << endmsg;
00333 }
00334 while ( !m_services.empty() ) { sc = sc && releaseSvc( m_services.begin()->second ) ; }
00335
00336
00337 if(m_counterSummarySvc)
00338 {
00339 m_counterSummarySvc->release();
00340 m_counterSummarySvc=NULL;
00341 }
00342
00343
00344 if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() )
00345 {
00346 always() << "Exceptions/Errors/Warnings/Infos Statistics : "
00347 << m_exceptions .size () << "/"
00348 << m_errors .size () << "/"
00349 << m_warnings .size () << "/"
00350 << m_infos .size () << endmsg ;
00351 if ( errorsPrint() ) { printErrors () ; }
00352 }
00353
00354
00355 resetMsgStream();
00356
00357
00358 m_counters .clear() ;
00359 m_exceptions .clear() ;
00360 m_infos .clear() ;
00361 m_warnings .clear() ;
00362 m_errors .clear() ;
00363 m_counterList.clear() ;
00364 m_statEntityList.clear() ;
00365
00366
00367 return sc && PBASE::finalize();
00368 }
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 template < class PBASE >
00379 StatusCode GaudiCommon<PBASE>::release ( const IInterface* interface ) const
00380 {
00381 if ( 0 == interface )
00382 { return Error ( "release(IInterface):: IInterface* points to NULL!" ) ; }
00383
00384 const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface ) ;
00385
00386 return 0 != algTool ? releaseTool( algTool ) : releaseSvc( interface ) ;
00387 }
00388
00389
00390
00391
00392
00393 template < class PBASE >
00394 StatusCode GaudiCommon<PBASE>::releaseTool ( const IAlgTool* algTool ) const
00395 {
00396 if( 0 == algTool )
00397 { return Error ( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ) ; }
00398 if( this->toolSvc() == 0 )
00399 { return Error ( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ) ; }
00400
00401 AlgTools::reverse_iterator it =
00402 std::find( m_tools.rbegin() , m_tools.rend() , algTool ) ;
00403 if( m_tools.rend() == it )
00404 { return Warning("releaseTool(IAlgTool):: IAlgTool* is not active" ) ; }
00405
00406 IAlgTool* t = *it ;
00407
00408 const std::string name = t->name();
00409 if ( msgLevel(MSG::DEBUG) )
00410 { debug() << "Releasing tool '" << name << "'" << endmsg; }
00411
00412 m_tools.erase( --it.base() ) ;
00413
00414 if ( msgLevel(MSG::DEBUG) ) {
00415 this->debug() << "The tool '" << t->name() << "' of type '"
00416 << System::typeinfoName(typeid(*t))
00417 << "' is released" << endmsg;
00418 }
00419 const StatusCode sc = this->toolSvc()->releaseTool( t ) ;
00420 if ( sc.isFailure() )
00421 { return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; }
00422
00423 return sc ;
00424 }
00425
00426
00427
00428
00429
00430 template < class PBASE >
00431 StatusCode GaudiCommon<PBASE>::releaseSvc ( const IInterface* Svc ) const
00432 {
00433 if( 0 == Svc ) {
00434 return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ;
00435 }
00436 SmartIF<IService> svc(const_cast<IInterface*>(Svc));
00437 if (svc.isValid()) {
00438 Services::iterator it = m_services.find(svc->name());
00439 if (it == m_services.end()) {
00440 return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
00441 }
00442 if ( msgLevel(MSG::DEBUG) ) {
00443 debug() << "Releasing service '" << it->first << "'" << endmsg;
00444 }
00445 m_services.erase(it);
00446 return StatusCode::SUCCESS;
00447 }
00448 return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
00449 }
00450
00451
00452
00453
00454
00455 template < class PBASE >
00456 void GaudiCommon<PBASE>::addToToolList( IAlgTool * tool ) const
00457 {
00458 if( 0 != tool ) {
00459 if ( this->msgLevel ( MSG::DEBUG ) ) {
00460 this->debug() << "The tool of type '"
00461 << System::typeinfoName(typeid(*tool))
00462 << "' has been added with the name '"
00463 << tool->name() << "'" << endmsg ;
00464 }
00465 m_tools.push_back( tool ) ;
00466 }
00467 }
00468
00469
00470
00471
00472
00473 template < class PBASE >
00474 void GaudiCommon<PBASE>::addToServiceList( const SmartIF<IService>& svc ) const
00475 {
00476 if (svc.isValid()) {
00477 m_services[svc->name()] = svc;
00478 }
00479 }
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489 template < class PBASE >
00490 StatusCode GaudiCommon<PBASE>::Error( const std::string& msg ,
00491 const StatusCode st ,
00492 const size_t mx ) const
00493 {
00494
00495 const size_t num = ++m_errors[msg] ;
00496
00497 if ( num > mx ) { return st ; }
00498 else if ( num == mx )
00499 { return Print ( "The ERROR message is suppressed : '" +
00500 msg + "'" , st , MSG::ERROR ) ; }
00501
00502 return Print ( msg , st , MSG::ERROR ) ;
00503 }
00504
00505
00506
00507
00508
00509 template < class PBASE >
00510 StatusCode GaudiCommon<PBASE>::Warning
00511 ( const std::string& msg ,
00512 const StatusCode st ,
00513 const size_t mx ) const
00514 {
00515
00516 const size_t num = ++m_warnings[msg] ;
00517
00518 if ( num > mx ) { return st ; }
00519 else if ( num == mx )
00520 { return Print ( "The WARNING message is suppressed : '" +
00521 msg + "'" , st , MSG::WARNING ) ; }
00522
00523 return Print ( msg , st , MSG::WARNING ) ;
00524 }
00525
00526
00527
00528
00529
00530 template < class PBASE >
00531 StatusCode GaudiCommon<PBASE>::Info
00532 ( const std::string& msg ,
00533 const StatusCode st ,
00534 const size_t mx ) const
00535 {
00536
00537 const size_t num = ++m_infos[msg] ;
00538
00539 if ( num > mx ) { return st ; }
00540 else if ( num == mx )
00541 { return Print ( "The INFO message is suppressed : '" +
00542 msg + "'" , st , MSG::INFO ) ; }
00543
00544 return Print ( msg , st , MSG::INFO ) ;
00545 }
00546
00547
00548
00549
00550
00551 template < class PBASE >
00552 StatusCode GaudiCommon<PBASE>::Print( const std::string& msg ,
00553 const StatusCode st ,
00554 const MSG::Level lvl ) const
00555 {
00556
00557 if ( !msgLevel( lvl ) ) { return st ; }
00558
00559
00560 MsgStream& str = msgStream( lvl ) ;
00561 if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; }
00562
00563 str << msg ;
00564
00565 if ( st.isSuccess() ) { }
00566 else if ( StatusCode::FAILURE != st.getCode() )
00567 { str << " StatusCode=" << st.getCode() ; }
00568 else
00569 { str << " StatusCode=FAILURE" ; }
00570
00571 str << endmsg ;
00572
00573 return st;
00574 }
00575
00576
00577
00578
00579
00580 template < class PBASE >
00581 void GaudiCommon<PBASE>::Exception( const std::string & msg ,
00582 const GaudiException & exc ,
00583 const StatusCode sc ) const
00584 {
00585
00586 ++m_exceptions[ msg ];
00587 Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL );
00588 throw GaudiException( this->name() + ":: " + msg , this->name() , sc, exc);
00589 }
00590
00591
00592
00593
00594
00595 template < class PBASE >
00596 void GaudiCommon<PBASE>::Exception( const std::string & msg ,
00597 const std::exception & exc ,
00598 const StatusCode sc ) const
00599 {
00600
00601 ++m_exceptions[ msg ];
00602 Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL );
00603 throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc );
00604 }
00605
00606
00607
00608
00609
00610 template < class PBASE >
00611 void GaudiCommon<PBASE>::Exception( const std::string & msg ,
00612 const StatusCode sc ) const
00613 {
00614
00615 ++m_exceptions[ msg ];
00616 Print ( "Exception throw: " + msg , sc , MSG::FATAL );
00617 throw GaudiException( this->name() + ":: " + msg , "", sc );
00618 }
00619
00620
00621
00622
00623
00624 template < class PBASE >
00625 long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
00626 {
00627
00628 if ( counters().empty() ) { return 0 ; }
00629 MsgStream& msg = msgStream ( level ) ;
00630
00631 msg << "Number of counters : " << counters().size() ;
00632
00633 if ( !counters().empty() ) { msg << std::endl << m_header ; }
00634
00635 for ( Statistics::const_iterator entry = counters().begin() ;
00636 counters().end() != entry ; ++entry )
00637 {
00638 msg << std::endl
00639 << Gaudi::Utils::formatAsTableRow
00640 ( entry -> first ,
00641 entry -> second ,
00642 m_useEffFormat ,
00643 m_format1 , m_format2 );
00644 }
00645
00646 msg << endmsg ;
00647
00648 return counters().size() ;
00649 }
00650
00651
00652
00653
00654
00655 template < class PBASE >
00656 long GaudiCommon<PBASE>::printErrors ( const MSG::Level level ) const
00657 {
00658
00659 boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" );
00660
00661 {
00662 for ( Counter::const_iterator excp = m_exceptions.begin() ;
00663 excp != m_exceptions.end() ; ++excp )
00664 {
00665 msgStream(level)
00666 << ( ftm % "#EXCEPTIONS" % excp->second % excp->first )
00667 << endmsg;
00668 }
00669 }
00670 {
00671 for ( Counter::const_iterator error = m_errors.begin() ;
00672 error != m_errors.end() ; ++error )
00673 {
00674 msgStream(level)
00675 << ( ftm % "#ERRORS " % error->second % error->first )
00676 << endmsg;
00677 }
00678 }
00679 {
00680 for ( Counter::const_iterator warning = m_warnings.begin() ;
00681 warning != m_warnings.end() ; ++warning )
00682 {
00683 msgStream(level)
00684 << ( ftm % "#WARNINGS " % warning->second % warning->first )
00685 << endmsg;
00686 }
00687 }
00688 {
00689 for ( Counter::const_iterator info = m_infos.begin() ;
00690 info != m_infos.end() ; ++info )
00691 {
00692 msgStream(level)
00693 << ( ftm % "#INFOS " % info->second % info->first )
00694 << endmsg;
00695 }
00696 }
00697
00698
00699 return
00700 m_exceptions .size () +
00701 m_errors .size () +
00702 m_warnings .size () +
00703 m_infos .size () ;
00704 }
00705
00706
00707
00711
00712 template < class PBASE >
00713 long GaudiCommon<PBASE>::printProps ( const MSG::Level level ) const
00714 {
00715
00716
00717 MsgStream& msg = msgStream ( level );
00718 typedef std::vector<Property*> Properties;
00719 const Properties& properties = this->getProperties() ;
00720 msg << "List of ALL properties of "
00721 << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
00722 << " #properties = " << properties.size() << endmsg ;
00723 for ( Properties::const_reverse_iterator property
00724 = properties.rbegin() ;
00725 properties.rend() != property ; ++property )
00726 {
00727 msg << "Property ['Name': Value] = "
00728 << ( **property)
00729 << endmsg ;
00730 }
00731 return properties.size() ;
00732 }
00733
00734
00735
00736
00737
00738 template < class PBASE >
00739 void GaudiCommon<PBASE>::msgLevelHandler ( Property & theProp )
00740 {
00741
00742 resetMsgStream();
00743
00744
00745 m_msgLevel =
00746 this->outputLevel() < (int) MSG::NIL ? MSG::NIL :
00747 this->outputLevel() >= (int) MSG::NUM_LEVELS ? MSG::ALWAYS :
00748 MSG::Level( this->outputLevel() ) ;
00749
00750
00751 if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() )
00752 {
00753 this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() );
00754 }
00755
00756
00757 if ( msgLevel(MSG::DEBUG) )
00758 {
00759 debug() << "Property update for "
00760 << theProp.name() << " : new value = " << this->outputLevel() << endmsg;
00761 }
00762 }
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772 template < class PBASE >
00773 DataObject* GaudiCommon<PBASE>::put ( IDataProviderSvc* svc ,
00774 DataObject* object ,
00775 const std::string& location ,
00776 const bool useRootInTES ) const
00777 {
00778
00779 Assert ( 0 != svc , "put():: Invalid 'service'!" ) ;
00780 Assert ( 0 != object , "put():: Invalid 'Object'!" ) ;
00781 Assert ( !location.empty() , "put():: Invalid 'address' = '' " ) ;
00782
00783 const std::string & fullLocation = fullTESLocation( location, useRootInTES );
00784
00785 const StatusCode status = '/' == fullLocation[0] ?
00786 svc -> registerObject( fullLocation , object ) :
00787 svc -> registerObject( "/Event/" + fullLocation , object ) ;
00788
00789 if ( status.isFailure() )
00790 { Exception ( "put():: could not register '" +
00791 System::typeinfoName( typeid( *object ) ) +
00792 "' at address '" + fullLocation + "'" , status ) ; }
00793 if ( msgLevel( MSG::DEBUG ) )
00794 { Print( "The object of type '" +
00795 System::typeinfoName( typeid( *object ) ) +
00796 "' is registered in TS at address '"
00797 + fullLocation + "'" , status , MSG::DEBUG ) ; }
00798 return object;
00799 }
00800
00801
00802
00803
00804
00805 template < class PBASE >
00806 void GaudiCommon<PBASE>::printErrorHandler ( Property& )
00807 {
00808
00809 if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
00810 if ( this -> errorsPrint() ) { this -> printErrors () ; }
00811 }
00812
00813
00814
00815 template < class PBASE >
00816 void GaudiCommon<PBASE>::printPropsHandler ( Property& )
00817 {
00818
00819 if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
00820 if ( this -> propsPrint() ) { this -> printProps ( MSG::ALWAYS ) ; }
00821 }
00822
00823
00824
00825 template < class PBASE >
00826 void GaudiCommon<PBASE>::printStatHandler ( Property& )
00827 {
00828
00829 if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
00830 if ( this -> statPrint() ) { this -> printStat ( MSG::ALWAYS ) ; }
00831 }
00832
00833
00834
00835
00836
00837
00838
00839