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