The ModuleID_t class is a intermediate object generated to contain configurations in a sorted fashion.
More...
#include <ARICHDatabaseTools.h>
|
| ModuleID_t (const int8_t sector='0', const int channel=0) noexcept |
| ModuleID_t is the default ctor that construct an id out of a sector id and channel number.
|
|
| ModuleID_t (const uint16_t id) noexcept |
| ModuleID_t used to construct from a given integer that has a valid module ID.
|
|
auto | isValidID () const noexcept -> bool |
| isValidID check is constructed id is valid
|
|
auto | getSector () const noexcept -> int8_t |
| getSector returns the defined sectors.
|
|
auto | getChannel () const noexcept -> int8_t |
| getChannel return the defined channel
|
|
auto | getNumbering () const noexcept -> int |
| getNumbering returns the channel number Ax = 1+x; Bx = 36 + x; Cx = 72 + x; Dx = 108 + x; Note: an invalid id return an invalid number!
|
|
auto | operator== (const ModuleID_t &rOther) const noexcept -> bool |
| comparison operator==
|
|
auto | operator!= (const ModuleID_t &rOther) const noexcept -> bool |
| comparison operator!=
|
|
auto | operator< (const ModuleID_t &rOther) const noexcept -> bool |
| comparison operator<
|
|
auto | operator<= (const ModuleID_t &rOther) const noexcept -> bool |
| comparison operator<=
|
|
auto | operator> (const ModuleID_t &rOther) const noexcept -> bool |
| comparison operator>
|
|
auto | operator>= (const ModuleID_t &rOther) const noexcept -> bool |
| comparison operator>=
|
|
auto | operator++ () noexcept -> ModuleID_t & |
| precrement operator ++X
|
|
auto | operator++ (int) noexcept -> ModuleID_t |
| postcrement operator X++
|
|
|
static constexpr auto | isValidChannel (const int channel) noexcept -> bool |
| isValidChannel defines the range of valid channels.
|
|
static auto | isValidSector (const uint8_t sector) noexcept -> bool |
| isValidSector checks whether a given sector is valid.
|
|
|
static constexpr auto | m_gValidSectors |
| m_gValidSectors is a array containing allowed sector ids
|
|
static constexpr auto | m_gMaxChannel = int8_t {36} |
| m_gMaxChannel number of maximum channel starting from 0
|
|
|
uint16_t | m_ID |
| m_ID contains the unique sector and channel ids.
|
|
|
static constexpr auto | m_gMemberSize = sizeof(int8_t) * 8 |
| m_gMemberSize size of each sub ids
|
|
static constexpr auto | m_gMemberMask = 0xff |
| m_gMemberMask is a mask to get the desired sub id info.
|
|
|
auto | operator<< (std::ostream &rStream, const ModuleID_t id) -> std::ostream & |
| operator << to print the id using any std::ostream implementation...
|
|
The ModuleID_t class is a intermediate object generated to contain configurations in a sorted fashion.
Definition at line 30 of file ARICHDatabaseTools.h.
◆ ModuleID_t() [1/2]
ModuleID_t |
( |
const int8_t | sector = '0', |
|
|
const int | channel = 0 ) |
|
inlinenoexcept |
◆ ModuleID_t() [2/2]
ModuleID_t used to construct from a given integer that has a valid module ID.
Note: An invalid ID causes an undefined behaviour!
- Parameters
-
Definition at line 81 of file ARICHDatabaseTools.h.
◆ getChannel()
auto getChannel |
( |
| ) |
const -> int8_t
|
|
inlinenoexcept |
◆ getNumbering()
auto getNumbering |
( |
| ) |
const -> int
|
|
inlinenoexcept |
getNumbering returns the channel number Ax = 1+x; Bx = 36 + x; Cx = 72 + x; Dx = 108 + x; Note: an invalid id return an invalid number!
!!
- Returns
- channel number increamened by an offset determined by section ID.
- See also
- isValidID()
Definition at line 119 of file ARICHDatabaseTools.h.
120 {
121 return (this->getSector() - m_gValidSectors.front()) * m_gMaxChannel +
122 this->getChannel();
123 }
◆ getSector()
auto getSector |
( |
| ) |
const -> int8_t
|
|
inlinenoexcept |
◆ isValidChannel()
static constexpr auto isValidChannel |
( |
const int | channel | ) |
-> bool
|
|
inlinestaticconstexprnoexcept |
isValidChannel defines the range of valid channels.
- Parameters
-
- Returns
- true if channel id/number is in the valid range otherwise false.
Definition at line 49 of file ARICHDatabaseTools.h.
50 {
51 return (channel >= 0) && (channel <= m_gMaxChannel);
52 }
◆ isValidID()
auto isValidID |
( |
| ) |
const -> bool
|
|
inlinenoexcept |
isValidID check is constructed id is valid
- Returns
- true if this ModuleID_t is valid, otherwise false.
Definition at line 87 of file ARICHDatabaseTools.h.
88 {
89 return ModuleID_t::isValidSector(this->getSector()) &&
90 ModuleID_t::isValidChannel(this->getChannel());
91 }
◆ isValidSector()
static auto isValidSector |
( |
const uint8_t | sector | ) |
-> bool
|
|
inlinestaticnoexcept |
isValidSector checks whether a given sector is valid.
- Parameters
-
sector | sector to be checked |
- Returns
- true if sector id/number is in the valid range otherwise false.
Definition at line 59 of file ARICHDatabaseTools.h.
60 {
61 return std::find(m_gValidSectors.begin(), m_gValidSectors.end(), sector) !=
62 m_gValidSectors.end();
63 }
◆ operator!=()
comparison operator!=
- Note
- if using c++17 replace this one with <=> operator
Definition at line 150 of file ARICHDatabaseTools.h.
151 {
152 return m_ID != rOther.m_ID;
153 }
◆ operator++() [1/2]
precrement operator ++X
- Note
- does not check the module range!!! overflow is allowed!!!
Definition at line 195 of file ARICHDatabaseTools.h.
196 {
197 m_ID = this->getChannel() >= m_gMaxChannel
198 ? (((this->getSector() + 1) << m_gMemberSize) | 1)
199 : m_ID + 1;
200 return *this;
201 }
◆ operator++() [2/2]
postcrement operator X++
- Note
- does not check the module range!!! overflow is allowed!!!
Definition at line 207 of file ARICHDatabaseTools.h.
208 {
209 auto tmp = ModuleID_t(m_ID);
210 this->operator++();
211 return tmp;
212 }
◆ operator<()
auto operator< |
( |
const ModuleID_t & | rOther | ) |
const -> bool
|
|
inlinenoexcept |
comparison operator<
- Note
- if using c++17 replace this one with <=> operator
Definition at line 159 of file ARICHDatabaseTools.h.
160 {
161 return m_ID < rOther.m_ID;
162 }
◆ operator<=()
auto operator<= |
( |
const ModuleID_t & | rOther | ) |
const -> bool
|
|
inlinenoexcept |
comparison operator<=
- Note
- if using c++17 replace this one with <=> operator
Definition at line 168 of file ARICHDatabaseTools.h.
169 {
170 return m_ID <= rOther.m_ID;
171 }
◆ operator==()
auto operator== |
( |
const ModuleID_t & | rOther | ) |
const -> bool
|
|
inlinenoexcept |
comparison operator==
- Note
- if using c++17 replace this one with <=> operator
Definition at line 141 of file ARICHDatabaseTools.h.
142 {
143 return m_ID == rOther.m_ID;
144 }
◆ operator>()
auto operator> |
( |
const ModuleID_t & | rOther | ) |
const -> bool
|
|
inlinenoexcept |
comparison operator>
- Note
- if using c++17 replace this one with <=> operator
Definition at line 177 of file ARICHDatabaseTools.h.
178 {
179 return m_ID > rOther.m_ID;
180 }
◆ operator>=()
auto operator>= |
( |
const ModuleID_t & | rOther | ) |
const -> bool
|
|
inlinenoexcept |
comparison operator>=
- Note
- if using c++17 replace this one with <=> operator
Definition at line 186 of file ARICHDatabaseTools.h.
187 {
188 return m_ID >= rOther.m_ID;
189 }
◆ operator<<
auto operator<< |
( |
std::ostream & | rStream, |
|
|
const ModuleID_t | id ) -> std::ostream&
|
|
friend |
operator << to print the id using any std::ostream implementation...
- Parameters
-
Definition at line 130 of file ARICHDatabaseTools.h.
132 {
133 rStream << id.getSector() << static_cast<int>(id.getChannel());
134 return rStream;
135 }
◆ m_gMaxChannel
auto m_gMaxChannel = int8_t {36} |
|
staticconstexpr |
◆ m_gMemberMask
auto m_gMemberMask = 0xff |
|
staticconstexprprivate |
◆ m_gMemberSize
auto m_gMemberSize = sizeof(int8_t) * 8 |
|
staticconstexprprivate |
◆ m_gValidSectors
std::array< uint8_t, 4 > m_gValidSectors |
|
staticconstexpr |
Initial value:=
std::array<uint8_t, 4>( {{'A', 'B', 'C', 'D'}})
m_gValidSectors is a array containing allowed sector ids
Definition at line 36 of file ARICHDatabaseTools.h.
◆ m_ID
The documentation for this class was generated from the following file: