ATLAS Offline Software
Classes | Functions
AthenaPoolCnvSvc Namespace Reference

Classes

class  ExcCaughtException
 Exception — Caught an exception during conversion. More...
 
class  ExcNoDictForClass
 Exception — Can't find dictionary information for class. More...
 
class  ExcUnsupportedVersion
 Exception — Unsupported persistent version of CLASS found. More...
 
class  TPCnvElt
 Helper for calling a TP converter from an Athena converter. More...
 
class  TPCnvElt< CNV, T_TPCnvNull< TRANS > >
 Helper for calling a TP converter from an Athena converter. More...
 
class  TPCnvList
 Helper for calling TP converters from an Athena converter. More...
 

Functions

void debugCreateTransient (CLID clid)
 Called by templated converters at the start of createTransient. More...
 
void debugCreatePersistent (CLID clid)
 Called by templated converters at the start of createPersistent. More...
 
void throwExcNoDictForClass (const std::type_info &ti)
 Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception. More...
 
void throwExcUnsupportedVersion (const std::type_info &ti, const Guid &guid)
 Throw a AthenaPoolCnvSvc::ExcUnsupportedVersion exception. More...
 
void throwExcCaughtException (const char *fnname, const char *action, const std::exception &ex, const std::type_info &ti, const std::string &key)
 Throw a AthenaPoolCnvSvc::ExcCaughtException exception. More...
 
template<class TPCNV , typename std::enable_if_t< std::is_base_of_v< ITPConverter, TPCNV > > * = nullptr>
std::unique_ptr< typename TPCNV::Pers_t > createPersistent (TPCNV &cnv, const typename TPCNV::Trans_t *transObj, const std::string &key, MsgStream &log)
 Create a persistent object from a transient object. More...
 
template<class TPCNV , typename std::enable_if_t< std::is_base_of_v< ITPConverter, TPCNV > > * = nullptr>
std::unique_ptr< typename TPCNV::Trans_t > createTransient (TPCNV &cnv, const typename TPCNV::Pers_t *persObj, const std::string &key, MsgStream &log)
 Create a transient object from a persistent object. More...
 
Guid guidFromTypeinfo (const std::type_info &ti)
 Given a type_info, get the corresponding pool guid. More...
 
void debugCreateTransient ([[maybe_unused]] CLID clid)
 Called by templated converters at the start of createTransient. More...
 
void debugCreatePersistent ([[maybe_unused]] CLID clid)
 Called by templated converters at the start of createPersistent. More...
 
std::string excNoDictForClass_format (const std::type_info &ti)
 Helper: format exception error string. More...
 
std::string excUnsupportedVersion_format (const std::type_info &ti, const Guid &guid)
 Helper: format exception error string. More...
 
std::string excCaughtException_format (const char *fnname, const char *action, const std::exception &ex, const std::type_info &ti, const std::string &key)
 Helper: format exception error string. More...
 

Function Documentation

◆ createPersistent()

template<class TPCNV , typename std::enable_if_t< std::is_base_of_v< ITPConverter, TPCNV > > * = nullptr>
std::unique_ptr<typename TPCNV::Pers_t> AthenaPoolCnvSvc::createPersistent ( TPCNV &  cnv,
const typename TPCNV::Trans_t *  transObj,
const std::string &  key,
MsgStream &  log 
)

Create a persistent object from a transient object.

Parameters
cnvThe TP converter to call.
transObjThe transient object to convert.
TheSG key of the object.
logFor logging messages.

This version is used when CNV derives from ITPConverter. We call TPCNV::createPersistentWithKey().

Parameters
cnvThe TP converter to call.
transObjThe transient object to convert.
TheSG key of the object.
logFor logging messages.

This version is used when CNV does not derivce from ITPConverter. We create the persistent object directly and call TPCnv::transToPers().

Definition at line 53 of file T_AthenaPoolCreateFuncs.h.

57 {
58  return std::unique_ptr<typename TPCNV::Pers_t>
59  (cnv.createPersistentWithKey (transObj, key, log));
60 }

◆ createTransient()

template<class TPCNV , typename std::enable_if_t< std::is_base_of_v< ITPConverter, TPCNV > > * = nullptr>
std::unique_ptr<typename TPCNV::Trans_t> AthenaPoolCnvSvc::createTransient ( TPCNV &  cnv,
const typename TPCNV::Pers_t *  persObj,
const std::string &  key,
MsgStream &  log 
)

Create a transient object from a persistent object.

Parameters
cnvThe TP converter to call.
persObjThe persistent object to convert.
TheSG key of the object.
logFor logging messages.

This version is used when CNV derives from ITPConverter. We call TPCNV::createTransientWithKey().

