18#include "Gaudi/Property.h"
19#include "GaudiKernel/System.h"
24#include "TClassEdit.h"
29bool startsWith (
const std::string& a,
const std::string& b)
31 return (a.compare (0,
b.size(), b) == 0);
39 ISvcLocator* pSvcLocator) :
40 base_class( name, pSvcLocator ),
60 return StatusCode::FAILURE;
67 return StatusCode::SUCCESS;
73 return StatusCode::SUCCESS;
86 ATH_MSG_DEBUG (
"no reflex dict. for type [" << type_name <<
"]");
97 return has_type (System::typeinfoName(typeinfo).c_str());
106 std::string name =
"<N/A>";
107 if (
m_clidSvc->getTypeNameOfID(clid, name).isSuccess()) {
115 if (
m_clidSvc->getTypeInfoNameOfID(clid, name).isSuccess()) {
157 (
"loading [" << System::typeinfoName(typeinfo) <<
" (from typeinfo)]...");
158 return load_type (System::typeinfoName(typeinfo), recursive);
168 std::string name =
"<N/A>";
169 if (!
m_clidSvc->getTypeNameOfID(clid, name).isSuccess()) {
170 ATH_MSG_INFO (
"could not retrieve typename for clid [" << clid <<
"]");
180 ATH_MSG_DEBUG(
"loading [" << name <<
" (from clid="<<clid<<
")]...");
188 m_clidSvc->getTypeInfoNameOfID(clid, name).ignore();
214 if (startsWith (tnam,
"const ")) {
227 std::string nam = typ.
Name();
228 if (!memo.insert (nam).second)
return;
229 if (nam ==
"string" || nam ==
"std::string" ||
230 startsWith (nam,
"basic_string<") ||
231 startsWith (nam,
"std::basic_string<"))
235 if (startsWith (nam,
"vector<") || startsWith (nam,
"std::vector<")) {
236 std::string eltclass;
241 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
242 TClassEdit::TSplitType
split (nam.c_str());
243 if (
split.fElements.size() > 1) {
244 eltclass =
split.fElements[1];
247 if (!eltclass.empty()) {
253 else if (startsWith (nam,
"DataVector<")) {
254 std::string eltclass;
259 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
260 TClassEdit::TSplitType
split (nam.c_str());
261 if (
split.fElements.size() > 1) {
262 eltclass =
split.fElements[1];
265 if (!eltclass.empty()) {
270 else if (startsWith (nam,
"pair<") || startsWith (nam,
"std::pair<")) {
271 std::string pclass1, pclass2;
276 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
277 TClassEdit::TSplitType
split (nam.c_str());
278 if (
split.fElements.size() > 2) {
279 pclass1 =
split.fElements[1];
280 pclass2 =
split.fElements[2];
283 if (!pclass1.empty()) {
289 else if (startsWith (nam,
"map<") || startsWith (nam,
"std::map<")) {
290 std::string pclass1, pclass2;
295 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
296 TClassEdit::TSplitType
split (nam.c_str());
297 if (
split.fElements.size() > 2) {
298 pclass1 =
split.fElements[1];
299 pclass2 =
split.fElements[2];
302 if (!pclass1.empty()) {
306 std::string pname =
"std::pair<" + pclass1 +
"," + pclass2 +
">";
311 else if (startsWith (nam,
"LArConditionsContainer<")) {
317 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
318 TClassEdit::TSplitType
split (nam.c_str());
319 if (
split.fElements.size() > 1) {
320 pname =
"LArConditionsSubset<" +
split.fElements[1] +
">";
323 if (!pname.empty()) {
326 std::unique_ptr<ITPCnvBase> tpcnv =
m_tpCnvSvc->t2p_cnv_unique (pname);
328 load_type (tpcnv->persistentTInfo(),
true);
335 for (
size_t i = 0; i < nbase; i++) {
340 for (
size_t i = 0; i < nmem; i++) {
#define ATH_CHECK
Evaluate an expression and check for errors.
Provide an interface for finding inheritance information at run time.
uint32_t CLID
The Class ID type.
Run a MT piece of code with an alternate root error handler.
const Ath::DsoDb * m_dsodb
dictionary of all known (reflex) types
virtual bool has_type(const std::string &type_name) override
check a Reflex dictionary exists for a given type
void load_recursive1(const std::string &tnam, Memo_t &memo)
virtual ~AthDictLoaderSvc()
Destructor:
virtual StatusCode finalize() override
ServiceHandle< ITPCnvSvc > m_tpCnvSvc
std::unordered_set< std::string > Memo_t
virtual StatusCode initialize() override
Gaudi Service Implementation.
void load_recursive(const RootType &typ)
AthDictLoaderSvc()
Default constructor:
ServiceHandle< IClassIDSvc > m_clidSvc
handle to a IClassIDSvc to handle loading of types by CLID
virtual const RootType load_type(const std::string &type_name, bool recursive=false) override
retrieve a Reflex::Type by name (auto)loading the dictionary by any necessary means.
static const DsoDb * instance()
factory for the DsoDb
Run a MT piece of code with an alternate root error handler.
The non-template portion of the BaseInfo implementation.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
const std::type_info & typeinfo() const
Return the std::type_info for this class.
TTypeAdapter TypeOf() const
static TScopeAdapter ByNameNoQuiet(const std::string &name, Bool_t load=kTRUE)
size_t DataMemberSize() const
Bool_t IsFundamental() const
TMemberAdapter DataMemberAt(size_t nth) const
TBaseAdapter BaseAt(size_t nth) const
std::string Name(unsigned int mod=Reflex::SCOPED) const
std::vector< std::string > split(const std::string &s, const std::string &t=":")