file /home/anarendran/Documents/temp/rivet/include/Rivet/Projections/SingleValueProjection.hh

/home/anarendran/Documents/temp/rivet/include/Rivet/Projections/SingleValueProjection.hh

Namespaces

Name
Rivet

Classes

Name
classRivet::SingleValueProjection
Base class for projections returning a single floating point value.

Source code

// -*- C++ -*-
#ifndef RIVET_SINGLEVALUEPROJECTION_HH
#define RIVET_SINGLEVALUEPROJECTION_HH

#include "Rivet/Projection.hh"

namespace Rivet {


  class SingleValueProjection: public Projection {
  public:

    SingleValueProjection() : _value(-1.0), _isSet(false) {
      setName("SingleValueProjection");
    }

    bool isValueSet() const {
      return _isSet;
    }
    bool isSet() const { return isValueSet(); }

    double value() const {
      return _value;
    }

    double operator()() const {
      return value();
    }


  protected:

    void setValue(double v) {
      _value = v;
      _isSet = true;
    }
    void set(double v) { setValue(v); }

    void clear() {
      _value = -1.0;
      _isSet = false;
    }


  private:

    double _value;

    bool _isSet;

  };


}

#endif

Updated on 2022-08-07 at 20:17:18 +0100