21 #ifndef LTE_RLC_SEQUENCE_NUMBER_H
22 #define LTE_RLC_SEQUENCE_NUMBER_H
42 : m_value (value % 1024),
47 : m_value (value.m_value),
48 m_modulusBase (value.m_modulusBase)
53 m_value = value % 1024;
69 m_modulusBase = modulusBase.m_value;
72 void SetModulusBase (uint16_t modulusBase)
74 m_modulusBase = modulusBase;
78 SequenceNumber10 operator++ (
int)
80 SequenceNumber10 retval (m_value);
81 m_value = (m_value + 1) % 1024;
85 SequenceNumber10 operator + (uint16_t delta)
const
87 SequenceNumber10 ret ((m_value + delta) % 1024);
88 ret.SetModulusBase (m_modulusBase);
92 SequenceNumber10 operator - (uint16_t delta)
const
94 SequenceNumber10 ret ((m_value - delta) % 1024);
95 ret.SetModulusBase (m_modulusBase);
99 uint16_t operator - (
const SequenceNumber10 &other)
const
101 uint16_t diff = m_value - other.m_value;
105 bool operator > (
const SequenceNumber10 &other)
const
107 SequenceNumber10 v1 ((m_value - m_modulusBase) % 1024);
108 SequenceNumber10 v2 ((other.m_value - other.m_modulusBase) % 1024);
109 return ( v1.GetValue () > v2.GetValue () );
112 bool operator == (
const SequenceNumber10 &other)
const
114 return (m_value == other.m_value);
117 bool operator != (
const SequenceNumber10 &other)
const
119 return (m_value != other.m_value);
122 bool operator <= (
const SequenceNumber10 &other)
const
124 return (!this->
operator> (other));
127 bool operator >= (
const SequenceNumber10 &other)
const
129 return (this->
operator> (other) || this->
operator== (other));
132 bool operator < (
const SequenceNumber10 &other)
const
134 return !this->operator> (other) && m_value != other.m_value;
138 friend std::ostream & operator<< (std::ostream& os,
const SequenceNumber10 &val);
142 uint16_t m_modulusBase;
148 #endif // LTE_RLC_SEQUENCE_NUMBER_H
uint16_t GetValue() const
Extracts the numeric value of the sequence number.