ATLAS Offline Software
DsoDb.h
Go to the documentation of this file.
1 
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 
21 #include "DataModelRoot/RootType.h"
23 
24 // Forward declaration
25 
26 namespace Ath {
27 
30 class DsoDb
31 {
33  // Public typedefs:
35 public:
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
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Ath::DsoDb::pf
const DsoMap_t & pf() const
repository of plugin factories
Definition: DsoDb.h:91
Ath::DsoDb::dict_duplicates
DsoMap_t dict_duplicates(bool pedantic=false) const
table of dict-duplicates: {type: [lib1, lib2, ...]}
Definition: DsoDb.cxx:509
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Ath::DsoDb
helper class to query rootmap files and extract their content
Definition: DsoDb.h:31
Ath::DsoDb::m_pf
DsoMap_t m_pf
repository of plugin factories
Definition: DsoDb.h:150
Ath::DsoDb::instance
static const DsoDb * instance()
factory for the DsoDb
Definition: DsoDb.cxx:237
checkPlugins.dups
dups
Definition: checkPlugins.py:156
checkPlugins.pedantic
pedantic
Definition: checkPlugins.py:156
Ath::DsoDb::m_dsofiles
std::vector< std::string > m_dsofiles
list of dsofiles
Definition: DsoDb.h:156
Ath::DsoDb::db
const DsoMap_t & db() const
repository of components
Definition: DsoDb.h:94
Ath::DsoDb::dso_files
const std::vector< std::string > & dso_files() const
list of all dsomap/rootmap files we know about
Definition: DsoDb.h:87
Ath::DsoDb::has_type
bool has_type(const std::string &type_name) const
Definition: DsoDb.cxx:263
Ath::DsoDb::capabilities
std::vector< std::string > capabilities(const std::string &libname) const
list of reflex-types associated with a library name
Definition: DsoDb.cxx:444
Ath::DsoDb::Libs_t
std::vector< std::string > Libs_t
Definition: DsoDb.h:36
Ath::DsoDb::content
DsoMap_t content(bool pedantic) const
return the table {type: [lib1, ...]} - concatenation of all dict-entries and plugin-factories entries...
Definition: DsoDb.cxx:558
lumiFormat.i
int i
Definition: lumiFormat.py:85
Ath
Definition: DynamicDataHelper.h:13
Ath::DsoDb::libs
Libs_t libs(bool detailed=false) const
list of all libraries we know about
Definition: DsoDb.cxx:528
Ath::DsoDb::operator=
DsoDb & operator=(const DsoDb &rhs)
Assignment operator:
Ath::DsoDb::DsoMap_t
std::unordered_map< std::string, Libs_t > DsoMap_t
Definition: DsoDb.h:37
Ath::DsoDb::py_vals_from
static std::vector< std::vector< std::string > > py_vals_from(const Ath::DsoDb::DsoMap_t &m)
Definition: DsoDb.h:57
Ath::DsoDb::get_dups
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
Ath::DsoDb::~DsoDb
~DsoDb()
Destructor:
Definition: DsoDb.cxx:255
Ath::DsoDb::m_db
DsoMap_t m_db
repository of components
Definition: DsoDb.h:153
python.PyAthena.v
v
Definition: PyAthena.py:154
Ath::DsoDb::DsoDb
DsoDb(const DsoDb &rhs)
Copy constructor:
Ath::DsoDb::DsoDb
DsoDb()
Default constructor:
Definition: DsoDb.cxx:245
Ath::DsoDb::build_repository
void build_repository()
initialize the repository of dso file names
Definition: DsoDb.cxx:292
RootType.h
Ath::DsoDb::ATLAS_NOT_THREAD_SAFE
RootType rflx_type ATLAS_NOT_THREAD_SAFE(const std::string &type_name) const
load the reflex type after having loaded the hosting library
Ath::DsoDb::ATLAS_NOT_THREAD_SAFE
std::string load_type ATLAS_NOT_THREAD_SAFE(const std::string &type_name) const
Ath::DsoDb::duplicates
DsoMap_t duplicates(const std::string &libname, bool pedantic=false) const
list of libraries hosting duplicate reflex-types
Definition: DsoDb.cxx:474
checker_macros.h
Define macros for attributes used to control the static checker.
Ath::DsoDb::pf_duplicates
DsoMap_t pf_duplicates(bool pedantic=false) const
table of plugin-factories-duplicates: {type: [lib1, lib2, ...]}
Definition: DsoDb.cxx:518
Ath::DsoDb::py_keys_from
static std::vector< std::string > py_keys_from(const Ath::DsoDb::DsoMap_t &m)
Definition: DsoDb.h:43
fitman.k
k
Definition: fitman.py:528
TScopeAdapter
Definition: RootType.h:119