ATLAS Offline Software
Loading...
Searching...
No Matches
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.
void debugCreatePersistent (CLID clid)
 Called by templated converters at the start of createPersistent.
void throwExcNoDictForClass (const std::type_info &ti)
 Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.
void throwExcUnsupportedVersion (const std::type_info &ti, const Guid &guid)
 Throw a AthenaPoolCnvSvc::ExcUnsupportedVersion exception.
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.
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.
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.
Guid guidFromTypeinfo (const std::type_info &ti)
 Given a type_info, get the corresponding pool guid.
std::string excNoDictForClass_format (const std::type_info &ti)
 Helper: format exception error string.
std::string excUnsupportedVersion_format (const std::type_info &ti, const Guid &guid)
 Helper: format exception error string.
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.

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()

void AthenaPoolCnvSvc::debugCreatePersistent ( 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}

◆ debugCreateTransient()

void AthenaPoolCnvSvc::debugCreateTransient ( 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}

◆ 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 92 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

97{
98 return std::format("AthenaPoolCnvSvc::::ExcCaughtException: Caught exception in {} while {}{}/{}: {}: {}",
99 fnname, action, System::typeinfoName(ti), key,
100 System::typeinfoName(typeid(ex)), ex.what());
101}

◆ excNoDictForClass_format()

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

Helper: format exception error string.

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

25{
26 return std::string("AthenaPoolCnvSvc::::ExcNoDictForClass: "
27 "Can't find dictionary information for class: ") +
28 System::typeinfoName(ti);
29}

◆ excUnsupportedVersion_format()

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

Helper: format exception error string.

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

58{
59 return std::string("AthenaPoolCnvSvc::::ExcUnsupportedVersion: "
60 "Unsupported persistent version of ") +
61 System::typeinfoName(ti) + " found; guid: " + guid.toString();
62}

◆ 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 cls2 = TClass::GetClass (ti);
90 if (cls2) {
91 msg << MSG::ERROR << "Got TClass by ti " << cls2->GetName() << " " <<
92 (cls == cls2) << " " <<
93 cls2->HasInterpreterInfoInMemory() << " " <<
94 cls2->HasInterpreterInfo() << " " <<
95 cls2->GetState() << " " <<
96 cls2->HasDictionary() << " " <<
97 cls2->IsLoaded() << " " <<
98 cls2->IsForeign() << endmsg;
99 }
100 else {
101 msg << MSG::ERROR << "Could not re-get class by ti" << endmsg;
102 }
103
104 cls2 = TClass::GetClass (clname.c_str());
105 if (cls2) {
106 msg << MSG::ERROR << "Got TClass by name " << cls2->GetName() << " " <<
107 (cls == cls2) << " " <<
108 cls2->HasInterpreterInfoInMemory() << " " <<
109 cls2->HasInterpreterInfo() << " " <<
110 cls2->GetState() << " " <<
111 cls2->HasDictionary() << " " <<
112 cls2->IsLoaded() << " " <<
113 cls2->IsForeign() << endmsg;
114 }
115 else {
116 msg << MSG::ERROR << "Could not re-get class by name" << endmsg;
117 }
118 }
120 }
121 return pool::DbReflex::guid (typ);
122}
#define endmsg
static const TypeH forTypeInfo(const std::type_info &info)
Access classes by RTTI type information.
static Guid guid(const TypeH &id)
Determine Guid (normalized string form) from reflection type.
void throwExcNoDictForClass(const std::type_info &ti)
Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.
IMessageSvc * getMessageSvc(bool quiet=false)
RootType TypeH
Definition DbReflex.h:30
MsgStream & msg
Definition testRead.cxx:32

◆ 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 132 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

137{
138 std::cout.flush();
139 std::cerr.flush();
141 throw ExcCaughtException (fnname, action, ex, ti, key);
142}
void exctrace(const std::exception &e, IOFD fd=IOFD_INVALID)
Print out information for the last exception.
Definition exctrace.cxx:59

◆ throwExcNoDictForClass()

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

Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.

Parameters
tiThe requested class.

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

47{
48 throw ExcNoDictForClass (ti);
49}

◆ 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 82 of file Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx.

83{
84 throw ExcUnsupportedVersion (ti, guid);
85}