ATLAS Offline Software
LArCondAthenaPool/src/T_LArCondAthenaPoolCnv.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 template <class T>
6 T_LArCondAthenaPoolCnv<T>::T_LArCondAthenaPoolCnv(ISvcLocator* svcloc)
7  : LArCondAthenaPoolCnvBase( svcloc)
8 {
9 
10 }
11 
12 template <class T>
13 T_LArCondAthenaPoolCnv<T>::~T_LArCondAthenaPoolCnv()
14 {
15 
16 }
17 
18 template <class T>
19 StatusCode T_LArCondAthenaPoolCnv<T>::DataObjectToPool(IOpaqueAddress* pAddr, DataObject* pObj)
20 {
21 
22  T* obj = 0;
23  const std::string className = System::typeinfoName(typeid(T));
24  SG::fromStorable(pObj, obj);
25  if (obj == 0) {
26  MsgStream log(msgSvc(), "T_LArCondAthenaPoolCnv");
27  log << MSG::ERROR << "Failed to cast to " << className << endmsg;
28  return(StatusCode::FAILURE);
29  }
30 
31 /*
32  const MAP_P* cache = obj->getCache();
33 
34 
35  if( cache->size()!=0)
36  {
37  // write persistent data to POOL.
38  // MsgStream log(msgSvc(), "T_LArCondAthenaPoolCnv");
39  ....
40  // return(StatusCode::FAILURE);
41  }
42 */
43 
44 
45  return LArCondAthenaPoolCnvBase::DataObjectToPool(pAddr, pObj) ;
46 
47 }
48 
49 
50 template <class T>
51 StatusCode
52 T_LArCondAthenaPoolCnv<T>::PoolToDataObject(DataObject*& pObj,
53  const std::string& token,
54  const std::string& key)
55 {
56  StatusCode sc = LArCondAthenaPoolCnvBase:: PoolToDataObject(pObj, token, key);
57  if(!sc.isSuccess() ) return sc;
58 
59  T* obj = 0;
60  const std::string className = System::typeinfoName(typeid(T));
61  SG::fromStorable(pObj, obj);
62  if(obj){
63  obj->initialize();
64  } else
65  {
66  MsgStream log(msgSvc(), "T_LArCondAthenaPoolCnv");
67  const std::string className = System::typeinfoName(typeid(T));
68  log << MSG::ERROR << "Failed to cast to " << className << endmsg;
69  return(StatusCode::FAILURE);
70  }
71 
72  return StatusCode::SUCCESS;
73 
74 }