Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:38

0001 #ifndef CondFormats_HcalObjects_HcalConstFunctor_h
0002 #define CondFormats_HcalObjects_HcalConstFunctor_h
0003 
0004 #include "CondFormats/HcalObjects/interface/AbsHcalFunctor.h"
0005 
0006 #include "boost/serialization/access.hpp"
0007 #include "boost/serialization/version.hpp"
0008 
0009 //
0010 // A functor returning a constant value
0011 //
0012 class HcalConstFunctor : public AbsHcalFunctor {
0013 public:
0014   // Dummy constructor, to be used for deserialization only
0015   HcalConstFunctor();
0016 
0017   // Normal constructor
0018   explicit HcalConstFunctor(const double value);
0019 
0020   inline ~HcalConstFunctor() override {}
0021 
0022   double operator()(double x) const override;
0023 
0024 protected:
0025   inline bool isEqual(const AbsHcalFunctor& other) const override {
0026     const HcalConstFunctor& r = static_cast<const HcalConstFunctor&>(other);
0027     return value_ == r.value_;
0028   }
0029 
0030 private:
0031   double value_;
0032 
0033   friend class boost::serialization::access;
0034 
0035   template <class Archive>
0036   inline void serialize(Archive& ar, unsigned /* version */) {
0037     boost::serialization::base_object<AbsHcalFunctor>(*this);
0038     ar & value_;
0039   }
0040 };
0041 
0042 BOOST_CLASS_VERSION(HcalConstFunctor, 1)
0043 BOOST_CLASS_EXPORT_KEY(HcalConstFunctor)
0044 
0045 #endif  // CondFormats_HcalObjects_HcalConstFunctor_h