Belle II Software  release-08-01-10
ModuleID_t Class Reference

The ModuleID_t class is a intermediate object generated to contain configurations in a sorted fashion. More...

#include <ARICHDatabaseTools.h>

Public Member Functions

 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. More...
 
 ModuleID_t (const uint16_t id) noexcept
 ModuleID_t used to construct from a given integer that has a valid module ID. More...
 
auto isValidID () const noexcept -> bool
 isValidID check is constructed id is valid More...
 
auto getSector () const noexcept -> int8_t
 getSector returns the definded sectors. More...
 
auto getChannel () const noexcept -> int8_t
 getChannel return the defined channel More...
 
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!!! More...
 
auto operator== (const ModuleID_t &rOther) const noexcept -> bool
 comparison operator== More...
 
auto operator!= (const ModuleID_t &rOther) const noexcept -> bool
 comparison operator!= More...
 
auto operator< (const ModuleID_t &rOther) const noexcept -> bool
 comparison operator< More...
 
auto operator<= (const ModuleID_t &rOther) const noexcept -> bool
 comparison operator<= More...
 
auto operator> (const ModuleID_t &rOther) const noexcept -> bool
 comparison operator> More...
 
auto operator>= (const ModuleID_t &rOther) const noexcept -> bool
 comparison operator>= More...
 
auto operator++ () noexcept -> ModuleID_t &
 precrement operator ++X More...
 
auto operator++ (int) noexcept -> ModuleID_t
 postcrement operator X++ More...
 

Static Public Member Functions

static constexpr auto isValidChannel (const int channel) noexcept -> bool
 isValidChannel defines the range of valid channels. More...
 
static auto isValidSector (const uint8_t sector) noexcept -> bool
 

Static Public Attributes

static constexpr auto m_gValidSectors
 m_gValidSectors is a array containing allowed sector ids More...
 
static constexpr auto m_gMaxChannel = int8_t {36}
 m_gMaxChannel number of maximum channel starting from 0
 

Private Attributes

uint16_t m_ID
 m_ID contains the unique sector and channel ids.
 

Static Private Attributes

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.
 

Friends

auto operator<< (std::ostream &rStream, const ModuleID_t id) -> std::ostream &
 operator << to print the id using any std::ostream implementation... More...
 

Detailed Description

The ModuleID_t class is a intermediate object generated to contain configurations in a sorted fashion.

Definition at line 30 of file ARICHDatabaseTools.h.

Constructor & Destructor Documentation

◆ ModuleID_t() [1/2]

ModuleID_t ( const int8_t  sector = '0',
const int  channel = 0 
)
inlinenoexcept

ModuleID_t is the default ctor that construct an id out of a sector id and channel number.

Parameters
sector
channel
See also
ModuleID_t::m_gValidSectors

Definition at line 68 of file ARICHDatabaseTools.h.

69  : m_ID((sector << m_gMemberSize) | channel) {}
static constexpr auto m_gMemberSize
m_gMemberSize size of each sub ids
uint16_t m_ID
m_ID contains the unique sector and channel ids.

◆ ModuleID_t() [2/2]

ModuleID_t ( const uint16_t  id)
inlineexplicitnoexcept

ModuleID_t used to construct from a given integer that has a valid module ID.

Note: An invalid ID causes an undefined behaviour!

Parameters
idis a valid module ID

Definition at line 76 of file ARICHDatabaseTools.h.

Member Function Documentation

◆ getChannel()

auto getChannel ( ) const -> int8_t
inlinenoexcept

getChannel return the defined channel

Returns
channel id/number
See also
ModuleID_t::isValidChannel()

Definition at line 103 of file ARICHDatabaseTools.h.

◆ 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 114 of file ARICHDatabaseTools.h.

◆ getSector()

auto getSector ( ) const -> int8_t
inlinenoexcept

getSector returns the definded sectors.

Returns
sector id
See also
ModuleID_t::m_gValidSectors

Definition at line 93 of file ARICHDatabaseTools.h.

◆ isValidChannel()

static constexpr auto isValidChannel ( const int  channel) -> bool
inlinestaticconstexprnoexcept

isValidChannel defines the range of valid channels.

Parameters
channel
Returns
true if channel id/number is in the valid range otherwise false.

Definition at line 49 of file ARICHDatabaseTools.h.

◆ 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 82 of file ARICHDatabaseTools.h.

◆ operator!=()

auto operator!= ( const ModuleID_t rOther) const -> bool
inlinenoexcept

comparison operator!=

Note
if using c++17 replace thi one with <=> operator

Definition at line 145 of file ARICHDatabaseTools.h.

◆ operator++() [1/2]

auto operator++ ( ) -> ModuleID_t&
inlinenoexcept

precrement operator ++X

Note
does not check the module range!!! overflow is allowed!!!

Definition at line 190 of file ARICHDatabaseTools.h.

◆ operator++() [2/2]

auto operator++ ( int  ) -> ModuleID_t
inlinenoexcept

postcrement operator X++

Note
does not check the module range!!! overflow is allowed!!!

Definition at line 202 of file ARICHDatabaseTools.h.

◆ operator<()

auto operator< ( const ModuleID_t rOther) const -> bool
inlinenoexcept

comparison operator<

Note
if using c++17 replace thi one with <=> operator

Definition at line 154 of file ARICHDatabaseTools.h.

◆ operator<=()

auto operator<= ( const ModuleID_t rOther) const -> bool
inlinenoexcept

comparison operator<=

Note
if using c++17 replace thi one with <=> operator

Definition at line 163 of file ARICHDatabaseTools.h.

◆ operator==()

auto operator== ( const ModuleID_t rOther) const -> bool
inlinenoexcept

comparison operator==

Note
if using c++17 replace thi one with <=> operator

Definition at line 136 of file ARICHDatabaseTools.h.

◆ operator>()

auto operator> ( const ModuleID_t rOther) const -> bool
inlinenoexcept

comparison operator>

Note
if using c++17 replace thi one with <=> operator

Definition at line 172 of file ARICHDatabaseTools.h.

◆ operator>=()

auto operator>= ( const ModuleID_t rOther) const -> bool
inlinenoexcept

comparison operator>=

Note
if using c++17 replace thi one with <=> operator

Definition at line 181 of file ARICHDatabaseTools.h.

Friends And Related Function Documentation

◆ operator<<

auto operator<< ( std::ostream &  rStream,
const ModuleID_t  id 
) -> std::ostream&
friend

operator << to print the id using any std::ostream implementation...

Parameters
rStream
id

Definition at line 125 of file ARICHDatabaseTools.h.

Member Data Documentation

◆ m_gValidSectors

constexpr 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.


The documentation for this class was generated from the following file: