File indexing completed on 2024-04-06 11:56:18
0001 #ifndef GENERS_CATALOGENTRY_HH_
0002 #define GENERS_CATALOGENTRY_HH_
0003
0004 #include "Alignment/Geners/interface/ItemDescriptor.hh"
0005 #include "Alignment/Geners/interface/ItemLocation.hh"
0006
0007 namespace gs {
0008 class CatalogEntry : public ItemDescriptor {
0009 public:
0010
0011 CatalogEntry();
0012
0013
0014 CatalogEntry(const ItemDescriptor &descr,
0015 unsigned long long id,
0016 unsigned compressionCode,
0017 unsigned long long itemLength,
0018 const ItemLocation &location,
0019 unsigned long long offset = 0ULL);
0020
0021 inline ~CatalogEntry() override {}
0022
0023 inline unsigned long long id() const { return id_; }
0024 inline unsigned long long offset() const { return offset_; }
0025 inline const ItemLocation &location() const { return location_; }
0026 inline unsigned long long itemLength() const { return len_; }
0027 inline unsigned compressionCode() const { return compressionCode_; }
0028
0029 inline CatalogEntry &setStreamPosition(std::streampos pos) {
0030 location_.setStreamPosition(pos);
0031 return *this;
0032 }
0033 inline CatalogEntry &setURI(const char *newURI) {
0034 location_.setURI(newURI);
0035 return *this;
0036 }
0037 inline CatalogEntry &setCachedItemURI(const char *newURI) {
0038 location_.setCachedItemURI(newURI);
0039 return *this;
0040 }
0041 inline CatalogEntry &setOffset(const unsigned long long off) {
0042 offset_ = off;
0043 return *this;
0044 }
0045
0046
0047 bool humanReadable(std::ostream &os) const;
0048
0049
0050 inline virtual ClassId classId() const { return ClassId(*this); }
0051 virtual bool write(std::ostream &of) const;
0052
0053 static inline const char *classname() { return "gs::CatalogEntry"; }
0054 static inline unsigned version() { return 1; }
0055
0056
0057
0058 static CatalogEntry *read(const ClassId &id, const ClassId &locId, std::istream &in);
0059
0060 protected:
0061 bool isEqual(const ItemDescriptor &) const override;
0062
0063 private:
0064 unsigned long long id_;
0065 unsigned long long len_;
0066 unsigned long long offset_;
0067 unsigned compressionCode_;
0068 ItemLocation location_;
0069 };
0070 }
0071
0072 #endif