ATLAS Offline Software
Loading...
Searching...
No Matches
TrigDBConnectionConfig.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * @file TrigDBConnectionConfig.h
7 * @brief Configuration for a Trigger DB connection, with string serialization
8 * @author Ricardo Abreu
9 * $Id: TrigDBConnectionConfig.h 569440 2013-11-08 17:32:05Z ricab $
10 */
11
12#ifndef TRIGDBCONNECTIONCONFIG_H_
13#define TRIGDBCONNECTIONCONFIG_H_
14
15#include <string>
16#include <vector>
17#include <utility>
18
19namespace TrigConf {
20
22{
23public:
25 typedef std::pair<unsigned int, unsigned int> LumiPSPair;
26 typedef std::vector<LumiPSPair> PSKeys;
27
29 // If some parameter is repeated in the string, the last occurrence is the
30 // one taken into account
31 TrigDBConnectionConfig(const std::string& connectionStr);
33 const std::string& server,
34 unsigned int smKey,
35 unsigned int hltPsKey);
37 const std::string& server,
38 unsigned int smKey,
39 const PSKeys& hltPsKeyStr);
41 const std::string& server,
42 unsigned int smKey,
43 const std::string& hltPsKeyStr);
44
45 void diggestStr(const std::string& str);
46
47 // setters from strings for non string attributes
48 void setTypeFromStr(const std::string& typeStr);
49 void setSmKeyFromStr(const std::string& smKeyStr);
50 // accepts single or multiple keys
51 void setHltKeysFromStr(const std::string& hltKeyStr);
52 void setLvl1KeyFromStr(const std::string& lvl1KeyStr);
53 void setRetrialPeriodFromStr(const std::string& retrialPeriodStr);
54 void setMaxRetrialsFromStr(const std::string& maxRetrialsStr);
55 void setUseFrontierFromStr(const std::string& useFrontier);
56
57 std::string toString() const;
58 std::string typeToString() const;
59 std::string hltKeysToString() const;
60
61 // Attributes
63 std::string m_server;
64 unsigned int m_smkey{0};
65 unsigned int m_hltkey{0};
67 unsigned int m_lvl1key{0};
68 std::string m_schema;
69 std::string m_user;
70 std::string m_password;
71 unsigned int m_retrialPeriod{0};
72 unsigned int m_maxRetrials{1};
73 bool m_useFrontier{false};
74
75private:
77 const std::string& server,
78 unsigned int smKey);
79
80};
81
82}
83
87 const std::string& server,
88 unsigned int smKey)
89 : m_type(type)
90 , m_server(server)
91 , m_smkey(smKey)
92{
93}
94
98 const std::string& server,
99 unsigned int smKey,
100 unsigned int hltPsKey)
101 : TrigDBConnectionConfig(type, server, smKey)
102{
103 m_hltkey = hltPsKey;
104}
105
109 const std::string& server,
110 unsigned int smKey,
111 const PSKeys& hltPsKeys)
112 : TrigDBConnectionConfig(type, server, smKey)
113{
114 m_hltkeys = hltPsKeys;
115}
116
119{
120 switch(m_type)
121 {
122 case Oracle: return "oracle";
123 case MySQL: return "mysql";
124 case SQLite: return "sqlite";
125 case DBLookup: return "dblookup";
126 }
127
128 return "UnknownType!";
129}
130
131#endif /* TRIGDBCONNECTIONCONFIG_H_ */
void setMaxRetrialsFromStr(const std::string &maxRetrialsStr)
std::pair< unsigned int, unsigned int > LumiPSPair
void setHltKeysFromStr(const std::string &hltKeyStr)
void setRetrialPeriodFromStr(const std::string &retrialPeriodStr)
void setTypeFromStr(const std::string &typeStr)
void setSmKeyFromStr(const std::string &smKeyStr)
void setLvl1KeyFromStr(const std::string &lvl1KeyStr)
void setUseFrontierFromStr(const std::string &useFrontier)
void diggestStr(const std::string &str)
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22