
#ifndef PLS_STAMPED_INTEGER_H_
#define PLS_STAMPED_INTEGER_H_

#include "pls/internal/base/system_details.h"

namespace pls::internal::data_structures {

struct stamped_integer {
  using member_t = base::system_details::cas_integer;

  member_t stamp_: base::system_details::CAS_SIZE / 2;
  member_t value_: base::system_details::CAS_SIZE / 2;

  stamped_integer() : stamp_{0}, value_{0} {};
  stamped_integer(member_t new_value) : stamp_{0}, value_{new_value} {};
  stamped_integer(member_t new_stamp, member_t new_value) : stamp_{new_stamp}, value_{new_value} {};

  bool operator==(const stamped_integer &other) const noexcept {
    return stamp_ == other.stamp_ && value_ == other.value_;
  }

  bool operator!=(const stamped_integer &other) const noexcept {
    return !(*this == other);
  }
};

}

#endif //PLS_STAMPED_INTEGER_H_
