1#ifndef BIT_NUMBER_HPP_H3ODBQR7
2#define BIT_NUMBER_HPP_H3ODBQR7
4#include <boost/operators.hpp>
11
12
13
14
15
16template<
typename T, std::size_t WIDTH>
19 static_assert(std::is_integral<T>::value ==
true,
20 "only integral types are supported");
21 static_assert(
sizeof(T) * 8 > WIDTH,
22 "width has to be less than size of underlying type");
25 static constexpr T
mask = (1 << WIDTH) - 1;
26 static constexpr std::size_t
bits = WIDTH;
29 BitNumber() : mValue(0) {}
30 BitNumber(T value) : mValue(value &
mask) {}
31 BitNumber& operator=(T value) { mValue = value &
mask;
return *
this; }
32 T raw()
const {
return mValue; }
34 bool operator<(
BitNumber other)
const {
return mValue < other.mValue; }
35 bool operator==(
BitNumber other)
const {
return mValue == other.mValue; }
static constexpr std::size_t bits
Link layer header used by ITS-G5 stations.
Frame Control field in IEEE 802.11 MAC header.
BitNumber< std::uint16_t, 2 > Protocol
static FrameControl qos_data_frame()
QoS Control field in IEEE 802.11 MAC header.
void user_priority(AccessCategory ac)
Sequence Control field in IEEE 802.11 MAC header.