ATLAS Offline Software
Loading...
Searching...
No Matches
DsoDb.h
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// DsoDb.h
8// Header file for class DsoDb
9// Author: S.Binet<binet@cern.ch>
11#ifndef ATHENAKERNEL_ATH_DSODB_H
12#define ATHENAKERNEL_ATH_DSODB_H 1
13
14// STL includes
15#include <iosfwd>
16#include <string>
17#include <vector>
18#include <map>
19#include <unordered_map>
20
23
24// Forward declaration
25
26namespace Ath {
27
30class DsoDb
31{
33 // Public typedefs:
35public:
36 typedef std::vector<std::string> Libs_t;
37 typedef std::unordered_map<std::string, Libs_t> DsoMap_t;
38 //typedef std::map<std::string, Libs_t> DsoMap_t;
39
40 // helper functions for pythonizations
41 static
42 std::vector<std::string>
44 {
45 std::vector<std::string> k;
46 k.reserve(m.size());
47 for (Ath::DsoDb::DsoMap_t::const_iterator i = m.begin(), e = m.end();
48 i != e;
49 ++i) {
50 k.push_back(i->first);
51 }
52 return k;
53 }
54
55 static
56 std::vector<std::vector<std::string> >
58 {
59 std::vector<Libs_t> v;
60 v.reserve(m.size());
61 for (Ath::DsoDb::DsoMap_t::const_iterator i = m.begin(), e = m.end();
62 i != e;
63 ++i) {
64 v.push_back(i->second);
65 }
66 return v;
67 }
68
70 // Public methods:
72 public:
73
76 static
77 const DsoDb* instance();
78
80 ~DsoDb();
81
83 // Const methods:
85
87 const std::vector<std::string>& dso_files() const
88 { return m_dsofiles; }
89
91 const DsoMap_t& pf() const { return m_pf; }
92
94 const DsoMap_t& db() const { return m_db; }
95
97 // Non-const methods:
99
100 bool has_type(const std::string& type_name) const;
101
102 std::string load_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) const;
103
105 std::vector<std::string> capabilities(const std::string& libname) const;
106
108 DsoMap_t duplicates(const std::string& libname, bool pedantic=false) const;
109
111 DsoMap_t dict_duplicates(bool pedantic=false) const;
112
114 DsoMap_t pf_duplicates(bool pedantic=false) const;
115
118 Libs_t libs(bool detailed=false) const;
119
123 DsoMap_t content(bool pedantic) const;
124
126 // Private data:
128 private:
129
131 void build_repository();
132
134 void
135 get_dups(DsoMap_t& dups, const DsoMap_t& db, bool pedantic) const;
136
138 RootType rflx_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) const;
139
141 DsoDb();
142
144 DsoDb( const DsoDb& rhs ); //> not implemented
145
147 DsoDb& operator=( const DsoDb& rhs ); //> not implemented
148
151
154
156 std::vector<std::string> m_dsofiles;
157
158};
159
160
161} //> end namespace Ath
162
163#endif //> !ATHENAKERNEL_ATH_DSODB_H
TTypeAdapter RootType
Definition RootType.h:211
Define macros for attributes used to control the static checker.
helper class to query rootmap files and extract their content
Definition DsoDb.h:31
DsoMap_t pf_duplicates(bool pedantic=false) const
table of plugin-factories-duplicates: {type: [lib1, lib2, ...]}
Definition DsoDb.cxx:518
DsoMap_t m_db
repository of components
Definition DsoDb.h:153
DsoDb & operator=(const DsoDb &rhs)
Assignment operator:
std::vector< std::string > Libs_t
Definition DsoDb.h:36
Libs_t libs(bool detailed=false) const
list of all libraries we know about
Definition DsoDb.cxx:528
std::vector< std::string > m_dsofiles
list of dsofiles
Definition DsoDb.h:156
~DsoDb()
Destructor:
Definition DsoDb.cxx:255
std::unordered_map< std::string, Libs_t > DsoMap_t
Definition DsoDb.h:37
const DsoMap_t & pf() const
repository of plugin factories
Definition DsoDb.h:91
void build_repository()
initialize the repository of dso file names
Definition DsoDb.cxx:292
DsoDb()
Default constructor:
Definition DsoDb.cxx:245
std::vector< std::string > capabilities(const std::string &libname) const
list of reflex-types associated with a library name
Definition DsoDb.cxx:444
bool has_type(const std::string &type_name) const
Definition DsoDb.cxx:263
void get_dups(DsoMap_t &dups, const DsoMap_t &db, bool pedantic) const
get the duplicates for a given repository of components
Definition DsoDb.cxx:594
RootType rflx_type ATLAS_NOT_THREAD_SAFE(const std::string &type_name) const
load the reflex type after having loaded the hosting library
DsoDb(const DsoDb &rhs)
Copy constructor:
const DsoMap_t & db() const
repository of components
Definition DsoDb.h:94
static std::vector< std::string > py_keys_from(const Ath::DsoDb::DsoMap_t &m)
Definition DsoDb.h:43
static const DsoDb * instance()
factory for the DsoDb
Definition DsoDb.cxx:237
std::string load_type ATLAS_NOT_THREAD_SAFE(const std::string &type_name) const
DsoMap_t dict_duplicates(bool pedantic=false) const
table of dict-duplicates: {type: [lib1, lib2, ...]}
Definition DsoDb.cxx:509
const std::vector< std::string > & dso_files() const
list of all dsomap/rootmap files we know about
Definition DsoDb.h:87
DsoMap_t m_pf
repository of plugin factories
Definition DsoDb.h:150
DsoMap_t content(bool pedantic) const
return the table {type: [lib1, ...]} - concatenation of all dict-entries and plugin-factories entries...
Definition DsoDb.cxx:558
DsoMap_t duplicates(const std::string &libname, bool pedantic=false) const
list of libraries hosting duplicate reflex-types
Definition DsoDb.cxx:474
static std::vector< std::vector< std::string > > py_vals_from(const Ath::DsoDb::DsoMap_t &m)
Definition DsoDb.h:57