3#include "libmicroemu/register_id.h"
4#include "libmicroemu/types.h"
12template <libmicroemu::RegisterId R
id>
class RArgConst {
14 static constexpr auto kRegId = Rid;
52 template <
typename R>
bool operator==(
const R &other)
const {
return Get() == other.Get(); }
55 template <
typename R>
bool operator!=(
const R &other)
const {
return !(Get() == other.Get()); }
75template <
typename T>
class RArg {
80 RArg(T reg_id) : val_(reg_id) {
81 static_assert(std::is_integral<T>::value,
"T must be an integral type");
82 static_assert(std::is_unsigned<T>::value,
"T must be an unsigned type");
83 static_assert(std::is_same_v<T, std::underlying_type_t<libmicroemu::RegisterId>>,
84 "RArg only allows underlying type of RegisterId");
119 template <
typename R>
bool operator==(
const R &other)
const {
return Get() == other.Get(); }
122 template <
typename R>
bool operator!=(
const R &other)
const {
return !(Get() == other.Get()); }
128 RArg operator+(
const RArg &) =
delete;
131 RArg operator-(
const RArg &) =
delete;
134 RArg operator*(
const RArg &) =
delete;
137 RArg operator/(
const RArg &) =
delete;
constexpr RArgConst & operator=(const RArgConst &r_src)=default
Copy assignment operator for ArgConst.
constexpr RArgConst(RArgConst &&r_src)=default
Move constructor for ArgConst.
~RArgConst()=default
Destructor.
constexpr RArgConst & operator=(RArgConst &&r_src)=default
Move assignment operator for ArgConst.
constexpr RArgConst()=default
Constructor.
constexpr RArgConst(const RArgConst &r_src)=default
Copy constructor for ArgConst.
~RArg()=default
Destructor.
RArg(RArg &&r_src)=default
Move constructor for Arg.
RArg(T reg_id)
Constructor.
Definition rarg.h:80
RArg & operator=(const RArg &r_src)=default
Copy assignment operator for Arg.
RArg(const RArg &r_src)=default
Copy constructor for Arg.
RArg & operator=(RArg &&r_src)=default
Move assignment operator for Arg.
RegisterId
Enumeration of register IDs.
Definition register_id.h:13