Rivet: /Users/chrisg/software/rivet/include/Rivet/Projections/SingleValueProjection.hh Source File

| 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
17 class SingleValueProjection: public Projection {
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
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:142
Rivet::SingleValueProjection
Base class for projections returning a single floating point value.
Definition SingleValueProjection.hh:17
Rivet::SingleValueProjection::operator()
double operator()() const
Return the single value.
Definition SingleValueProjection.hh:42
Rivet::SingleValueProjection::isValueSet
bool isValueSet() const
Returns true if the value has been set.
Definition SingleValueProjection.hh:30
Rivet::SingleValueProjection::setValue
void setValue(double v)
Set the value.
Definition SingleValueProjection.hh:50
Rivet::SingleValueProjection::set
void set(double v)
Definition SingleValueProjection.hh:55
Rivet::SingleValueProjection::value
double value() const
Return the single value.
Definition SingleValueProjection.hh:37
Rivet::SingleValueProjection::isSet
bool isSet() const
Definition SingleValueProjection.hh:34
Rivet::SingleValueProjection::SingleValueProjection
SingleValueProjection()
The default constructor.
Definition SingleValueProjection.hh:21
Rivet::SingleValueProjection::clear
void clear()
Unset the value.
Definition SingleValueProjection.hh:58
Rivet
Definition MC_Cent_pPb.hh:10