CircularIndex
CircularIndex is a final class defined in
Fw/DataStructures.
It represents an index value that
wraps around modulo an integer.
1. Private Member Variables
CircularIndex has the following private member variables.
| Name | Type | Purpose | Default Value |
|---|---|---|---|
m_value |
FwSizeType |
The index value | 0 |
m_modulus |
FwSizeType |
The modulus | 1 |
2. Public Constructors and Destructors
2.1. Zero-Argument Constructor
Use default initialization of members.
2.2. Constructor with Specified Members
-
Assert
modulus > 0. -
Set
m_modulus = modulus. -
Call
setValue(value).
2.3. Copy Constructor
Set *this = ci.
2.4. Destructor
Defined as = default.
3. Public Member Functions
3.1. operator=
-
If
this != &ci-
Set
m_value = ci.m_value. -
Set
m_modulus = ci.m_modulus.
-
-
Return
*this.
3.2. getValue
-
Assert
m_value < m_modulus. -
Return
m_value.
3.3. setValue
-
Assert
m_modulus > 0. -
Set
m_value = m_value % m_modulus.
3.4. getModulus
-
Assert
m_value < m_modulus. -
Return
m_modulus.
3.5. setModulus
-
Set
m_modulus = modulus. -
Call
setValue(m_value).
3.6. increment
-
Assert
m_modulus > 0. -
Set
offset = amount % m_modulus. -
Call
setValue(m_value + offset). -
Return
m_value.
3.7. decrement
-
Assert
m_modulus > 0. -
Set
offset = amount % m_modulus. -
Call
setValue(m_value + m_modulus - offset). -
Return
m_value.