ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConfVar.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCONF_VAR_H
6#define TRIGCONF_VAR_H
7
8/*
9 @author Rustem Ospanov
10 @date July 2009
11
12 @brief This class provides map between id of TrigMonVar
13 and string. It stores list of id, string pairs which
14 can be saved in TrigMonConfig at end of a job.
15*/
16
17// Framework
20
21// C/C++
22#include <iostream>
23#include <string>
24#include <vector>
25
26// Local
28
30 public:
31
33 TrigConfVar(const std::string &name, uint32_t id);
35
36 const std::string& name() const { return m_name; }
37 const std::string& getName() const { return m_name; }
38
39 uint32_t id() const { return m_id; }
40 uint32_t getId() const { return m_id; }
41
42 void print(std::ostream &os) const;
43
44 private:
45
46 uint32_t m_id; // Variable id
47 std::string m_name; // Variable name
48};
49
50std::string str(const TrigConfVar &);
51
52//
53// Helper functions: these use static TrigConfVar vector
54//
55namespace Trig
56{
57 uint16_t ReserveVarId ATLAS_NOT_THREAD_SAFE (const std::string &name);
58 uint16_t ReserveVarId ATLAS_NOT_THREAD_SAFE (const std::string &name, uint16_t id);
59
60 bool FindVarId ATLAS_NOT_THREAD_SAFE (const std::string &name, uint16_t &id);
61 bool FindVarName ATLAS_NOT_THREAD_SAFE (const uint16_t id, std::string &name);
62
63 std::vector<TrigConfVar> GetCurrentTrigConfVarVector ATLAS_NOT_THREAD_SAFE ();
64}
65
66//
67// Inlined comparison operators
68//
69inline bool operator==(const TrigConfVar &lhs, const TrigConfVar &rhs) {
70 return lhs.getId() == rhs.getId() || lhs.getName() == rhs.getName();
71}
72inline bool operator==(const TrigConfVar &key, const std::string &str) {
73 return key.getName() == str;
74}
75inline bool operator==(const std::string &str, const TrigConfVar &key) {
76 return str == key.getName();
77}
78inline bool operator==(const TrigConfVar &key, const unsigned int id) {
79 return key.getId() == id;
80}
81inline bool operator==(const unsigned int id, const TrigConfVar &key) {
82 return id == key.getId();
83}
84
85inline bool operator==(const TrigConfVar &key, const TrigMonVar &var) {
86 return key.getId() == var.getId();
87}
88inline bool operator==(const TrigMonVar &var, const TrigConfVar &key) {
89 return key.getId() == var.getId();
90}
91
92CLASS_DEF( TrigConfVar , 168672416 , 1 )
93
94#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
bool operator==(const TrigConfVar &lhs, const TrigConfVar &rhs)
Definition TrigConfVar.h:69
Define macros for attributes used to control the static checker.
uint32_t getId() const
Definition TrigConfVar.h:40
const std::string & getName() const
Definition TrigConfVar.h:37
uint32_t m_id
Definition TrigConfVar.h:46
void print(std::ostream &os) const
uint32_t id() const
Definition TrigConfVar.h:39
std::string m_name
Definition TrigConfVar.h:47
const std::string & name() const
Definition TrigConfVar.h:36
The common trigger namespace for trigger analysis tools.
std::vector< TrigConfVar > GetCurrentTrigConfVarVector ATLAS_NOT_THREAD_SAFE()