1#include "traffic_class.hpp"
2#include "serialization.hpp"
9TrafficClass::TrafficClass() : m_tc(0)
13TrafficClass::TrafficClass(
bool scf,
bool ch_offload, BitNumber<unsigned, 6> tc) : m_tc(0)
15 store_carry_forward(scf);
16 channel_offload(ch_offload);
20TrafficClass::TrafficClass(uint8_t raw) : m_tc(raw)
24bool TrafficClass::store_carry_forward()
const
26 return (m_tc & scf_mask);
29void TrafficClass::store_carry_forward(
bool flag)
38bool TrafficClass::channel_offload()
const
40 return (m_tc & channel_offload_mask);
43void TrafficClass::channel_offload(
bool flag)
46 m_tc |= channel_offload_mask;
48 m_tc &= ~channel_offload_mask;
52BitNumber<unsigned, 6> TrafficClass::tc_id()
const
54 return (m_tc & tc_id_mask);
57void TrafficClass::tc_id(BitNumber<unsigned, 6>
id)
60 m_tc |=
id.raw() & tc_id_mask;
63dcc::Profile map_tc_onto_profile(
const TrafficClass& tc)
65 dcc::Profile profile = dcc::Profile::DP3;
67 switch (tc.tc_id().raw()) {
69 profile = dcc::Profile::DP0;
72 profile = dcc::Profile::DP1;
75 profile = dcc::Profile::DP2;
78 profile = dcc::Profile::DP3;
85void serialize(
const TrafficClass& tc, OutputArchive& ar)
87 serialize(host_cast(tc.raw()), ar);
90void deserialize(TrafficClass& tc, InputArchive& ar)
92 decltype(tc.raw()) tmp;
94 tc = TrafficClass(tmp);