CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/JetMETCorrections/InterpolationTables/interface/StorableMultivariateFunctor.h

Go to the documentation of this file.
00001 #ifndef NPSTAT_STORABLEMULTIVARIATEFUNCTOR_HH_
00002 #define NPSTAT_STORABLEMULTIVARIATEFUNCTOR_HH_
00003 
00014 #include <string>
00015 #include <iostream>
00016 #include <typeinfo>
00017 
00018 #include "Alignment/Geners/interface/ClassId.hh"
00019 #include "JetMETCorrections/InterpolationTables/interface/AbsMultivariateFunctor.h"
00020 
00021 namespace npstat {
00023     class StorableMultivariateFunctor : public AbsMultivariateFunctor
00024     {
00025     public:
00026         inline StorableMultivariateFunctor() {}
00027 
00029         inline StorableMultivariateFunctor(const std::string& descr)
00030             : AbsMultivariateFunctor(), description_(descr) {}
00031 
00032         inline virtual ~StorableMultivariateFunctor() {}
00033 
00035         inline const std::string& description() const {return description_;}
00036 
00038         inline void setDescription(const std::string& newDescription)
00039             {description_ = newDescription;}
00040 
00045         void validateDescription(const std::string& description) const;
00046 
00048 
00052         inline bool operator==(const StorableMultivariateFunctor& r) const
00053             {return (typeid(*this) == typeid(r)) && this->isEqual(r);}
00054         inline bool operator!=(const StorableMultivariateFunctor& r) const
00055             {return !(*this == r);}
00057 
00059 
00060         virtual gs::ClassId classId() const = 0;
00061         virtual bool write(std::ostream& of) const = 0;
00063 
00064         // I/O methods needed for reading
00065         static inline const char* classname()
00066             {return "npstat::StorableMultivariateFunctor";}
00067         static inline unsigned version() {return 1;}
00068         static StorableMultivariateFunctor* read(
00069             const gs::ClassId& id, std::istream& in);
00070 
00071     protected:
00079         virtual bool isEqual(const StorableMultivariateFunctor&) const = 0;
00080 
00081     private:
00082         std::string description_;
00083     };
00084 }
00085 
00086 #endif // NPSTAT_STORABLEMULTIVARIATEFUNCTOR_HH_
00087