/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 | Protected Attributes
RegistrationSequenceCnv Class Reference

#include <RegistrationSequenceCnv.h>

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

List of all members.

Public Member Functions

 RegistrationSequenceCnv (ISvcLocator *svc)
virtual ~RegistrationSequenceCnv ()
StatusCode PerToTran (const PerRegistrationSequence &perobj, DayaBay::RegistrationSequence &tranobj)
 Copy data from TObject based class of type TType to DataObject based class of type DOType.
StatusCode TranToPer (const DayaBay::RegistrationSequence &tranobj, PerRegistrationSequence &perobj)
 Copy data from DataObject based class of type DOType to TObject based class of type TType.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the persistent object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the transient object.
PerType & getPerInputObject ()
PerType & getPerOutputObject ()
const RootIOBaseObjectgetBaseInputObject ()
const RootIOBaseObjectgetBaseOutputObject ()
virtual StatusCode PerToTran (const PerType &pobj, TranType &tobj)=0
virtual StatusCode TranToPer (const TranType &tobj, PerType &pobj)=0
virtual StatusCode TranObjectToPerObject (DataObject &dat, const RootOutputAddress &)
virtual StatusCode PerObjectToTranObject (DataObject *&dat)
virtual RootInputStreammakeInputStream (const RootInputAddress &ria)
virtual RootOutputStreammakeOutputStream (const RootOutputAddress &ria)
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
int commit (const RootOutputAddress &roa)
RootIOBaseCnvotherConverter (int clID)

Static Public Member Functions

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

Protected Attributes

std::string m_perclassName
PerType * m_perInObj
PerType * m_perOutObj
IRootIOSvcm_rioSvc
IConversionSvc * m_cnvSvc
RootInputStreamm_ris

Detailed Description

Definition at line 8 of file RegistrationSequenceCnv.h.


Constructor & Destructor Documentation

RegistrationSequenceCnv::RegistrationSequenceCnv ( ISvcLocator *  svc)

Definition at line 14 of file RegistrationSequenceCnv.cc.

RegistrationSequenceCnv::~RegistrationSequenceCnv ( ) [virtual]

Definition at line 20 of file RegistrationSequenceCnv.cc.

{
}

Member Function Documentation

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

Definition at line 12 of file RegistrationSequenceCnv.h.

                                 {
        return DayaBay::CLID_RegistrationSequence;
    }
StatusCode RegistrationSequenceCnv::PerToTran ( const PerRegistrationSequence perobj,
DayaBay::RegistrationSequence tranobj 
)

Copy data from TObject based class of type TType to DataObject based class of type DOType.

Definition at line 25 of file RegistrationSequenceCnv.cc.

{
    MsgStream log(msgSvc(), "RegistrationSequenceCnv::PerToTran");

    StatusCode sc = TemporalDataObjectCnv::toTran(perobj,tranobj);    
    if (sc.isFailure()) {
        log<<MSG::ERROR<<"Failed in PerToTran"<<endreq;
    } else {
        log<<MSG::DEBUG<<"RegistrationSequence converted"<<endreq;
    }
    return sc;
}
StatusCode RegistrationSequenceCnv::TranToPer ( const DayaBay::RegistrationSequence tranobj,
PerRegistrationSequence perobj 
)

Copy data from DataObject based class of type DOType to TObject based class of type TType.

Definition at line 154 of file RegistrationSequenceCnv.cc.

{
    StatusCode sc = TemporalDataObjectCnv::toPer(tranobj,perobj);    
    if (sc.isFailure()) return sc;

    perobj.reglist.clear();
    return StatusCode::SUCCESS;
}
StatusCode RegistrationSequenceCnv::fillRepRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual]

Resolve the references of the persistent object.

Reimplemented from RootIOTypedCnv< PerRegistrationSequence, DayaBay::RegistrationSequence >.

Definition at line 164 of file RegistrationSequenceCnv.cc.

