File indexing completed on 2024-04-06 11:56:19
0001 #ifndef GENERS_ITEMLOCATION_HH_
0002 #define GENERS_ITEMLOCATION_HH_
0003
0004 #include <iostream>
0005 #include <string>
0006
0007 #include "Alignment/Geners/interface/ClassId.hh"
0008
0009 namespace gs {
0010 class ItemLocation {
0011 public:
0012 inline ItemLocation(std::streampos pos, const char *URI, const char *cachedItemURI = nullptr)
0013 : pos_(pos), URI_(URI ? URI : ""), cachedItemURI_(cachedItemURI ? cachedItemURI : "") {}
0014
0015 inline std::streampos streamPosition() const { return pos_; }
0016 inline const std::string &URI() const { return URI_; }
0017 inline const std::string &cachedItemURI() const { return cachedItemURI_; }
0018
0019 inline void setStreamPosition(std::streampos pos) { pos_ = pos; }
0020 inline void setURI(const char *newURI) { URI_ = newURI ? newURI : ""; }
0021 inline void setCachedItemURI(const char *newURI) { cachedItemURI_ = newURI ? newURI : ""; }
0022
0023 bool operator==(const ItemLocation &r) const;
0024 inline bool operator!=(const ItemLocation &r) const { return !(*this == r); }
0025
0026
0027 inline ClassId classId() const { return ClassId(*this); }
0028 bool write(std::ostream &of) const;
0029
0030 static inline const char *classname() { return "gs::ItemLocation"; }
0031 static inline unsigned version() { return 1; }
0032 static ItemLocation *read(const ClassId &id, std::istream &in);
0033
0034 ItemLocation() = delete;
0035
0036 private:
0037 std::streampos pos_;
0038 std::string URI_;
0039 std::string cachedItemURI_;
0040 };
0041 }
0042
0043 #endif