#include <UserDataCnv.h>
Inheritance diagram for UserDataCnv:
Created by: dandwyer@caltech.edu, 2011/02/16 Refactored bv@bnl.gov Fri Feb 25 17:27:13 2011
Definition at line 20 of file UserDataCnv.h.
UserDataCnv::UserDataCnv | ( | ISvcLocator * | svc | ) |
Definition at line 9 of file UserDataCnv.cc.
00010 : RootIOTypedCnv<PerHeaderObject,UserDataHeader>("PerHeaderObject", 00011 classID(),svc) 00012 { 00013 }
UserDataCnv::~UserDataCnv | ( | ) | [virtual] |
static const CLID& UserDataCnv::classID | ( | ) | [inline, static] |
Definition at line 24 of file UserDataCnv.h.
00024 { 00025 return DayaBay::CLID_UserDataHeader; 00026 }
StatusCode UserDataCnv::PerToTran | ( | const PerHeaderObject & | tobj, | |
DayaBay::UserDataHeader & | dobj | |||
) | [virtual] |
Copy data from TObject based class of type TType to DataObject based class of type DOType.
Implements RootIOTypedCnv< PerHeaderObject, DayaBay::UserDataHeader >.
Definition at line 20 of file UserDataCnv.cc.
00022 { 00023 MsgStream log(msgSvc(), "UserDataCnv::PerToTran"); 00024 StatusCode sc = HeaderObjectCnv::toTran(perobj,tranobj); 00025 if(sc.isFailure()) return sc; 00026 00027 // Convert user-defined data 00028 tranobj.clearData(); 00029 00030 RootIOUserData ud; 00031 RootIOUserData::ProxyCollection& proxies = ud.input(m_ris->path()); 00032 RootIOUserData::ProxyCollection::iterator pit, pdone = proxies.end(); 00033 log << MSG::DEBUG 00034 << "got " << proxies.size() << " proxies from " 00035 << m_ris->path() << " for input" << endreq; 00036 00037 for (pit = proxies.begin(); pit != pdone; ++pit) { 00038 RootIOUserDataProxy* proxy = pit->second; 00039 00040 const std::string& typeName = proxy->cppType(); 00041 const std::string& varName = proxy->varName(); 00042 00043 // handle supported types 00044 UserData* userdata = 0; 00045 if (typeName == "int") { 00046 userdata = new UserInt(varName, proxy->value<int>()); 00047 } 00048 else if (typeName == "float") { 00049 userdata = new UserFloat(varName, proxy->value<float>()); 00050 } 00051 else if (typeName == "vector<int>") { 00052 userdata = new UserIntArray(varName, proxy->value< std::vector<int> >()); 00053 } 00054 else if (typeName == "vector<float>") { 00055 userdata = new UserFloatArray(varName, proxy->value< std::vector<float> >()); 00056 } 00057 else { 00058 log << MSG::ERROR 00059 << "got unknown POD type: \"" << typeName 00060 << "\" for user data \"" << varName 00061 << "\" skipping." 00062 << endreq; 00063 return StatusCode::FAILURE; 00064 } 00065 tranobj.data().push_back(userdata); 00066 } 00067 return StatusCode::SUCCESS; 00068 }
StatusCode UserDataCnv::TranToPer | ( | const DayaBay::UserDataHeader & | dobj, | |
PerHeaderObject & | tobj | |||
) | [virtual] |
Copy data from DataObject based class of type DOType to TObject based class of type TType.
Implements RootIOTypedCnv< PerHeaderObject, DayaBay::UserDataHeader >.
Definition at line 70 of file UserDataCnv.cc.
00072 { 00073 MsgStream log(msgSvc(), "UserDataCnv::TranToPer"); 00074 std::string tespath = udh.registry()->identifier(); 00075 00076 RootIOUserData ud; 00077 RootIOUserData::ProxyCollection& proxies = ud.output(tespath); 00078 00079 log << MSG::DEBUG 00080 << "got " << proxies.size() << " proxies from " 00081 << tespath << " for output" << endreq; 00082 00083 StatusCode sc; 00084 00085 if (!proxies.size()) { 00086 log << MSG::DEBUG << "No proxies for " 00087 << tespath << " initializing" << endreq; 00088 sc = this->InitializeProxies(udh, proxies); 00089 if (sc.isFailure()) return sc; 00090 } 00091 00092 sc = HeaderObjectCnv::toPer(udh,perobj); 00093 if (sc.isFailure()) return sc; 00094 00095 const UserDataHeader::UserDataList& datalist = udh.data(); 00096 00097 for (size_t ind=0; ind < datalist.size(); ++ind) { 00098 const UserData* data = datalist[ind]; 00099 00100 const std::string& varName = data->name(); 00101 00102 RootIOUserDataProxy* proxy = proxies[varName]; 00103 00104 if (!proxy) { 00105 log << MSG::ERROR << "Failed to find proxy: " << varName 00106 << " " 00107 << "Make sure you set all user data variables for every event!" 00108 << endreq; 00109 return StatusCode::FAILURE; 00110 } 00111 00112 const std::string& cppType = proxy->cppType(); 00113 00114 log << MSG::DEBUG 00115 << "Proxy: name:" << varName << " and type:" << cppType 00116 << endreq; 00117 00118 switch (data->type()) { 00119 00120 case UserData::Float: 00121 proxy->value<float>() = dynamic_cast<const UserFloat*>(data)->value(); 00122 break; 00123 00124 case UserData::Int: 00125 proxy->value<int>() = dynamic_cast<const UserInt*>(data)->value(); 00126 break; 00127 00128 00129 case UserData::FloatArray: 00130 proxy->value< vector<float> >() = dynamic_cast<const UserFloatArray*>(data)->value(); 00131 break; 00132 00133 case UserData::IntArray: 00134 proxy->value< vector<int> >() = dynamic_cast<const UserIntArray*>(data)->value(); 00135 break; 00136 00137 default: 00138 log << MSG::ERROR 00139 << "unknown type: " << data->type() 00140 << " for user data \"" << varName << "\"" 00141 << endreq; 00142 return StatusCode::FAILURE; 00143 break; 00144 } 00145 } 00146 00147 return StatusCode::SUCCESS; 00148 }
StatusCode UserDataCnv::fillRepRefs | ( | IOpaqueAddress * | addr, | |
DataObject * | dobj | |||
) | [virtual] |
Reimplemented from RootIOTypedCnv< PerHeaderObject, DayaBay::UserDataHeader >.
Definition at line 150 of file UserDataCnv.cc.
00150 { 00151 00152 MsgStream log(msgSvc(), "UserDataCnv::fillRepRefs"); 00153 UserDataHeader* header = dynamic_cast<UserDataHeader*>(dobj); 00154 00155 log << MSG::DEBUG 00156 << "Saving links to " << header->inputHeaders().size() 00157 << " input headers" << endreq; 00158 00159 StatusCode sc = HeaderObjectCnv::fillPer(m_rioSvc,*header,*m_perOutObj); 00160 00161 if (sc.isFailure()) { 00162 log << MSG::ERROR << "Failed to fill HeaderObject part" << endreq; 00163 return sc; 00164 } 00165 00166 return sc; 00167 }
StatusCode UserDataCnv::fillObjRefs | ( | IOpaqueAddress * | addr, | |
DataObject * | dobj | |||
) | [virtual] |
Reimplemented from RootIOTypedCnv< PerHeaderObject, DayaBay::UserDataHeader >.
Definition at line 169 of file UserDataCnv.cc.
00169 { 00170 MsgStream log(msgSvc(), "UserDataCnv::fillObjRefs"); 00171 HeaderObject* hobj = dynamic_cast<HeaderObject*>(dobj); 00172 00173 StatusCode sc = HeaderObjectCnv::fillTran(m_rioSvc,*m_perInObj,*hobj); 00174 if (sc.isFailure()) { 00175 log << MSG::ERROR << "Failed to fill HeaderObject part" << endreq; 00176 return sc; 00177 } 00178 00179 log << MSG::DEBUG 00180 << "Restored links to " << hobj->inputHeaders().size() 00181 << " input headers" << endreq; 00182 00183 return sc; 00184 }
StatusCode UserDataCnv::InitializeProxies | ( | const DayaBay::UserDataHeader & | udh, | |
RootIOUserData::ProxyCollection & | proxies | |||
) | [private] |
Definition at line 187 of file UserDataCnv.cc.
00189 { 00190 // Setup any required proxies for output 00191 MsgStream log(msgSvc(), "UserDataCnv::InitializeProxies"); 00192 log << MSG::DEBUG << "Initializing dynamic branches" << endreq; 00193 00194 const UserDataHeader::UserDataList& datalist = udh.data(); 00195 00196 for (size_t ind=0; ind < datalist.size(); ++ind) { 00197 const UserData* userdata = datalist[ind]; 00198 00199 const std::string& varName = userdata->name(); 00200 00201 log << MSG::DEBUG 00202 << "\tprocessing user data: " << varName 00203 << " type: " << userdata->type() 00204 << endreq; 00205 00206 RootIOUserDataProxy* proxy = 0; 00207 switch (userdata->type()) { 00208 00209 case UserData::Int: 00210 proxy = new RootIOUserDataProxy(varName,"int", 00211 (char*)new int); 00212 break; 00213 00214 case UserData::Float: 00215 proxy = new RootIOUserDataProxy(varName,"float", 00216 (char*)new float); 00217 break; 00218 00219 case UserData::IntArray: 00220 proxy = new RootIOUserDataProxy(varName,"vector<int>", 00221 (char*)new vector<int>); 00222 break; 00223 00224 case UserData::FloatArray: 00225 proxy = new RootIOUserDataProxy(varName,"vector<float>", 00226 (char*)new vector<float>); 00227 break; 00228 00229 default: 00230 log << MSG::ERROR << " unknown type: " << userdata->type() << endreq; 00231 return StatusCode::FAILURE; 00232 break; 00233 } 00234 proxies[varName] = proxy; 00235 } 00236 return StatusCode::SUCCESS; 00237 }
PerHeaderObject & RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::getPerInputObject | ( | ) | [inherited] |
PerHeaderObject & RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::getPerOutputObject | ( | ) | [inherited] |
const RootIOBaseObject * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::getBaseInputObject | ( | ) | [virtual, inherited] |
Implements RootIOBaseCnv.
const RootIOBaseObject * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::getBaseOutputObject | ( | ) | [virtual, inherited] |
Implements RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::TranObjectToPerObject | ( | DataObject & | dat, | |
const RootOutputAddress & | ||||
) | [virtual, inherited] |
Implements RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::PerObjectToTranObject | ( | DataObject *& | dat | ) | [virtual, inherited] |
Implements RootIOBaseCnv.
virtual RootInputStream * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::makeInputStream | ( | const RootInputAddress & | ria | ) | [virtual, inherited] |
Implements RootIOBaseCnv.
virtual RootOutputStream * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::makeOutputStream | ( | const RootOutputAddress & | ria | ) | [virtual, inherited] |
Implements RootIOBaseCnv.
virtual long RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::repSvcType | ( | ) | const [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::initialize | ( | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::finalize | ( | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::createObj | ( | IOpaqueAddress * | addr, | |
DataObject *& | dat | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::createRep | ( | DataObject * | pObject, | |
IOpaqueAddress *& | refpAddress | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
int RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::commit | ( | const RootOutputAddress & | roa | ) | [inherited] |
Reimplemented from RootIOBaseCnv.
RootIOBaseCnv * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::otherConverter | ( | int | clID | ) | [inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual unsigned long RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::addRef | ( | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual unsigned long RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::release | ( | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::setDataProvider | ( | IDataProviderSvc * | svc | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual IDataProviderSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::dataProvider | ( | ) | const [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::setConversionSvc | ( | IConversionSvc * | svc | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual IConversionSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::conversionSvc | ( | ) | const [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::setAddressCreator | ( | IAddressCreator * | creator | ) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual IAddressCreator * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::addressCreator | ( | ) | const [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual const CLID & RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::objType | ( | ) | const [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual long RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::i_repSvcType | ( | ) | const [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::updateObj | ( | IOpaqueAddress * | pAddress, | |
DataObject * | refpObject | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::updateObjRefs | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::updateRep | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
virtual StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::updateRepRefs | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual, inherited] |
Reimplemented from RootIOBaseCnv.
StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::service | ( | const std::string & | name, | |
T *& | psvc, | |||
bool | createIf = false | |||
) | const [inherited] |
Reimplemented from RootIOBaseCnv.
StatusCode RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::service | ( | const std::string & | type, | |
const std::string & | name, | |||
T *& | psvc | |||
) | const [inherited] |
Reimplemented from RootIOBaseCnv.
static unsigned char RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::storageType | ( | ) | [static, inherited] |
Reimplemented from RootIOBaseCnv.
static const InterfaceID & RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::interfaceID | ( | ) | [static, inherited] |
Reimplemented from RootIOBaseCnv.
static const InterfaceID & RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::interfaceID | ( | ) | [static, inherited] |
Reimplemented from RootIOBaseCnv.
ISvcLocator * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::serviceLocator | ( | ) | const [protected, inherited] |
Reimplemented from RootIOBaseCnv.
IMessageSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::msgSvc | ( | ) | const [protected, inherited] |
Reimplemented from RootIOBaseCnv.
IMessageSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::messageService | ( | ) | const [protected, inherited] |
Reimplemented from RootIOBaseCnv.
IDataManagerSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::dataManager | ( | ) | const [protected, inherited] |
Reimplemented from RootIOBaseCnv.
RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::INVALID_ADDRESS [inherited] |
Reimplemented from RootIOBaseCnv.
RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::INVALID_OBJECT [inherited] |
Reimplemented from RootIOBaseCnv.
RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::NO_MEMORY [inherited] |
Reimplemented from RootIOBaseCnv.
RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::BAD_STORAGE_TYPE [inherited] |
Reimplemented from RootIOBaseCnv.
RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::NO_SOURCE_OBJECT [inherited] |
Reimplemented from RootIOBaseCnv.
RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::ICONVERSIONSVC_LAST_ERROR [inherited] |
Reimplemented from RootIOBaseCnv.
std::string RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::m_perclassName [protected, inherited] |
PerHeaderObject * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::m_perInObj [protected, inherited] |
PerHeaderObject * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::m_perOutObj [protected, inherited] |
IRootIOSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::m_rioSvc [protected, inherited] |
Reimplemented from RootIOBaseCnv.
IConversionSvc * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::m_cnvSvc [protected, inherited] |
Reimplemented from RootIOBaseCnv.
RootInputStream * RootIOTypedCnv< PerHeaderObject , DayaBay::UserDataHeader >::m_ris [protected, inherited] |
Reimplemented from RootIOBaseCnv.