{
    RegistrationSequence* rs = dynamic_cast<RegistrationSequence*>(tranobj);
    if (!rs) return StatusCode::FAILURE;

    PerRegistrationSequence& trs = getPerOutputObject();

    const IRegistrationSequence::Registrations &rlist = rs->registrations();
    IRegistrationSequence::Registrations::const_iterator it, done = rlist.end();
    for (it = rlist.begin(); it != done; ++it) {
        const ObjectReg& oreg = *it;
        if( oreg.store() ){
            trs.reglist.push_back(PerRegSeqReg(oreg.path(),oreg.entry(),
                                               oreg.object()->clID()));
        }
    }

    return StatusCode::SUCCESS;
}
StatusCode RegistrationSequenceCnv::fillObjRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual]

Resolve the references of the transient object.

Reimplemented from RootIOTypedCnv< PerRegistrationSequence, DayaBay::RegistrationSequence >.

Definition at line 39 of file RegistrationSequenceCnv.cc.

{
    MsgStream log(msgSvc(), "RegistrationSequenceCnv::fillObjRefs");

    RegistrationSequence* rs = dynamic_cast<RegistrationSequence*>(tranobj);
    if (!rs) return StatusCode::FAILURE;

    unsigned int skipped = 0;

    PerRegistrationSequence& trs = getPerInputObject();
    size_t siz = trs.reglist.size();
    log << MSG::DEBUG << siz << " registrations" << endreq;
    for (size_t ind = 0; ind < siz; ++ind) {

        const PerRegSeqReg& reg = trs.reglist[ind];

        if (reg.path == "/Event/Random/RandomHeader") {
            ++skipped;
            log << MSG::DEBUG
                << "Not retrieving '/Event/Random/RandomHeader'" 
                << endreq;
            continue;
        }

        RootInputAddress* ria = new RootInputAddress(reg.clid,reg.path);

        ria->setEntry(reg.entry);
        ria->setFileNumber(m_ris->fileNumber());

        RootInputStream* ris = m_rioSvc->inputStream(*ria);
        if (!ris) {
            static int count = 1;
            if(count!=0) {
                static std::vector<std::string> skipStream;
                if(std::find(skipStream.begin(),skipStream.end(),reg.path)==skipStream.end()) {
                    skipStream.push_back(reg.path);
                } 
                else {
                    count--;
                }
                log << MSG::WARNING
                    << "No input stream for " << reg.path
                    << ", will not register anything in the TES. "
                    << "Won't tell again."
                    << endreq;
            }
            delete ria;
            continue;
        }
        ria->setStream(ris);

        // register address
        log << MSG::DEBUG << "registering " << reg.path
            << " entry " << reg.entry << " fileNum " << m_ris->fileNumber() 
            << endreq;

        StatusCode sc = m_rioSvc->dataMgrSvc()->registerAddress(reg.path,ria);
        
        if(sc.getCode()==IDataProviderSvc::DOUBL_OBJ_PATH) {
            // Two data objects in the same location.
            log << MSG::DEBUG << "IDataProviderSvc::DOUBL_OBJ_PATH Catched "<<endreq;
            DataObject* exist_obj=0;
            // Since it exist unregister it first, then register the address again.
            // It is in AES now if AES is in use.
            sc = m_rioSvc->dataSvc()->findObject(reg.path,exist_obj);
            if(sc.isSuccess() && exist_obj) {
                m_rioSvc->dataSvc()->unregisterObject(exist_obj);           
                exist_obj->release(); // why release, check DybDataSvc.cpp and DocDB 3242, page 2 memo
                sc = m_rioSvc->dataMgrSvc()->registerAddress(reg.path,ria);
            }
        }

        if (sc.isFailure()) {
          log << MSG::ERROR
              << "failed to register address at " << reg.path
              << endreq;
          return sc;
        }

        DataObject* other_tranobj = 0;
        // This should trigger an RS registration.
        sc = m_rioSvc->dataSvc()->retrieveObject(reg.path,other_tranobj);
        if (!other_tranobj || sc.isFailure()) {
            log << MSG::WARNING << "failed to retrieve object at " 
                << reg.path << ", continuing...." << endreq;
            continue;
        }
        log << MSG::DEBUG << "retrieved " << reg.path 
            << " registration #" << rs->size()
            << endreq;

        log << MSG::DEBUG << "inputaddress "<<ria->entry()<<"\t"<<ria->tespath()<<endreq;

        TemporalDataObject* tdo=dynamic_cast<TemporalDataObject*>(other_tranobj);
        log << MSG::DEBUG <<tdo<<endreq;
        if(tdo!=0) tdo->setInputAddress(ria);
    }
    log << MSG::DEBUG << "copied " << rs->size()
        << " registrations" << endreq;
    static int count = 1;
    if(count>0) {
        --count;
        if (siz - rs->size() > skipped) {
            log << MSG::WARNING << "have " << siz
                << " registrations from file but only converted " 
                << rs->size() 
                << " (" << skipped << " skipped on purpose). "
                << "Won't tell again."
                << endreq;
        }
    }
    return StatusCode::SUCCESS;
}
PerType & RootIOTypedCnv< class, class >::getPerInputObject ( ) [inherited]
PerType & RootIOTypedCnv< class, class >::getPerOutputObject ( ) [inherited]
const RootIOBaseObject * RootIOTypedCnv< class, class >::getBaseInputObject ( ) [virtual, inherited]