Parameters
cnvThe TP converter to call.
persObjThe persistent object to convert.
TheSG key of the object.
logFor logging messages.

This version is used when CNV does not derivce from ITPConverter. We create the transient object directly and call TPCnv::persToTrans().

Definition at line 100 of file T_AthenaPoolCreateFuncs.h.

104 {
105  return std::unique_ptr<typename TPCNV::Trans_t>
106  (cnv.createTransientWithKey (persObj, key, log));
107 }

◆ debugCreatePersistent() [1/2]

void AthenaPoolCnvSvc::debugCreatePersistent ( [[maybe_unused] ] CLID  clid)

Called by templated converters at the start of createPersistent.

Parameters
clidThe CLID of the class being converted.

Definition at line 37 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/debug.cxx.

38 {
39 }

◆ debugCreatePersistent() [2/2]

void AthenaPoolCnvSvc::debugCreatePersistent ( CLID  clid)

Called by templated converters at the start of createPersistent.

Parameters
clidThe CLID of the class being converted.

◆ debugCreateTransient() [1/2]

void AthenaPoolCnvSvc::debugCreateTransient ( [[maybe_unused] ] CLID  clid)

Called by templated converters at the start of createTransient.

Parameters
clidThe CLID of the class being converted.

Definition at line 26 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/debug.cxx.

27 {
28 }

◆ debugCreateTransient() [2/2]

void AthenaPoolCnvSvc::debugCreateTransient ( CLID  clid)

Called by templated converters at the start of createTransient.

Parameters
clidThe CLID of the class being converted.

◆ excCaughtException_format()

std::string AthenaPoolCnvSvc::excCaughtException_format ( const char *  fnname,
const char *  action,
const std::exception &  ex,
const std::type_info &  ti,
const std::string &  key 
)

Helper: format exception error string.

Definition at line 96 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

101 {
102  std::ostringstream os;
103  os << "AthenaPoolCnvSvc::::ExcCaughtException: "
104  << "Caught exception in " << fnname
105  << " while " << action
106  << System::typeinfoName(ti) << "/" << key
107  << ": " << System::typeinfoName(typeid(ex)) << ": " << ex.what();
108  return os.str();
109 }

◆ excNoDictForClass_format()

std::string AthenaPoolCnvSvc::excNoDictForClass_format ( const std::type_info &  ti)

Helper: format exception error string.

Definition at line 23 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

24 {
25  std::ostringstream os;
26  os << "AthenaPoolCnvSvc::::ExcNoDictForClass: "
27  << "Can't find dictionary information for class: ";
28  os << System::typeinfoName(ti);
29  return os.str();
30 }

◆ excUnsupportedVersion_format()

std::string AthenaPoolCnvSvc::excUnsupportedVersion_format ( const std::type_info &  ti,
const Guid guid 
)

Helper: format exception error string.

Definition at line 57 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

59 {
60  std::ostringstream os;
61  os << "AthenaPoolCnvSvc::::ExcUnsupportedVersion: "
62  << "Unsupported persistent version of "
63  << System::typeinfoName(ti)
64  << " found; guid: " << guid.toString();
65  return os.str();
66 }

◆ guidFromTypeinfo()

Guid AthenaPoolCnvSvc::guidFromTypeinfo ( const std::type_info &  ti)

Given a type_info, get the corresponding pool guid.

Parameters
titype_info to look for.

Throws an exception on errors.

Definition at line 30 of file TPCnvElt.cxx.

