Gaudi Framework, version v20r4

Generated: 8 Jan 2009

GaudiCommon.icpp

Go to the documentation of this file.
00001 // $Id: GaudiCommon.icpp,v 1.22 2008/10/10 15:18:56 marcocle Exp $
00002 
00003 // ============================================================================
00004 // CVS tag $Name:  $ version $Revision: 1.22 $
00005 // ============================================================================
00006 // ============================================================================
00007 // include files
00008 // ============================================================================
00009 // STL & STD
00010 // ============================================================================
00011 #include <algorithm>
00012 #include <cstdlib>
00013 // ============================================================================
00014 /* @file GaudiCommon.cpp
00015  *
00016  *  Implementation file for class : GaudiCommon
00017  *
00018  *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
00019  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
00020  *  @date   2005-08-08
00021  */
00022 // GaudiKernel
00023 // ============================================================================
00024 #include "GaudiKernel/IDataProviderSvc.h"
00025 #include "GaudiKernel/IToolSvc.h"
00026 #include "GaudiKernel/IProperty.h"
00027 #include "GaudiKernel/Property.h"
00028 #include "GaudiKernel/ISvcLocator.h"
00029 #include "GaudiKernel/MsgStream.h"
00030 #include "GaudiKernel/ObjectVector.h"
00031 #include "GaudiKernel/SmartDataPtr.h"
00032 #include "GaudiKernel/SmartRef.h"
00033 #include "GaudiKernel/Stat.h"
00034 #include "GaudiKernel/System.h"
00035 #include "GaudiKernel/IJobOptionsSvc.h"
00036 #include "GaudiKernel/StatEntity.h"
00037 #include "GaudiKernel/Algorithm.h"
00038 #include "GaudiKernel/AlgTool.h"
00039 // ============================================================================
00040 // GaudiAlg
00041 // ============================================================================
00042 #include "GaudiAlg/Print.h"
00043 #include "GaudiAlg/GaudiCommon.h"
00044 #include "GaudiAlg/GaudiAlgorithm.h"
00045 #include "GaudiAlg/GaudiTool.h"
00046 // ============================================================================
00047 // Boost
00048 // ============================================================================
00049 #include "boost/format.hpp"
00050 #include "boost/lexical_cast.hpp"
00051 // ============================================================================
00052 // Disable warning on windows
00053 #ifdef _WIN32
00054 #pragma warning ( disable:4661 ) // incomplete explicit templates
00055 #endif
00056 // ============================================================================
00057 
00058 //=============================================================================
00059 // Destructor
00060 //=============================================================================
00061 template < class PBASE >
00062 GaudiCommon<PBASE>::~GaudiCommon() { resetMsgStream(); }
00063 //==========================================================================
00064 
00065 // ============================================================================
00066 // constructor initialisation
00067 // ============================================================================
00068 template <class PBASE>
00069 void
00070 GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
00071 {
00072   // initialise data members
00073   m_msgLevel    = MSG::NIL;
00074   m_msgStream   = 0;
00075   m_updMgrSvc   = 0;
00076   m_fastContainersSvc   = 0;
00077   m_typePrint   = true;
00078   m_propsPrint  = false;
00079   m_statPrint   = true;
00080   m_errorsPrint = true;
00081   m_context     = "" ;
00082   m_rootInTES   = "" ;
00083   m_globalTimeOffset = 0.0 ;
00084 
00085   // printout of counters:
00086   
00087   // the header row for counters printout 
00088   m_header  = " |    Counter                                      |     #     |    sum     | mean/eff^* | rms/err^*  |     min     |     max     |" ;
00089   // format for regular statistical printout rows
00090   m_format1 = " | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" ;
00091   // format for "efficiency" statistical printout rows
00092   m_format2 = " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%|   -------   |   -------   |" ;
00093   // flag to use the special "efficiency" format 
00094   m_useEffFormat = true ; 
00095   
00096   
00097   // job options
00098   // print error counters at finalization ?
00099   this->declareProperty ( "ErrorsPrint"     , m_errorsPrint ) ;
00100   // print properties at initalization?
00101   this->declareProperty ( "PropertiesPrint" , m_propsPrint  ) ;
00102   // print statistical counters at finalization ?
00103   this->declareProperty ( "StatPrint"       , m_statPrint   ) ;
00104   // insert  the actual C++ type of the algorithm or tool in the messages?
00105   this->declareProperty ( "TypePrint"       , m_typePrint   ) ;
00106   // context
00107   this->declareProperty ( "Context"         , m_context     ) ;
00108   // root in TES
00109   this->declareProperty ( "RootInTES"       , m_rootInTES   ) ;
00110   // root on TES ( temporary )
00111   this->declareProperty ( "RootOnTES"       , m_rootOnTES   ) ;
00112   // global time offset
00113   this->declareProperty ( "GlobalTimeOffset", m_globalTimeOffset ) ;
00114 
00115 
00116   // the header row for counters printout 
00117   this->declareProperty 
00118     ( "StatTableHeader"        , m_header                          , 
00119       "The header row for the output Stat-table"                   ) ;
00120   // format for regular statistical printout rows
00121   this->declareProperty 
00122     ( "RegularRowFormat"       , m_format1                         , 
00123       "The format for the regular row in the output Stat-table"    ) ;
00124   // format for "efficiency" statistical printout rows
00125   this->declareProperty 
00126     ( "EfficiencyRowFormat"    , m_format2                         , 
00127       "The format for the regular row in the outptu Stat-table"    ) ; 
00128   // flag to use the special "efficiency" format 
00129   this->declareProperty 
00130     ( "UseEfficiencyRowFormat" , m_useEffFormat                    , 
00131       "Use the special format for printout of efficiency counters" ) ;
00132 
00133 
00134   // add handler for message level changes
00135   this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this );
00136 
00137   // setup context from parent if available
00138   if ( parent )
00139   {
00140     if      ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>(parent) )
00141     {
00142       m_context = gAlg->context();
00143       m_rootInTES = gAlg->rootInTES();
00144       m_globalTimeOffset = gAlg->globalTimeOffset();
00145     }
00146     else if ( const GaudiTool*     gTool = dynamic_cast<const GaudiTool*>     (parent) )
00147     {
00148       m_context = gTool->context();
00149       m_rootInTES = gTool->rootInTES();
00150       m_globalTimeOffset = gTool->globalTimeOffset();
00151     }
00152   }
00153 
00154   // Get the job option service
00155   IJobOptionsSvc* jos = svc<IJobOptionsSvc>( "JobOptionsSvc" );
00156 
00157   // Get the "Context" option if in the file...
00158   const std::vector<const Property*>* myList = jos->getProperties( this->name() );
00159   if ( 0 != myList )
00160   {
00161     // Iterate over the list to set the options
00162     for ( std::vector<const Property*>::const_iterator iter = myList->begin();
00163           iter != myList->end();
00164           ++iter )
00165     {
00166       const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter);
00167       if ( 0 != sp )
00168       {
00169         if ( "Context" == (*iter)->name() )
00170         {
00171           m_context = sp->value();
00172         } else if ( "RootInTES" == (*iter)->name() ) {
00173           m_rootInTES = sp->value();
00174         } else if ( "GlobalTimeOffset" == (*iter)->name() ) {
00175           m_globalTimeOffset = atof( sp->value().c_str() );
00176         }
00177       }
00178     }
00179   }
00180 
00181   // release tool
00182   release( jos ).ignore();
00183 
00184 }
00185 //=============================================================================
00186 
00187 //=============================================================================
00188 // Initialise the common functionality
00189 //=============================================================================
00190 template < class PBASE >
00191 StatusCode GaudiCommon<PBASE>::initialize()
00192 {
00193 
00194   // initialize base class
00195   const StatusCode sc = PBASE::initialize();
00196   if ( sc.isFailure() )
00197   { return Error ( "Failed to initialise base class PBASE", sc ) ; }
00198    
00199 
00200   // some debug printout
00201   if ( msgLevel(MSG::DEBUG) )
00202   {
00203     debug() << "Initialize base class GaudiCommon<" << System::typeinfoName(typeid(PBASE)) << ">" << endreq;
00204     if ( !context().empty() )
00205       debug() << "Created with context = '" << context() << "'" << endreq;
00206   }
00207 
00208   // some temporary checks to see if people are using RootOnTES and warn if so
00209   // TO BE REMOVED ASAP ...
00210   if ( m_rootInTES.empty() && !m_rootOnTES.empty() )
00211   {
00212     m_rootInTES = m_rootOnTES;
00213     Warning( "RootOnTES option is OBSOLETE -> Use RootInTES instead. RootInTES has been updated to " 
00214              + m_rootInTES, StatusCode::SUCCESS ).ignore();
00215   }
00216   else if ( !m_rootInTES.empty() && !m_rootOnTES.empty() )
00217   {
00218     Warning( "Options RootOnTES AND RootInTES are defined ! Use RootInTES. RootOnTES is ignored", 
00219              StatusCode::SUCCESS ).ignore();
00220   }
00221 
00222   // Check rootInTES ends with a /
00223   if ( !m_rootInTES.empty() && 
00224        m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/";
00225 
00226   // properties will be printed if asked for or in "MSG::DEBUG" mode
00227   if      ( propsPrint()         ) { printProps(MSG::ALWAYS); }
00228   else if ( msgLevel(MSG::DEBUG) ) { printProps(MSG::DEBUG);  }
00229 
00230   return sc;
00231 }
00232 //=============================================================================
00233 
00234 //=============================================================================
00235 // Finalize the common functionality
00236 //=============================================================================
00237 template < class PBASE >
00238 StatusCode GaudiCommon<PBASE>::finalize()
00239 {
00240   StatusCode sc = StatusCode::SUCCESS;
00241 
00242   // print the general information about statistical counters
00243   if ( msgLevel(MSG::DEBUG) || (statPrint() && !counters().empty()) )
00244   {
00245     // print general statictical counters
00246     printStat ( statPrint() ? MSG::ALWAYS : MSG::DEBUG ) ;
00247   }
00248 
00249   // release all located tools and services
00250   if ( msgLevel(MSG::DEBUG) )
00251   {
00252     debug() << "Tools to release :";
00253     for ( AlgTools::const_iterator i = m_tools.begin();
00254           i != m_tools.end(); ++i )
00255     {
00256       debug() << " " << (*i)->name();
00257     }
00258     debug() << endreq;
00259   }
00260   while ( !m_tools.empty() ) { sc = sc && release( m_tools.back() ) ; }
00261 
00262   // release all located services
00263   if ( msgLevel(MSG::DEBUG) )
00264   {
00265     debug() << "Services to release :";
00266     for ( Services::const_iterator i = m_services.begin();
00267           i != m_services.end(); ++i )
00268     {
00269       debug() << " " << (*i).second;
00270     }
00271     debug() << endreq;
00272   }
00273   while ( !m_services.empty() ) { sc = sc && release( m_services.back().first ); }
00274 
00275   // format printout
00276   if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() )
00277   {
00278     always() << "Exceptions/Errors/Warnings Statistics : "
00279              << m_exceptions .size () << "/"
00280              << m_errors     .size () << "/"
00281              << m_warnings   .size () << endreq ;
00282     if ( errorsPrint() ) { printErrors () ; }
00283   }
00284 
00285   // delete the MsgStream
00286   resetMsgStream();
00287 
00288   // clear *ALL* counters explicitely
00289   m_counters   .clear() ;
00290   m_exceptions .clear() ;
00291   m_warnings   .clear() ;
00292   m_errors     .clear() ;
00293 
00294   // finalize base class
00295   return sc && PBASE::finalize();
00296 }
00297 //=============================================================================
00298 
00299 //=============================================================================
00300 // Methods related to tools and services
00301 //=============================================================================
00302 
00303 // ============================================================================
00304 // manual forced (and 'safe') release of the active tool or service
00305 // ============================================================================
00306 template < class PBASE >
00307 StatusCode GaudiCommon<PBASE>::release ( const IInterface* interface ) const
00308 {
00309   if ( 0 == interface )
00310   { return Error ( "release(IInterface):: IInterface* points to NULL!" ) ; }
00311   // dispatch between tools and services
00312   const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface )  ;
00313   // perform teh actual release
00314   return 0 != algTool ? releaseTool( algTool ) : releaseSvc( interface ) ;
00315 }
00316 // ============================================================================
00317 
00318 // ============================================================================
00319 // manual forced (and 'save') release of the tool
00320 // ============================================================================
00321 template < class PBASE >
00322 StatusCode GaudiCommon<PBASE>::releaseTool ( const IAlgTool* algTool ) const
00323 {
00324   if( 0 == algTool   )
00325   { return Error ( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ) ; }
00326   if( 0 == this->toolSvc() )
00327   { return Error ( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ) ; }
00328   // find a tool in the list of active tools
00329   AlgTools::reverse_iterator it =
00330     std::find( m_tools.rbegin() , m_tools.rend() , algTool ) ;
00331   if(  m_tools.rend() == it )
00332   { return Warning("releaseTool(IAlgTool):: IAlgTool* is not active"   ) ; }
00333   // get the tool
00334   IAlgTool* t = *it ;
00335   // cache name
00336   const std::string name = t->name();
00337   if ( msgLevel(MSG::DEBUG) )
00338   { debug() << "Releasing tool '" << name << "'" << endreq; }
00339   // remove the tool from the lists
00340   m_tools.erase( --it.base() ) ;
00341   // release tool
00342   const StatusCode sc = this->toolSvc()->releaseTool( t ) ;
00343   if ( sc.isFailure() )
00344   { return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; }
00345   // return final status code
00346   return sc ;
00347 }
00348 // ============================================================================
00349 
00350 // ============================================================================
00351 // manual forced (and 'safe') release of the service
00352 // ============================================================================
00353 template < class PBASE >
00354 StatusCode GaudiCommon<PBASE>::releaseSvc ( const IInterface* Svc  ) const
00355 {
00356   if( 0 == Svc )
00357   { return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ; }
00358   // find a service in the list of active services
00359   Services::reverse_iterator iS = m_services.rbegin();
00360   for ( ; iS != m_services.rend(); ++iS ) { if ( (*iS).first == Svc ) break; }
00361   if ( m_services.rend() == iS )
00362   { return Warning( "releaseSvc(IInterface):: IInterface* is not active" ) ; }
00363   // get the service
00364   IInterface * s = (*iS).first ;
00365   if ( msgLevel(MSG::DEBUG) )
00366   { debug() << "Releasing service '" << (*iS).second << "'" << endreq; }
00367   // remove the service from the list of active services
00368   m_services.erase( --iS.base() ) ;
00369   // release the service
00370   s->release() ;
00371   // return
00372   return StatusCode::SUCCESS ;
00373 }
00374 // ============================================================================
00375 
00376 // ============================================================================
00377 // Add the given tool to the list of active tools
00378 // ============================================================================
00379 template < class PBASE >
00380 void GaudiCommon<PBASE>::addToToolList( IAlgTool * tool ) const
00381 {
00382   m_tools.push_back( tool ) ;
00383 }
00384 // ============================================================================
00385 
00386 // ============================================================================
00387 // Add the given service to the list of active services
00388 // ============================================================================
00389 template < class PBASE >
00390 void GaudiCommon<PBASE>::addToServiceList( IInterface * svc,
00391                                            const std::string & name ) const
00392 {
00393   const ServiceEntry sEntry( svc , name );
00394   m_services.push_back( sEntry ) ;
00395 }
00396 // ============================================================================
00397 
00398 //=============================================================================
00399 // Methods related to messaging
00400 //=============================================================================
00401 
00402 // ============================================================================
00403 // Print the error  message and return status code
00404 // ============================================================================
00405 template < class PBASE >
00406 StatusCode GaudiCommon<PBASE>::Error( const std::string& msg ,
00407                                       const StatusCode   st  ,
00408                                       const size_t       mx  ) const
00409 {
00410   // increase local counter of errors
00411   const size_t num = ++m_errors[msg] ;
00412   // If suppressed, just return
00413   if      ( num  > mx ) { return st ; }
00414   else if ( num == mx ) // issue one-time suppresion message
00415   { return Print ( "The   ERROR message is suppressed : '" +
00416                    msg + "'" , st , MSG::ERROR ) ; }
00417   // return message
00418   return Print ( msg , st , MSG::ERROR ) ;
00419 }
00420 // ============================================================================
00421 
00422 // ============================================================================
00423 // Print the warning  message and return status code
00424 // ============================================================================
00425 template < class PBASE >
00426 StatusCode GaudiCommon<PBASE>::Warning
00427 ( const std::string& msg ,
00428   const StatusCode   st  ,
00429   const size_t       mx  ) const
00430 {
00431   // increase local counter of warnings
00432   const size_t num = ++m_warnings[msg] ;
00433   // If suppressed, just return
00434   if      ( num  > mx ) { return st ; }
00435   else if ( num == mx ) // issue one-time suppresion message
00436   { return Print ( "The WARNING message is suppressed : '" +
00437                    msg + "'" , st , MSG::WARNING ) ; }
00438   // return message
00439   return Print ( msg , st , MSG::WARNING ) ;
00440 }
00441 // ============================================================================
00442 
00443 // ============================================================================
00444 //  Print the message and return status code
00445 // ============================================================================
00446 template < class PBASE >
00447 StatusCode GaudiCommon<PBASE>::Print( const std::string& msg ,
00448                                       const StatusCode   st  ,
00449                                       const MSG::Level   lvl ) const
00450 {
00451   // perform printout ?
00452   if ( !msgLevel( lvl ) ) { return st ; }   // RETURN
00453 
00454   // use the predefined stream
00455   MsgStream& str = msgStream( lvl ) ;
00456   if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; }
00457   // print the message
00458   str  << msg ;
00459   // test status code
00460   if      ( st.isSuccess() ) { }
00461   else if ( StatusCode::FAILURE != st.getCode() )
00462   { str << " StatusCode=" << st.getCode() ; }
00463   else
00464   { str << " StatusCode=FAILURE" ; }
00465   // perform print operation
00466   str << endreq ;
00467   // return
00468   return  st;
00469 }
00470 // ============================================================================
00471 
00472 // ============================================================================
00473 // Create and (re)-throw the exception
00474 // ============================================================================
00475 template < class PBASE >
00476 StatusCode GaudiCommon<PBASE>::Exception( const std::string    & msg ,
00477                                           const GaudiException & exc ,
00478                                           const StatusCode       sc  ) const
00479 {
00480   // increase local counter of exceptions
00481   ++m_exceptions[ msg ];
00482   Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL );
00483   throw   GaudiException( this->name() + ":: " + msg , this->name() , sc, exc);
00484   return  sc ;
00485 }
00486 // ============================================================================
00487 
00488 // ============================================================================
00489 // Create and (re)-throw the exception
00490 // ============================================================================
00491 template < class PBASE >
00492 StatusCode GaudiCommon<PBASE>::Exception( const std::string    & msg ,
00493                                           const std::exception & exc ,
00494                                           const StatusCode       sc  ) const
00495 {
00496   // increase local counter of exceptions
00497   ++m_exceptions[ msg ];
00498   Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL  );
00499   throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc );
00500   return  sc ;
00501 }
00502 // ============================================================================
00503 
00504 // ============================================================================
00505 // Create and throw the exception
00506 // ============================================================================
00507 template < class PBASE >
00508 StatusCode GaudiCommon<PBASE>::Exception( const std::string    & msg ,
00509                                           const StatusCode       sc  ) const
00510 {
00511   // increase local counter of exceptions
00512   ++m_exceptions[ msg ];
00513   Print ( "Exception throw: " + msg , sc , MSG::FATAL );
00514   throw GaudiException( this->name() + ":: " + msg , "",  sc );
00515   return  sc ;
00516 }
00517 // ============================================================================
00518 
00519 // ============================================================================
00520 // perform the actual printout of counters
00521 // ============================================================================
00522 template < class PBASE >
00523 long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
00524 {
00525   // print statistics
00526   if ( counters().empty() ) { return 0 ; }
00527   MsgStream& msg = msgStream ( level ) ;
00528   //
00529   msg << "Number of counters : "  << counters().size() ;
00530   //
00531   if ( !counters().empty() ) { msg << std::endl << m_header ; }
00532   //
00533   for ( Statistics::const_iterator entry = counters().begin() ;
00534         counters().end() != entry ; ++entry )
00535   {
00536     msg << std::endl 
00537         << Gaudi::Utils::formatAsTableRow 
00538       ( entry -> first  , 
00539         entry -> second , 
00540         m_useEffFormat  , 
00541         m_format1       , m_format2 );
00542   }
00543   //
00544   msg << endreq ;
00545   //
00546   return counters().size() ;
00547 }
00548 // ============================================================================
00549 
00550 // ============================================================================
00551 // perform the actual printout of error counters
00552 // ============================================================================
00553 template < class PBASE >
00554 long GaudiCommon<PBASE>::printErrors ( const MSG::Level level ) const
00555 {
00556   // format for printout
00557   boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" );
00558 
00559   { // print exceptions
00560     for ( Counter::const_iterator excp = m_exceptions.begin() ;
00561           excp  != m_exceptions.end() ; ++excp  )
00562     {
00563       msgStream(level)
00564         << ( ftm % "#EXCEPTIONS" % excp->second % excp->first       )
00565         << endreq;
00566     }
00567   }
00568   { // print errors
00569     for ( Counter::const_iterator error = m_errors.begin() ;
00570           error != m_errors.end() ; ++error )
00571     {
00572       msgStream(level)
00573         << ( ftm % "#ERRORS    " % error->second % error->first     )
00574         << endreq;
00575     }
00576   }
00577   { // print warnings
00578     for ( Counter::const_iterator warning = m_warnings.begin() ;
00579           warning != m_warnings.end() ; ++warning )
00580     {
00581       msgStream(level)
00582         << ( ftm % "#WARNINGS  " % warning->second % warning->first )
00583         << endreq;
00584     }
00585   }
00586 
00587   // return total number of errors+warnings+exceptions
00588   return
00589     m_exceptions .size () +
00590     m_errors     .size () +
00591     m_warnings   .size () ;
00592 }
00593 // ============================================================================
00594 
00595 // ============================================================================
00599 // ============================================================================
00600 template < class PBASE >
00601 long GaudiCommon<PBASE>::printProps ( const MSG::Level level ) const
00602 {
00603 
00604   // print ALL properties
00605   MsgStream& msg = msgStream ( level );
00606   typedef std::vector<Property*> Properties;
00607   const Properties& properties = this->getProperties() ;
00608   msg << "List of ALL properties of "
00609       << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
00610       << "  #properties = " << properties.size() << endreq ;
00611   for ( Properties::const_reverse_iterator property
00612           = properties.rbegin() ;
00613         properties.rend() != property ; ++property )
00614   {
00615     msg << "Property ['Name': Value] = "
00616         << ( **property)
00617         << endreq ;
00618   }
00619   return properties.size() ;
00620 }
00621 // ============================================================================
00622 
00623 // ============================================================================
00624 // Handle method for changes in the Messaging levels
00625 // ============================================================================
00626 template < class PBASE >
00627 void GaudiCommon<PBASE>::msgLevelHandler ( Property & theProp )
00628 {
00629   // Force a new MsgStream object, to pick up the new settings
00630   resetMsgStream();
00631 
00632   // adjust internal message level
00633   m_msgLevel =
00634     this->outputLevel() <  (int) MSG::NIL        ?  MSG::NIL    :
00635     this->outputLevel() >= (int) MSG::NUM_LEVELS ?  MSG::ALWAYS :
00636     MSG::Level( this->outputLevel() ) ;
00637 
00638   // Keep MessageSvc up to date if needed
00639   if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() )
00640   {
00641     this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() );
00642   }
00643 
00644   // printout message
00645   if ( msgLevel(MSG::DEBUG) )
00646   {
00647     debug() << "Property update for "
00648             << theProp.name() << " : new value = " << this->outputLevel() << endreq;
00649   }
00650 }
00651 // ============================================================================
00652 
00653 // ============================================================================
00654 // Methods for dealing with the TES and TDS
00655 // ============================================================================
00656 
00657 // ============================================================================
00658 // put results into Gaudi Event Transient Store
00659 // ============================================================================
00660 template < class PBASE >
00661 DataObject* GaudiCommon<PBASE>::put ( IDataProviderSvc*  svc     ,
00662                                DataObject*        object  ,
00663                                const std::string& location ,
00664                                const bool useRootInTES ) const
00665 {
00666   // check arguments
00667   Assert ( 0 != svc              , "put():: Invalid 'service'!"       ) ;
00668   Assert ( 0 != object           , "put():: Invalid 'Object'!"        ) ;
00669   Assert ( !location.empty()     , "put():: Invalid 'address' = '' "  ) ;
00670   // final data location
00671   const std::string & fullLocation = fullTESLocation( location, useRootInTES );
00672   // register the object!
00673   const StatusCode status = '/' == fullLocation[0] ?
00674     svc -> registerObject(             fullLocation , object ) :
00675     svc -> registerObject( "/Event/" + fullLocation , object ) ;
00676   // check the result!
00677   if ( status.isFailure() )
00678   { Exception ( "put():: could not register '"            +
00679                 System::typeinfoName( typeid( *object ) ) +
00680                 "' at address '" + fullLocation + "'"  , status ) ; }
00681   if ( msgLevel( MSG::DEBUG ) )
00682   { Print( "The object of type '"                    +
00683            System::typeinfoName( typeid( *object ) ) +
00684            "' is registered in TS at address '"
00685            + fullLocation + "'" , status , MSG::DEBUG ) ; }
00686   return object;
00687 }
00688 // ============================================================================

Generated at Thu Jan 8 17:44:19 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004