Implements RootIOBaseCnv.

const RootIOBaseObject * RootIOTypedCnv< class, class >::getBaseOutputObject ( ) [virtual, inherited]

Implements RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::PerToTran ( const PerType &  pobj,
TranType &  tobj 
) [pure virtual, inherited]
virtual StatusCode RootIOTypedCnv< class, class >::TranToPer ( const TranType &  tobj,
PerType &  pobj 
) [pure virtual, inherited]
virtual StatusCode RootIOTypedCnv< class, class >::TranObjectToPerObject ( DataObject &  dat,
const RootOutputAddress  
) [virtual, inherited]

Implements RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::PerObjectToTranObject ( DataObject *&  dat) [virtual, inherited]

Implements RootIOBaseCnv.

virtual RootInputStream * RootIOTypedCnv< class, class >::makeInputStream ( const RootInputAddress ria) [virtual, inherited]

Implements RootIOBaseCnv.

virtual RootOutputStream * RootIOTypedCnv< class, class >::makeOutputStream ( const RootOutputAddress ria) [virtual, inherited]

Implements RootIOBaseCnv.

virtual long RootIOTypedCnv< class, class >::repSvcType ( ) const [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::initialize ( ) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::finalize ( ) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::createObj ( IOpaqueAddress *  addr,
DataObject *&  dat 
) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::createRep ( DataObject *  pObject,
IOpaqueAddress *&  refpAddress 
) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

int RootIOTypedCnv< class, class >::commit ( const RootOutputAddress roa) [inherited]

Reimplemented from RootIOBaseCnv.

RootIOBaseCnv * RootIOTypedCnv< class, class >::otherConverter ( int  clID) [inherited]

Reimplemented from RootIOBaseCnv.

static unsigned char RootIOTypedCnv< class, class >::storageType ( ) [static, inherited]

Reimplemented from RootIOBaseCnv.

static const InterfaceID & RootIOTypedCnv< class, class >::interfaceID ( ) [static, inherited]

Reimplemented from RootIOBaseCnv.


Member Data Documentation

std::string RootIOTypedCnv< class, class >::m_perclassName [protected, inherited]
PerType * RootIOTypedCnv< class, class >::m_perInObj [protected, inherited]
PerType * RootIOTypedCnv< class, class >::m_perOutObj [protected, inherited]
IRootIOSvc * RootIOTypedCnv< class, class >::m_rioSvc [protected, inherited]

Reimplemented from RootIOBaseCnv.

IConversionSvc * RootIOTypedCnv< class, class >::m_cnvSvc [protected, inherited]

Reimplemented from RootIOBaseCnv.

RootInputStream * RootIOTypedCnv< class, class >::m_ris [protected, inherited]

Reimplemented from RootIOBaseCnv.


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