/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 | Static Public Member Functions | Private Attributes
DataObjectCnv Class Reference

A "converter" for DataObject. More...

#include <DataObjectCnv.h>

Collaboration diagram for DataObjectCnv:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual long repSvcType () const
 DataObjectCnv (ISvcLocator *svc)
virtual ~DataObjectCnv ()
virtual StatusCode initialize ()
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.

Static Public Member Functions

static const CLID & classID ()
static const unsigned char storageType ()

Private Attributes

IRootIOSvcm_rioSvc
 Pointer to the RootIOCnvSvc.

Detailed Description

A "converter" for DataObject.

This converter applies Daya Bay specific I/O policy, namely using RegistrationSequence to control what is written and read.

bv@bnl.gov Fri Jul 11 14:45:57 2008

Definition at line 22 of file DataObjectCnv.h.


Constructor & Destructor Documentation

DataObjectCnv::DataObjectCnv ( ISvcLocator *  svc)

Definition at line 14 of file DataObjectCnv.cc.

    : Converter(ROOT_StorageType,CLID_DataObject,svc)
    
{
}
DataObjectCnv::~DataObjectCnv ( ) [virtual]

Definition at line 20 of file DataObjectCnv.cc.

{
}

Member Function Documentation

static const CLID& DataObjectCnv::classID ( ) [inline, static]

Definition at line 24 of file DataObjectCnv.h.

                                 {
        return CLID_DataObject;
    }
static const unsigned char DataObjectCnv::storageType ( ) [inline, static]

Definition at line 27 of file DataObjectCnv.h.

                                             {
        return ROOT_StorageType; 
    }
virtual long DataObjectCnv::repSvcType ( ) const [inline, virtual]

Definition at line 30 of file DataObjectCnv.h.

                                    {
        return ROOT_StorageType; 
    }
StatusCode DataObjectCnv::initialize ( ) [virtual]

Definition at line 24 of file DataObjectCnv.cc.

{
    StatusCode sc = Converter::initialize();
    if (sc.isFailure()) return sc;

    MsgStream log(msgSvc(), "DataObjectCnv::initialize()");

    IService* isvc=0;
    sc = serviceLocator()->service("RootIOCnvSvc", isvc, false);
    if (sc.isFailure()) {
        log << MSG::ERROR << "Conversion service RootIOCnvSvc"
            << " could not be retrieved" << endreq;
        return sc;
    }
    isvc->addRef();

    sc = isvc->queryInterface(IRootIOSvc::interfaceID(), (void**)&m_rioSvc);
    if (sc.isFailure()) {
        log << MSG::ERROR << "Conversion service RootIOCnvSvc"
            << " does not implement IRootIOCnvSvc" << endreq;
    }

    return sc;
}
StatusCode DataObjectCnv::createObj ( IOpaqueAddress *  addr,
DataObject *&  dat 
) [virtual]

Convert the persistent object to transient.

Definition at line 51 of file DataObjectCnv.cc.

{
    dat = new DataObject;
    return StatusCode::SUCCESS;
}
StatusCode DataObjectCnv::fillObjRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual]

Resolve the references of the converted object.

Definition at line 59 of file DataObjectCnv.cc.

{
    // check if everything looks kosher.  

    MsgStream log(msgSvc(), "DataObjectCnv::fillObjRefs()");
    RootInputAddress* ria = dynamic_cast<RootInputAddress*>(addr);
    if (!ria) return StatusCode::FAILURE;

    log << MSG::DEBUG
        << " addr is a RIA @ " << ria->tespath() 
        << " clID=" << ria->clID() << endreq;

    if (ria->clID() != CLID_DataObject) {
        log << MSG::WARNING << "given unexpected class ID "
            << ria->clID() << endreq;
        return StatusCode::SUCCESS;
    }

    string location = ria->registry()->identifier();

    if (location != "/Event") {
        log << MSG::WARNING << "fillObjRefs() called with unexpected location "
            << location << endreq;
        return StatusCode::SUCCESS;
    }


    // Register address for RegistrationSequence.

    // Fixme: needs to be configurable?
    string rsloc = DayaBay::RegistrationSequence::defaultLocation();
    int rsclid = DayaBay::RegistrationSequence::classID();
    RootInputAddress* rsria = 0;
    rsria = new RootInputAddress(rsclid,rsloc);
    rsria->setEntry(ria->entry());
    RootInputStream* rsris = m_rioSvc->inputStream(*rsria);
    rsria->setStream(rsris);
    m_rioSvc->dataMgrSvc()->registerAddress(rsloc,rsria);

    // Pull RegistrationSequence out of TES to trigger its converter
    DataObject* rsobj = 0;
    return m_rioSvc->dataSvc()->
        retrieveObject(DayaBay::RegistrationSequence::defaultLocation(),rsobj);
}

Member Data Documentation

Pointer to the RootIOCnvSvc.

Definition at line 50 of file DataObjectCnv.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:27 for PerBaseEvent by doxygen 1.7.4