Rivet 3.1.9
SingleValueProjection.hh
1// -*- C++ -*-
2#ifndef RIVET_SINGLEVALUEPROJECTION_HH
3#define RIVET_SINGLEVALUEPROJECTION_HH
4
5#include "Rivet/Projection.hh"
6
7namespace Rivet {
8
9
18 public:
19
21 SingleValueProjection() : _value(-1.0), _isSet(false) {
22 setName("SingleValueProjection");
23 }
24
26 using Projection::operator =;
27
28
30 bool isValueSet() const {
31 return _isSet;
32 }
34 bool isSet() const { return isValueSet(); }
35
37 double value() const {
38 return _value;
39 }
40
42 double operator()() const {
43 return value();
44 }
45
46
47 protected:
48
50 void setValue(double v) {
51 _value = v;
52 _isSet = true;
53 }
55 void set(double v) { setValue(v); }
56
58 void clear() {
59 _value = -1.0;
60 _isSet = false;
61 }
62
63
64 protected:
65
66 double _value;
67
69 bool _isSet;
70
71 };
72
73
74}
75
76#endif
Base class for all Rivet projections.
Definition Projection.hh:29
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:142
Base class for projections returning a single floating point value.
Definition SingleValueProjection.hh:17
double operator()() const
Return the single value.
Definition SingleValueProjection.hh:42
bool isValueSet() const
Returns true if the value has been set.
Definition SingleValueProjection.hh:30
void setValue(double v)
Set the value.
Definition SingleValueProjection.hh:50
void set(double v)
Definition SingleValueProjection.hh:55
double value() const
Return the single value.
Definition SingleValueProjection.hh:37
bool isSet() const
Definition SingleValueProjection.hh:34
SingleValueProjection()
The default constructor.
Definition SingleValueProjection.hh:21
void clear()
Unset the value.
Definition SingleValueProjection.hh:58
Definition MC_Cent_pPb.hh:10