File indexing completed on 2024-04-06 11:56:20
0001 #ifndef GENERS_WRITEONLYCATALOG_HH_
0002 #define GENERS_WRITEONLYCATALOG_HH_
0003
0004 #include <iostream>
0005
0006 #include "Alignment/Geners/interface/AbsCatalog.hh"
0007 #include <memory>
0008
0009 namespace gs {
0010 class WriteOnlyCatalog : public AbsCatalog {
0011 public:
0012
0013 WriteOnlyCatalog(std::ostream &os, unsigned long long firstId = 1);
0014 WriteOnlyCatalog(const WriteOnlyCatalog &) = delete;
0015 WriteOnlyCatalog &operator=(const WriteOnlyCatalog &) = delete;
0016
0017 inline ~WriteOnlyCatalog() override {}
0018
0019 inline unsigned long long size() const override { return count_; }
0020 inline unsigned long long smallestId() const override { return smallestId_; }
0021 inline unsigned long long largestId() const override { return largestId_; }
0022 inline bool isContiguous() const override { return true; }
0023
0024
0025
0026 std::shared_ptr<const CatalogEntry> retrieveEntry(unsigned long long) const override;
0027
0028 bool retrieveStreampos(unsigned long long id,
0029 unsigned *compressionCode,
0030 unsigned long long *length,
0031 std::streampos *pos) const override;
0032
0033 void search(const SearchSpecifier &namePattern,
0034 const SearchSpecifier &categoryPattern,
0035 std::vector<unsigned long long> *idsFound) const override;
0036
0037
0038 unsigned long long makeEntry(const ItemDescriptor &descriptor,
0039 unsigned compressionCode,
0040 unsigned long long itemLength,
0041 const ItemLocation &loc,
0042 unsigned long long offset = 0ULL) override;
0043
0044 inline const CatalogEntry *lastEntryMade() const override { return lastEntry_.get(); }
0045
0046
0047
0048 ClassId classId() const override { return ClassId(*this); }
0049 bool write(std::ostream &) const override;
0050
0051 static inline const char *classname() { return "gs::WriteOnlyCatalog"; }
0052 static inline unsigned version() { return 2; }
0053
0054
0055
0056 static WriteOnlyCatalog *read(const ClassId &id, std::istream &in);
0057
0058 protected:
0059 inline bool isEqual(const AbsCatalog &) const override { return false; }
0060
0061 private:
0062 std::ostream &os_;
0063 unsigned long long count_;
0064 unsigned long long smallestId_;
0065 unsigned long long largestId_;
0066 std::unique_ptr<const CatalogEntry> lastEntry_;
0067 };
0068 }
0069
0070 #endif