CMS 3D CMS Logo

StorableMultivariateFunctor.h
Go to the documentation of this file.
1 #ifndef NPSTAT_STORABLEMULTIVARIATEFUNCTOR_HH_
2 #define NPSTAT_STORABLEMULTIVARIATEFUNCTOR_HH_
3 
14 #include <string>
15 #include <iostream>
16 #include <typeinfo>
17 
18 #include "Alignment/Geners/interface/ClassId.hh"
20 
21 namespace npstat {
24  public:
26 
28  inline explicit StorableMultivariateFunctor(const std::string& descr)
30 
31  inline ~StorableMultivariateFunctor() override {}
32 
34  inline const std::string& description() const { return description_; }
35 
37  inline void setDescription(const std::string& newDescription) { description_ = newDescription; }
38 
43  void validateDescription(const std::string& description) const;
44 
46 
50  inline bool operator==(const StorableMultivariateFunctor& r) const {
51  return (typeid(*this) == typeid(r)) && this->isEqual(r);
52  }
53  inline bool operator!=(const StorableMultivariateFunctor& r) const { return !(*this == r); }
55 
57 
58  virtual gs::ClassId classId() const = 0;
59  virtual bool write(std::ostream& of) const = 0;
61 
62  // I/O methods needed for reading
63  static inline const char* classname() { return "npstat::StorableMultivariateFunctor"; }
64  static inline unsigned version() { return 1; }
65  static StorableMultivariateFunctor* read(const gs::ClassId& id, std::istream& in);
66 
67  protected:
75  virtual bool isEqual(const StorableMultivariateFunctor&) const = 0;
76 
77  private:
79  };
80 } // namespace npstat
81 
82 #endif // NPSTAT_STORABLEMULTIVARIATEFUNCTOR_HH_
virtual bool isEqual(const StorableMultivariateFunctor &) const =0
virtual gs::ClassId classId() const =0
bool operator==(const StorableMultivariateFunctor &r) const
static StorableMultivariateFunctor * read(const gs::ClassId &id, std::istream &in)
StorableMultivariateFunctor(const std::string &descr)
bool operator!=(const StorableMultivariateFunctor &r) const
void setDescription(const std::string &newDescription)
void validateDescription(const std::string &description) const
virtual bool write(std::ostream &of) const =0
Interface definition for multidimensional functors.