Gaudi Framework, version v22r2

Home   Generated: Tue May 10 2011

FastContainersSvc.cpp

Go to the documentation of this file.
00001 // $Id: FastContainersSvc.cpp,v 1.2 2006/11/24 09:56:53 hmd Exp $
00002 
00003 // Include files
00004 #include "GaudiKernel/DataObject.h"
00005 #include "GaudiKernel/MsgStream.h"
00006 #include "GaudiKernel/SvcFactory.h"
00007 #include "GaudiKernel/Incident.h"
00008 #include "GaudiKernel/IIncidentSvc.h"
00009 
00010 // local
00011 #include "FastContainersSvc.h"
00012 
00013 // Instantiation of a static factory class used by clients to create
00014 // instances of this service
00015 DECLARE_SERVICE_FACTORY(FastContainersSvc)
00016 
00017 //-----------------------------------------------------------------------------
00018 // Implementation file for class : FastContainersSvc
00019 //
00020 // 2006-05-03 : Marco Clemencic
00021 //-----------------------------------------------------------------------------
00022 
00023 //=============================================================================
00024 // Standard constructor, initializes variables
00025 //=============================================================================
00026 FastContainersSvc::FastContainersSvc(const std::string& name,ISvcLocator* svc):
00027   base_class(name,svc)
00028 {
00029   declareProperty("RootDirName", m_rootDirName = "fc" );
00030   m_rootName = "/" + m_rootDirName;
00031 }
00032 
00033 //=============================================================================
00034 // Destructor
00035 //=============================================================================
00036 FastContainersSvc::~FastContainersSvc() {}
00037 
00038 //=========================================================================
00039 //  Initialization
00040 //=========================================================================
00041 StatusCode FastContainersSvc::initialize() {
00042   // initialize base class
00043   StatusCode status = DataSvc::initialize();
00044   if (!status.isSuccess()) return status;
00045 
00046   MsgStream log(msgSvc(), name());
00047   // create root node
00048   log << MSG::VERBOSE << "creating root node" << endmsg;
00049   status = setRoot(m_rootName,new DataObject);
00050   if (!status.isSuccess()){
00051     log << MSG::FATAL << "failed to create the root node" << endmsg;
00052     return status;
00053   }
00054 
00055   // register to the incident service
00056   log << MSG::VERBOSE << "registering to the incident service for " << IncidentType::BeginEvent << endmsg;
00057   m_incidentSvc->addListener(this,IncidentType::BeginEvent);
00058 
00059   return status;
00060 }
00061 
00062 //=========================================================================
00063 // Empty reinitialization
00064 //=========================================================================
00065 StatusCode FastContainersSvc::reinitialize() {
00066   // do nothing
00067   return StatusCode::SUCCESS;
00068 }
00069 
00070 //=========================================================================
00071 // Finalize the service
00072 //=========================================================================
00073 StatusCode FastContainersSvc::finalize() {
00074   MsgStream log(msgSvc(), name());
00075   // de-register to the incident service
00076   log << MSG::VERBOSE << "de-registering from the incident service" << endmsg;
00077   m_incidentSvc->removeListener(this,IncidentType::BeginEvent);
00078 
00079   return DataSvc::finalize();
00080 }
00081 
00082 //=========================================================================
00083 // reset all the fast containers in the transient store
00084 //=========================================================================
00085 void FastContainersSvc::resetStore() {
00086   traverseTree(&m_storeResetter).ignore();
00087 }
00088 
00089 //=========================================================================
00090 // handle BeginEvent incident
00091 //=========================================================================
00092 void FastContainersSvc::handle(const Incident& incident) {
00093   if (incident.type() == IncidentType::BeginEvent)
00094     resetStore();
00095 }
00096 //=============================================================================
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Tue May 10 2011 18:53:57 for Gaudi Framework, version v22r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004