| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

TestIOIncidentAlg.cc

Go to the documentation of this file.
00001 #include "TestIOIncidentAlg.h"
00002 #include "RootIOSvc/RootIOIncident.h"
00003 
00004 #include "GaudiKernel/IIncidentSvc.h"
00005 
00006 TestIOIncidentAlg::TestIOIncidentAlg(const std::string& name,
00007                                      ISvcLocator*  pSvcLocator)
00008     : GaudiAlgorithm(name,pSvcLocator)
00009 {
00010 }
00011 
00012 TestIOIncidentAlg::~TestIOIncidentAlg()
00013 {
00014 }
00015 
00016 StatusCode TestIOIncidentAlg::initialize()
00017 {
00018     StatusCode sc = GaudiAlgorithm::initialize();
00019     if (sc.isFailure()) return sc;
00020 
00021     // Get and hold on to the incident service and add ourself.
00022     m_incsvc = svc<IIncidentSvc>("IncidentSvc",true);
00023     m_incsvc->addListener(this,"RootIOIncident");
00024 
00025     info() << "initialize()" << endreq;
00026 
00027     return StatusCode::SUCCESS;
00028 }
00029 
00030 StatusCode TestIOIncidentAlg::execute()
00031 {
00032     info() << "execute()" << endreq;
00033 
00034     return StatusCode::SUCCESS;
00035 }
00036 
00037 StatusCode TestIOIncidentAlg::finalize()
00038 {
00039     info() << "finalize()" << endreq;
00040 
00041     // Must remove self.  O.w. we may finalize before RootIOSvc and
00042     // leave beind a dangling handler.
00043     m_incsvc->removeListener(this,"RootIOIncident");
00044     m_incsvc->release();
00045 
00046     return GaudiAlgorithm::finalize();
00047 }
00048 
00049 void TestIOIncidentAlg::handle(const Incident& incident)
00050 {
00051     // Handle the incident in a trivial manner
00052 
00053     info() << "Got incident from \"" << incident.source()
00054            << "\" and type \"" << incident.type() << "\"" << endreq;
00055     const RootIOIncident* rioinc = dynamic_cast<const RootIOIncident*>(&incident);
00056     if (!rioinc) {
00057         warning() 
00058             << "Ignoring unexpected incident not of class RootIOIncident" 
00059             << endreq;
00060         return;
00061     }
00062     info () << "File name: \"" << rioinc->filename() 
00063             << "\" file state: \"" << rioinc->state() << "\"" 
00064             << endreq;
00065 }
00066 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:47:44 2011 for DybIO by doxygen 1.4.7