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

In This Package:

JobInfoCnv.cc
Go to the documentation of this file.
00001 #include "JobInfoCnv.h"
00002 #include "PerBaseEvent/HeaderObjectCnv.h"
00003 
00004 using namespace DayaBay;
00005 using namespace std;
00006 
00007 JobHeaderCnv::JobHeaderCnv(ISvcLocator* svc)
00008   : RootIOTypedCnv<PerJobHeader,JobHeader>("PerJobHeader",
00009                                            classID(),svc)
00010 {
00011 }
00012 
00013 
00014 JobHeaderCnv::~JobHeaderCnv()
00015 {
00016 }
00017 
00018 StatusCode JobHeaderCnv::PerToTran(const PerJobHeader& perobj,
00019                                    DayaBay::JobHeader& tranobj)
00020 {
00021   MsgStream log(msgSvc(), "JobHeaderCnv::PerToTran");
00022 
00023   log << MSG::DEBUG << "Converting persistent to transient object" << endreq;
00024 
00025   StatusCode sc = HeaderObjectCnv::toTran(perobj,tranobj);
00026   if (sc.isFailure()) return sc;
00027   
00028   vector<PerJobInfo*> in_vec = perobj.jobInfoList;
00029   vector<PerJobInfo*>::iterator it;
00030   
00031   for(it = in_vec.begin(); it != in_vec.end(); ++it)
00032   {
00033     JobInfo* jobInfo = convert(**it);
00034     tranobj.jobInfoList().push_back(jobInfo);
00035   }
00036   return StatusCode::SUCCESS;
00037 }                                       
00038 
00039 StatusCode JobHeaderCnv::TranToPer(
00040                                    const DayaBay::JobHeader& tranobj,
00041                                    PerJobHeader& perobj)
00042 {
00043   MsgStream log(msgSvc(), "JobHeaderCnv::TranToPer");
00044 
00045   log << MSG::DEBUG << "Converting transient to persistent object" << endreq;
00046 
00047   perobj.clear();
00048   StatusCode sc = HeaderObjectCnv::toPer(tranobj,perobj);
00049   if (sc.isFailure()) return sc;
00050   
00051   vector<JobInfo*> in_vec = tranobj.jobInfoList();
00052   vector<JobInfo*>::iterator it;
00053 
00054   for(it=in_vec.begin();it!=in_vec.end();++it){
00055     perobj.jobInfoList.push_back( convert(**it) );
00056   }
00057   return StatusCode::SUCCESS;
00058   
00059 }
00060 
00061 StatusCode JobHeaderCnv::fillRepRefs(IOpaqueAddress*, DataObject* dobj)
00062 {
00063     MsgStream log(msgSvc(), "JobHeaderCnv::fillRepRefs");
00064     JobHeader* rh = dynamic_cast<JobHeader*>(dobj);
00065 
00066     log << MSG::INFO
00067         << "Got " << rh->inputHeaders().size() << " headers" << endreq;
00068 
00069 
00070     StatusCode sc = HeaderObjectCnv::fillPer(m_rioSvc,*rh,*m_perOutObj);
00071     if (sc.isFailure()) {
00072         log << MSG::ERROR << "Failed to fill HeaderObject part" << endreq;
00073         return sc;
00074     }
00075 
00076     // ... fill JobHeader part...
00077     return sc;
00078 }
00079 
00080 StatusCode JobHeaderCnv::fillObjRefs(IOpaqueAddress*, DataObject* dobj)
00081 {
00082     MsgStream log(msgSvc(), "JobHeaderCnv::fillObjRefs");
00083     HeaderObject* hobj = dynamic_cast<HeaderObject*>(dobj);
00084     StatusCode sc = HeaderObjectCnv::fillTran(m_rioSvc,*m_perInObj,*hobj);
00085     if (sc.isFailure()) {
00086         log << MSG::ERROR << "Failed to fill HeaderObject part" << endreq;
00087         return sc;
00088     }
00089 
00090     log << MSG::INFO
00091         << "Got " << hobj->inputHeaders().size() << " headers" << endreq;
00092 
00093     // ... fill JobHeader part...
00094     return sc;
00095 }
00096 
00097 PerJobInfo* JobHeaderCnv::convert(const DayaBay::JobInfo& jobInfo){
00098   return (new PerJobInfo(jobInfo.jobId(),jobInfo.parameters()));
00099 }
00100 
00101 JobInfo* JobHeaderCnv::convert(const PerJobInfo& perJobInfo)
00102 {
00103   JobInfo* jobInfo = new JobInfo();
00104   jobInfo->setJobId(perJobInfo.jobId);
00105   jobInfo->setParameters(perJobInfo.parameters);
00106   return jobInfo;
00107 }
00108 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:59:17 for PerJobInfo by doxygen 1.7.4