File indexing completed on 2024-04-06 11:56:17
0001 #ifndef GENERS_ABSREFERENCE_HH_
0002 #define GENERS_ABSREFERENCE_HH_
0003
0004 #include "Alignment/Geners/interface/ClassId.hh"
0005 #include "Alignment/Geners/interface/SearchSpecifier.hh"
0006
0007 #include <iostream>
0008 #include <memory>
0009 #include <vector>
0010
0011 namespace gs {
0012 class AbsArchive;
0013 class CatalogEntry;
0014
0015 class AbsReference {
0016 public:
0017 AbsReference() = delete;
0018 inline virtual ~AbsReference() {}
0019
0020 inline AbsArchive &archive() const { return archive_; }
0021 inline const ClassId &type() const { return classId_; }
0022 inline const std::string &ioPrototype() const { return ioProto_; }
0023 inline const SearchSpecifier &namePattern() const { return namePattern_; }
0024 inline const SearchSpecifier &categoryPattern() const { return categoryPattern_; }
0025
0026
0027
0028 virtual bool isIOCompatible(const CatalogEntry &r) const;
0029
0030
0031 bool isSameIOPrototype(const CatalogEntry &r) const;
0032
0033
0034 bool empty() const;
0035
0036
0037 bool unique() const;
0038
0039
0040 unsigned long size() const;
0041
0042
0043
0044 unsigned long long id(unsigned long index) const;
0045
0046
0047
0048 std::shared_ptr<const CatalogEntry> indexedCatalogEntry(unsigned long index) const;
0049
0050 protected:
0051
0052
0053 AbsReference(AbsArchive &ar, const ClassId &classId, const char *ioProto, unsigned long long itemId);
0054
0055
0056
0057 AbsReference(AbsArchive &ar,
0058 const ClassId &classId,
0059 const char *ioProto,
0060 const SearchSpecifier &namePattern,
0061 const SearchSpecifier &categoryPattern);
0062
0063 std::istream &positionInputStream(unsigned long long id) const;
0064
0065 private:
0066 friend class AbsArchive;
0067
0068 void initialize() const;
0069 void addItemId(unsigned long long id);
0070
0071 AbsArchive &archive_;
0072 ClassId classId_;
0073 std::string ioProto_;
0074
0075
0076
0077 unsigned long long searchId_;
0078 SearchSpecifier namePattern_;
0079 SearchSpecifier categoryPattern_;
0080
0081
0082 unsigned long long itemId_;
0083
0084
0085 std::vector<unsigned long long> idList_;
0086
0087
0088
0089
0090
0091
0092 bool initialized_;
0093 };
0094 }
0095
0096 #endif