ATLAS Offline Software
Loading...
Searching...
No Matches
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{
19public:
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
28private:
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;
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
void section(const std::string &sec)
Define macros for attributes used to control the static checker.
Data(const std::string &v, int s)
void printNotUsed(const std::string &section="") const
void add(const std::string &key, const std::string &value)
TextFileDBReader(const std::string &filename)
std::string formatKey(const std::string &key) const
bool getRowNumber(std::string &key, std::string &rowNumber) const
void printParameters(const std::string &section="") const
bool find(const std::string &key, std::string &result) const
std::unordered_map< std::string, int > m_sections
bool readFile(const std::string &filename)
bool sectionPresent(const std::string &section) const
std::unordered_map< std::string, Data > m_table