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