ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigIDR4Monitoring
src
ConfiguredValue.h
Go to the documentation of this file.
1
/* emacs: this is -*- c++ -*- */
12
13
#ifndef TRIGIDR4MONITORING_CONFIGUREDVALUE_H
14
#define TRIGIDR4MONITORING_CONFIGUREDVALUE_H
15
16
17
#include <iostream>
18
19
#define GENERATOR(OP) { if ( !isset() ) return UnsetResult; return m_value OP a; }
20
21
#define OPERATOR_GENERATOR(OP) template<typename U> bool operator OP ( const U& a ) const GENERATOR(OP)
22
#define REV_OPERATOR_GENERATOR(OP, REVOP) template<typename T, typename U> bool operator OP ( const U& a, const ConfiguredValue<T>& p ) { return p REVOP a; }
23
24
template
<
typename
T,
bool
UnsetResult=false>
25
struct
ConfiguredValue
{
26
27
ConfiguredValue
() :
m_set
(false),
m_value
(0) { }
28
ConfiguredValue
(
const
T& v ) :
m_set
(true),
m_value
(v) { }
29
30
ConfiguredValue
(
const
ConfiguredValue
& c ) =
default
;
31
32
ConfiguredValue
&
operator=
(
const
ConfiguredValue
&) =
default
;
33
34
operator
T&() {
return
m_value
; }
35
operator
const
T&()
const
{
return
m_value
; }
36
38
explicit
operator
bool()
const
{
return
isset
(); }
39
40
bool
isset
()
const
{
return
m_set
; }
41
42
template
<
typename
U>
43
ConfiguredValue<T>
&
operator=
(
const
U&
a
) {
44
m_value
=
a
;
45
m_set
=
true
;
46
return
*
this
;
47
}
48
49
OPERATOR_GENERATOR
(==)
50
OPERATOR_GENERATOR
(!=)
51
OPERATOR_GENERATOR
(<=)
52
OPERATOR_GENERATOR
(>=)
53
OPERATOR_GENERATOR
(<)
54
OPERATOR_GENERATOR
(>)
55
56
private
:
57
58
bool
m_set
;
59
60
T
m_value
;
61
62
};
63
64
65
REV_OPERATOR_GENERATOR
(==,==)
66
REV_OPERATOR_GENERATOR
(!=,!=)
67
REV_OPERATOR_GENERATOR
(<=,>=)
68
REV_OPERATOR_GENERATOR
(>=,<=)
69
REV_OPERATOR_GENERATOR
(<,>)
70
REV_OPERATOR_GENERATOR
(>,<)
71
72
73
template<typename T,
bool
UnsetResult=false>
74
std
::
ostream
& operator<<(
std
::
ostream
& s,
const
ConfiguredValue
<T>& p ) {
75
if
(p.isset())
return
s << (T)p;
76
return
s <<
"not set"
;
77
}
78
79
#endif
// TRIGIDR4MONITORING_CONFIGUREDVALUE_H
80
81
OPERATOR_GENERATOR
#define OPERATOR_GENERATOR(OP)
Definition
ConfiguredValue.h:21
REV_OPERATOR_GENERATOR
#define REV_OPERATOR_GENERATOR(OP, REVOP)
Definition
ConfiguredValue.h:22
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
ostream
STL class.
const
std
STL namespace.
ConfiguredValue
Definition
ConfiguredValue.h:25
ConfiguredValue::m_set
bool m_set
Definition
ConfiguredValue.h:58
ConfiguredValue::isset
bool isset() const
Definition
ConfiguredValue.h:40
ConfiguredValue::operator=
ConfiguredValue & operator=(const ConfiguredValue &)=default
ConfiguredValue::ConfiguredValue
ConfiguredValue(const T &v)
Definition
ConfiguredValue.h:28
ConfiguredValue::operator=
ConfiguredValue< T > & operator=(const U &a)
Definition
ConfiguredValue.h:43
ConfiguredValue::m_value
T m_value
Definition
ConfiguredValue.h:60
ConfiguredValue::ConfiguredValue
ConfiguredValue(const ConfiguredValue &c)=default
ConfiguredValue::ConfiguredValue
ConfiguredValue()
Definition
ConfiguredValue.h:27
private
#define private
Definition
testRead.cxx:27
Generated on
for ATLAS Offline Software by
1.17.0