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

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
SimpleOuputModule Class Reference

Write out all TES objects. More...

#include <SimpleOuputModule.h>

Collaboration diagram for SimpleOuputModule:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SimpleOuputModule (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~SimpleOuputModule ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Member Functions

StatusCode createReps (DataObject *dobj)
StatusCode fillRepRefs (DataObject *dobj)

Private Attributes

std::string m_filename
 Property: Filename.
IRootIOSvcm_rio
IConversionSvc * m_cnv

Detailed Description

Write out all TES objects.

This algorithm uses RootIOSvc to write out all TES objects which have RootIO converters.

bv@bnl.gov Mon Jun 30 11:39:20 2008

Definition at line 25 of file SimpleOuputModule.h.


Constructor & Destructor Documentation

SimpleOuputModule::SimpleOuputModule ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 10 of file SimpleOuputModule.cc.

    : GaudiAlgorithm(name,pSvcLocator)
    , m_rio(0)
    , m_cnv(0)
{
}
SimpleOuputModule::~SimpleOuputModule ( ) [virtual]

Definition at line 18 of file SimpleOuputModule.cc.

{
}

Member Function Documentation

StatusCode SimpleOuputModule::initialize ( ) [virtual]

Definition at line 22 of file SimpleOuputModule.cc.

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

    sc = serviceLocator()->getService("RootIOCnvSvc",
                                      IID_IConversionSvc,
                                      *pp_cast<IInterface>(&m_cnv));
    if (sc.isFailure()) {
        error() << "Failed to get IConversionSvc RootIOCnvSvc" << endreq;
        return sc;
    }

    sc = m_cnv->queryInterface(IRootIOSvc::interfaceID(),(void**)&m_rio);
    if (sc.isFailure()) {
        error() << "Failed to get IRootIOSvc interface from RootIOCnvSvc" << endreq;
        return sc;
    }

    return sc;
}
StatusCode SimpleOuputModule::execute ( ) [virtual]

Definition at line 44 of file SimpleOuputModule.cc.

{
    DataObject *d = get<DataObject>("/Event");
    StatusCode sc = this->createReps(d);
    if (sc.isFailure()) {
        error() << "Failed in calling createReps" << endreq;
        return sc;
    }

    sc = this->fillRepRefs(d);
    if (sc.isFailure()) {
        error() << "Failed in calling fillRepRefs" << endreq;
    }
    return sc;
}
StatusCode SimpleOuputModule::finalize ( ) [virtual]

Definition at line 133 of file SimpleOuputModule.cc.

{

    return this->GaudiAlgorithm::finalize();
}
StatusCode SimpleOuputModule::createReps ( DataObject *  dobj) [private]

Definition at line 60 of file SimpleOuputModule.cc.

{
    IRegistry* dr = dobj->registry();
    using namespace DataSvcHelpers;
    RegistryEntry* dre = dynamic_cast<RegistryEntry*>(dr);
    if (!dre) {
        error() << "Failed in createReps to get RegistryEntry for " 
                << dr->identifier() << endreq;
        return StatusCode::FAILURE;
    }
    
    RegistryEntry::Iterator it = dre->begin(), done = dre->end();
    for (; it != done; ++it) {
        string id = (*it)->identifier();

        DataObject* child = get<DataObject>(id);
        if (!child) {
            error() << "Failed in createReps to get object for " 
                    << id << endreq;
            return StatusCode::FAILURE;
        }

        IOpaqueAddress* addr = 0;
        StatusCode sc = m_cnv->createRep(child,addr);
        if (sc.isFailure()) {
            warning() << "Failed to createRep for " << id << ", skipping" << endreq;
            continue;
        }
        IRegistry* reg = child->registry();
        reg->setAddress(addr);

        sc = this->createReps(child);
        if (sc.isFailure()) return sc;
    }
    return StatusCode::SUCCESS;
}
StatusCode SimpleOuputModule::fillRepRefs ( DataObject *  dobj) [private]

Definition at line 97 of file SimpleOuputModule.cc.

{
    IRegistry* dr = dobj->registry();
    using namespace DataSvcHelpers;
    RegistryEntry* dre = dynamic_cast<RegistryEntry*>(dr);
    if (!dre) {
        error() << "Failed in fillReps to get RegistryEntry for " 
                << dr->identifier() << endreq;
        return StatusCode::FAILURE;
    }
    
    RegistryEntry::Iterator it = dre->begin(), done = dre->end();
    for (; it != done; ++it) {
        string id = (*it)->identifier();

        DataObject* child = get<DataObject>(id);
        if (!child) {
            error() << "Failed to in fillReps get object for "
                    << id << endreq;
            return StatusCode::FAILURE;
        }

        IRegistry* reg = child->registry();
        StatusCode sc = m_cnv->fillRepRefs(reg->address(), child);
        if (sc.isFailure()) {
            warning() << "Failed to fillRepRefs with " 
                      << id << ", skipping" << endreq;
            continue;
        }

        sc = this->fillRepRefs(child);
        if (sc.isFailure()) return sc;
    }
    return StatusCode::SUCCESS;
}

Member Data Documentation

std::string SimpleOuputModule::m_filename [private]

Property: Filename.

Write out everything to a single filename.

Definition at line 44 of file SimpleOuputModule.h.

Definition at line 46 of file SimpleOuputModule.h.

IConversionSvc* SimpleOuputModule::m_cnv [private]

Definition at line 47 of file SimpleOuputModule.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 10:20:12 for RootIOTest by doxygen 1.7.4