/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
RootIOFileStateSvc Class Reference

Implement IRootIOFileStateSvc. More...

#include <RootIOFileStateSvc.h>

Inheritance diagram for RootIOFileStateSvc:
Inheritance graph
[legend]
Collaboration diagram for RootIOFileStateSvc:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector< std::string > FileList_t

Public Member Functions

 RootIOFileStateSvc (const std::string &name, ISvcLocator *svc)
virtual ~RootIOFileStateSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppint)
virtual void handle (const Incident &incident)
FileList_t closedOutput ()
 Return the names of output files that have been closed.
FileList_t openOutput ()
 Return the name of the currently open output files.

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Attributes

std::list< std::string > m_closed
std::list< std::string > m_open
IIncidentSvc * m_incsvc

Detailed Description

Implement IRootIOFileStateSvc.

Brett Viren <bv@bnl.gov> Thu Mar 10 13:12:32 2011

Definition at line 25 of file RootIOFileStateSvc.h.


Member Typedef Documentation

typedef std::vector<std::string> IRootIOFileStateSvc::FileList_t [inherited]

Definition at line 30 of file IRootIOFileStateSvc.h.


Constructor & Destructor Documentation

RootIOFileStateSvc::RootIOFileStateSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 9 of file RootIOFileStateSvc.cc.

    : Service(name,svc)
{
}
RootIOFileStateSvc::~RootIOFileStateSvc ( ) [virtual]

Definition at line 14 of file RootIOFileStateSvc.cc.

{
}

Member Function Documentation

StatusCode RootIOFileStateSvc::initialize ( ) [virtual]

Definition at line 18 of file RootIOFileStateSvc.cc.

{
    MsgStream log(msgSvc(), "RootIOFileStateSvc");

    StatusCode sc = this->Service::initialize();
    if (sc.isFailure()) return sc;

    sc = this->service("IncidentSvc",m_incsvc,true);
    if (sc.isFailure()) {
        log << MSG::ERROR
            << "Failed to get IncidentSvc" << endreq;
        return sc;
    }
    m_incsvc->addListener(this,"RootIOIncident");

    return sc;
}
StatusCode RootIOFileStateSvc::finalize ( ) [virtual]

Definition at line 36 of file RootIOFileStateSvc.cc.

{
    m_incsvc->removeListener(this,"RootIOIncident");
    m_incsvc->release();

    return this->Service::finalize();
}
StatusCode RootIOFileStateSvc::queryInterface ( const InterfaceID &  riid,
void **  ppint 
) [virtual]

Definition at line 44 of file RootIOFileStateSvc.cc.

{
    if (IRootIOFileStateSvc::interfaceID().versionMatch(riid)) {
        *ppint = (IRootIOFileStateSvc*)this;
        this->addRef();
        return StatusCode::SUCCESS;
    }
    return this->Service::queryInterface(riid,ppint);
}
void RootIOFileStateSvc::handle ( const Incident &  incident) [virtual]

Definition at line 54 of file RootIOFileStateSvc.cc.

{
    MsgStream log(msgSvc(), "RootIOFileStateSvc");

    // Handle the incident in a trivial manner

    const RootIOIncident* rioinc = dynamic_cast<const RootIOIncident*>(&incident);
    if (!rioinc) {
        log << MSG::WARNING
            << "Ignoring unexpected incident not of class RootIOIncident" 
            << endreq;
        return;
    }
    
    if (rioinc->state() == RootIOIncident::opened_output) {
        std::string fn = rioinc->filename();
        log << MSG::DEBUG
            << "Adding opened output \"" << fn
            << "\" to " << m_open.size() << " others"
            << endreq;
        m_open.push_back(fn);
        return;
    }

    if (rioinc->state() == RootIOIncident::closed_output) {
        std::string fn = rioinc->filename();
        log << MSG::DEBUG
            << "Adding closed output \"" << fn
            << "\" to " << m_closed.size() << " others"
            << endreq;
        m_closed.push_back(fn);


        std::list<std::string>::iterator it = std::find(m_open.begin(),m_open.end(),fn);
        if (it != m_open.end()) {
            m_open.erase(it);
            log << MSG::DEBUG
                << "Erased \"" << *it << "\" from open list, " << m_open.size() << " left" 
                << endreq;
        }
    }
}
IRootIOFileStateSvc::FileList_t RootIOFileStateSvc::closedOutput ( ) [virtual]

Return the names of output files that have been closed.

Implements IRootIOFileStateSvc.

Definition at line 97 of file RootIOFileStateSvc.cc.

{
    return FileList_t(m_closed.begin(),m_closed.end());
}
IRootIOFileStateSvc::FileList_t RootIOFileStateSvc::openOutput ( ) [virtual]

Return the name of the currently open output files.

Implements IRootIOFileStateSvc.

Definition at line 102 of file RootIOFileStateSvc.cc.

{
    return FileList_t(m_open.begin(),m_open.end());
}
const InterfaceID & IRootIOFileStateSvc::interfaceID ( ) [static, inherited]

Definition at line 5 of file IRootIOFileStateSvc.cc.

{ 
    static const InterfaceID booger("IRootIOFileStateSvc",0,0);
    return booger;
}

Member Data Documentation

std::list<std::string> RootIOFileStateSvc::m_closed [private]

Definition at line 49 of file RootIOFileStateSvc.h.

std::list<std::string> RootIOFileStateSvc::m_open [private]

Definition at line 49 of file RootIOFileStateSvc.h.

IIncidentSvc* RootIOFileStateSvc::m_incsvc [private]

Definition at line 51 of file RootIOFileStateSvc.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:58:18 for RootIOSvc by doxygen 1.7.4