ATLAS Offline Software
Loading...
Searching...
No Matches
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
24template<typename T, bool UnsetResult=false>
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
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>
44 m_value = a;
45 m_set = true;
46 return *this;
47 }
48
55
57
58 bool m_set;
59
61
62};
63
64
71
72
73template<typename T, bool UnsetResult=false>
74std::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
#define OPERATOR_GENERATOR(OP)
#define REV_OPERATOR_GENERATOR(OP, REVOP)
static Double_t a
STL class.
STL namespace.
bool isset() const
ConfiguredValue & operator=(const ConfiguredValue &)=default
ConfiguredValue(const T &v)
ConfiguredValue< T > & operator=(const U &a)
ConfiguredValue(const ConfiguredValue &c)=default
#define private
Definition testRead.cxx:27