ATLAS Offline Software
TextFileDBReader.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TextFileDBReader_H
6 #define TextFileDBReader_H
7 
9 #include <string>
10 #include <map>
11 //for thread-safety checker
13 //use thread-safe atomic_flag to replace m_logger
14 #include <atomic>
15 #include <unordered_map>
16 
18 {
19 public:
20  TextFileDBReader(const std::string & filename);
22  bool readFile(const std::string & filename);
23  bool find(const std::string & key, std::string & result) const;
24  void printParameters(const std::string & section = "") const;
25  void printNotUsed(const std::string & section = "") const;
26  bool sectionPresent(const std::string & section) const;
27 
28 private:
29  class Data
30  {
31  public:
32  Data() : section(0) {}
33  Data(const std::string & v, int s)
34  : value(v),
35  section(s)
36  {}
37  std::string value;
38  int section;
39  //add a atomic_flag to replace the m_logger
40  mutable std::atomic_bool flag = ATOMIC_VAR_INIT(false);
41  };
42 
43 
44  std::string formatKey(const std::string & key) const;
45  bool getRowNumber(std::string & key, std::string & rowNumber) const;
46  void add(const std::string & key, const std::string & value);
47  void add(const std::string & key, int);
48  std::unordered_map<std::string, Data> m_table;
49  std::unordered_map<std::string, int> m_sections;
52  std::string m_name;
53 
54 };
55 
56 #endif // PixelGeoModel_TextFileDBReader_H
TextFileDBReader::Data::value
std::string value
Definition: TextFileDBReader.h:37
TextFileDBReader::m_name
std::string m_name
Definition: TextFileDBReader.h:52
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TextFileDBReader::TextFileDBReader
TextFileDBReader()
Definition: TextFileDBReader.cxx:12
TextFileDBReader::m_numSections
int m_numSections
Definition: TextFileDBReader.h:50
get_generator_info.result
result
Definition: get_generator_info.py:21
TextFileDBReader::Data::Data
Data(const std::string &v, int s)
Definition: TextFileDBReader.h:33
TextFileDBReader::printNotUsed
void printNotUsed(const std::string &section="") const
Definition: TextFileDBReader.cxx:234
athena.value
value
Definition: athena.py:122
TextFileDBReader::sectionPresent
bool sectionPresent(const std::string &section) const
Definition: TextFileDBReader.cxx:262
TextFileDBReader
Class to read in a text file and allow easy retrieval of parameters.
Definition: TextFileDBReader.h:18
TextFileDBReader::Data::flag
std::atomic_bool flag
Definition: TextFileDBReader.h:40
TextFileDBReader::Data::section
int section
Definition: TextFileDBReader.h:38
TextFileDBReader::m_table
std::unordered_map< std::string, Data > m_table
Definition: TextFileDBReader.h:48
TextFileDBReader::getRowNumber
bool getRowNumber(std::string &key, std::string &rowNumber) const
Definition: TextFileDBReader.cxx:166
TextFileDBReader::find
bool find(const std::string &key, std::string &result) const
Definition: TextFileDBReader.cxx:197
TextFileDBReader::m_currentSection
int m_currentSection
Definition: TextFileDBReader.h:51
python.PyAthena.v
v
Definition: PyAthena.py:157
TextFileDBReader::m_sections
std::unordered_map< std::string, int > m_sections
Definition: TextFileDBReader.h:49
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TextFileDBReader::add
void add(const std::string &key, const std::string &value)
Definition: TextFileDBReader.cxx:188
TextFileDBReader::readFile
bool readFile(const std::string &filename)
Definition: TextFileDBReader.cxx:26
section
void section(const std::string &sec)
Definition: TestTriggerMenuAccess.cxx:22
TextFileDBReader::formatKey
std::string formatKey(const std::string &key) const
Definition: TextFileDBReader.cxx:121
checker_macros.h
Define macros for attributes used to control the static checker.
TextFileDBReader::Data::Data
Data()
Definition: TextFileDBReader.h:32
TextFileDBReader::Data
Definition: TextFileDBReader.h:30
TextFileDBReader::printParameters
void printParameters(const std::string &section="") const
Definition: TextFileDBReader.cxx:211
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37