Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:53

0001 // Minimal item descriptor for archive I/O
0002 
0003 #ifndef GENERS_ITEMDESCRIPTOR_HH_
0004 #define GENERS_ITEMDESCRIPTOR_HH_
0005 
0006 #include <string>
0007 #include <typeinfo>
0008 #include <utility>
0009 
0010 #include "Alignment/Geners/interface/ClassId.hh"
0011 
0012 namespace gs {
0013   class ItemDescriptor {
0014   public:
0015     ItemDescriptor();
0016     ItemDescriptor(const ClassId &classId, const char *ioPrototype, const char *name, const char *category);
0017     inline virtual ~ItemDescriptor() {}
0018 
0019     inline const ClassId &type() const { return classId_; }
0020     inline const std::string &ioPrototype() const { return ioProto_; }
0021     inline const std::string &name() const { return nameCat_.first; }
0022     inline const std::string &category() const { return nameCat_.second; }
0023     inline const std::pair<std::string, std::string> &nameAndCategory() const { return nameCat_; }
0024 
0025     inline bool operator==(const ItemDescriptor &r) const { return (typeid(*this) == typeid(r)) && this->isEqual(r); }
0026     inline bool operator!=(const ItemDescriptor &r) const { return !(*this == r); }
0027 
0028     // The following returns "true" if the class id and
0029     // I/O prototype of this item coincide with those of
0030     // the argument
0031     bool isSameClassIdandIO(const ItemDescriptor &r) const;
0032 
0033     // The following method checks I/O prototype only
0034     // allowing for class id mismatch
0035     inline bool isSameIOPrototype(const ItemDescriptor &r) const { return ioProto_ == r.ioProto_; }
0036 
0037   protected:
0038     virtual bool isEqual(const ItemDescriptor &) const;
0039 
0040   private:
0041     ClassId classId_;
0042     std::string ioProto_;
0043     std::pair<std::string, std::string> nameCat_;
0044   };
0045 }  // namespace gs
0046 
0047 #endif  // GENERS_ITEMDESCRIPTOR_HH_