8 #include "gcomm/types.hpp"
10 #include "gu_serialize.hpp"
20 typedef int64_t seqno_t;
23 std::ostream& operator<<(std::ostream&,
const Range&);
34 Range(
const seqno_t lu = -1,
const seqno_t hs = -1) :
38 seqno_t lu()
const {
return lu_; }
39 seqno_t hs()
const {
return hs_; }
41 void set_lu(
const seqno_t s) { lu_ = s; }
42 void set_hs(
const seqno_t s) { hs_ = s; }
44 size_t serialize(gu::byte_t* buf,
size_t buflen,
size_t offset)
const
46 gu_trace(offset = gu::serialize8(lu_, buf, buflen, offset));
47 gu_trace(offset = gu::serialize8(hs_, buf, buflen, offset));
51 size_t unserialize(
const gu::byte_t* buf,
size_t buflen,
size_t offset)
53 gu_trace(offset = gu::unserialize8(buf, buflen, offset, lu_));
54 gu_trace(offset = gu::unserialize8(buf, buflen, offset, hs_));
58 static size_t serial_size()
60 return 2 *
sizeof(seqno_t);
63 bool operator==(
const Range& cmp)
const
65 return (lu_ == cmp.lu_ && hs_ == cmp.hs_);
73 inline std::ostream& gcomm::evs::operator<<(std::ostream& os,
const gcomm::evs::Range& r)
75 return (os <<
"[" << r.lu() <<
"," << r.hs() <<
"]");
78 #endif // EVS_SEQNO_HPP
Definition: evs_seqno.hpp:31