31 {
33  if (!typ) {
34  // Print additional diagnostic information here to try to get a better
35  // handle on why this is happening.
36  // See ATEAM-697.
37  std::string clname = System::typeinfoName (ti);
38  MsgStream msg (Athena::getMessageSvc(), "TPCnvElt");
39  msg << MSG::ERROR << "Cannot find full dictionary information for class " <<
40  clname << endmsg;
41  TClass* cls = static_cast<TClass*>(typ);
42  if (!cls) {
43  msg << MSG::ERROR << "No TClass; trying to retrieve again." << endmsg;
44  cls = TClass::GetClass (ti);
45  if (!cls) {
46  msg << MSG::ERROR << "Couldn't retrieve via type_info; try by name." << endmsg;
47  cls = TClass::GetClass (clname.c_str());
48  }
49  }
50  if (cls) {
51  msg << MSG::ERROR << "Got TClass " << cls->GetName() << " " <<
52  cls->HasInterpreterInfoInMemory() << " " <<
53  cls->HasInterpreterInfo() << " " <<
54  cls->GetState() << " " <<
55  cls->HasDictionary() << " " <<
56  cls->IsLoaded() << " " <<
57  cls->IsForeign() << endmsg;
58 
59  TClass* cls2 = TClass::GetClass (ti);
60  if (cls2) {
61  msg << MSG::ERROR << "Got TClass by ti " << cls2->GetName() << " " <<
62  (cls == cls2) << " " <<
63  cls2->HasInterpreterInfoInMemory() << " " <<
64  cls2->HasInterpreterInfo() << " " <<
65  cls2->GetState() << " " <<
66  cls2->HasDictionary() << " " <<
67  cls2->IsLoaded() << " " <<
68  cls2->IsForeign() << endmsg;
69  }
70  else {
71  msg << MSG::ERROR << "Could not re-get class by ti" << endmsg;
72  }
73 
74  cls2 = TClass::GetClass (clname.c_str());
75  if (cls2) {
76  msg << MSG::ERROR << "Got TClass by name " << cls2->GetName() << " " <<
77  (cls == cls2) << " " <<
78  cls2->HasInterpreterInfoInMemory() << " " <<
79  cls2->HasInterpreterInfo() << " " <<
80  cls2->GetState() << " " <<
81  cls2->HasDictionary() << " " <<
82  cls2->IsLoaded() << " " <<
83  cls2->IsForeign() << endmsg;
84  }
85  else {
86  msg << MSG::ERROR << "Could not re-get class by name" << endmsg;
87  }
88 
89  sleep (10);
90 
91  cls2 = TClass::GetClass (ti);
92  if (cls2) {
93  msg << MSG::ERROR << "Got TClass by ti " << cls2->GetName() << " " <<
94  (cls == cls2) << " " <<
95  cls2->HasInterpreterInfoInMemory() << " " <<
96  cls2->HasInterpreterInfo() << " " <<
97  cls2->GetState() << " " <<
98  cls2->HasDictionary() << " " <<
99  cls2->IsLoaded() << " " <<
100  cls2->IsForeign() << endmsg;
101  }
102  else {
103  msg << MSG::ERROR << "Could not re-get class by ti" << endmsg;
104  }
105 
106  cls2 = TClass::GetClass (clname.c_str());
107  if (cls2) {
108  msg << MSG::ERROR << "Got TClass by name " << cls2->GetName() << " " <<
109  (cls == cls2) << " " <<
110  cls2->HasInterpreterInfoInMemory() << " " <<
111  cls2->HasInterpreterInfo() << " " <<
112  cls2->GetState() << " " <<
113  cls2->HasDictionary() << " " <<
114  cls2->IsLoaded() << " " <<
115  cls2->IsForeign() << endmsg;
116  }
117  else {
118  msg << MSG::ERROR << "Could not re-get class by name" << endmsg;
119  }
120  }
122  }
123  return pool::DbReflex::guid (typ);
124 }

◆ throwExcCaughtException()

void AthenaPoolCnvSvc::throwExcCaughtException ( const char *  fnname,
const char *  action,
const std::exception &  ex,
const std::type_info &  ti,
const std::string &  key 
)

Throw a AthenaPoolCnvSvc::ExcCaughtException exception.

Parameters
fnnameName of the function being executed.
actionWhat we were doing when we caught the exception.
exThe caught exception.
tiThe class being thinned.
keyKey of the class being thinned.

Will also print a stack trace if exctrace is enabled.

Definition at line 140 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

145 {
146  std::cout.flush();
147  std::cerr.flush();
148  CxxUtils::exctrace (ex);
149  throw ExcCaughtException (fnname, action, ex, ti, key);
150 }

◆ throwExcNoDictForClass()

void AthenaPoolCnvSvc::throwExcNoDictForClass ( const std::type_info &  ti)

Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.

Parameters
tiThe requested class.

Definition at line 47 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

48 {
49  throw ExcNoDictForClass (ti);
50 }

◆ throwExcUnsupportedVersion()

void AthenaPoolCnvSvc::throwExcUnsupportedVersion ( const std::type_info &  ti,
const Guid guid 
)

Throw a AthenaPoolCnvSvc::ExcUnsupportedVersion exception.

Parameters
tiThe class being read.
guidThe GUID of the persistent class.

Definition at line 86 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

87 {
88  throw ExcUnsupportedVersion (ti, guid);
89 }
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
pool::DbReflex::forTypeInfo
static const TypeH forTypeInfo(const std::type_info &info)
Access classes by RTTI type information.
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
pool_uuid.guid
guid
Definition: pool_uuid.py:112
AthenaPoolCnvSvc::throwExcNoDictForClass
void throwExcNoDictForClass(const std::type_info &ti)
Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:47
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CxxUtils::exctrace
void exctrace(const std::exception &e, IOFD fd=IOFD_INVALID)
Print out information for the last exception.
Definition: exctrace.cxx:59
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TScopeAdapter
Definition: RootType.h:119
pool::DbReflex::guid
static Guid guid(const TypeH &id)
Determine Guid (normalized string form) from reflection type.