16 template <
unsigned int nibbleNumber,
class T>
18 unsigned int nibble(
const T
number){
19 return (
number>>(4*nibbleNumber)) & 0xf;
35 std::cout<<
"SCT_OnlineId: Trying to create an invalid online Id from RodId 0x"<<std::hex<<rodId<<std::dec<<
" and fibre: "<<
fibre<<std::endl;
70SCT_OnlineId::operator
unsigned int()
const{
94 const std::uint32_t lowestRodId(0x210000);
95 const std::uint32_t highestRodId=0x24010F;
96 return ((
r >=lowestRodId) and (
r<=highestRodId)) ;
101 const std::uint32_t lowestRodId(0x210000);
102 const std::uint32_t highestRodId=0x24010F;
106 const std::uint32_t uniqueToOppositeCase = usingDbCabling?0x220010:0x220105;
107 return ((
r >=lowestRodId) and (
r<=highestRodId) and (
r!=uniqueToOppositeCase)) ;
127 const unsigned int X(nibble<4>(
m_onlineId) - 1);
128 unsigned int result= ((X + (Y * 4)) * 16 + Z) * 96 + (
fibre());
130 std::cout<<
"SCT_OnlineId: Invalid index for online Id "<<std::hex<<
m_onlineId<<std::dec<<
" X, Y, Z: "<<X<<
", "<<Y<<
", "<<Z<<std::endl;
Header file for a utility class to hold the online id.
SCT_OnlineId is a class to hold an online id number and provide check on validity,...
std::uint32_t fibre() const
Return the fibre.
bool is_valid() const
Check whether the onlineId is valid, without knowing the data source; this is a rough check.
std::uint32_t m_onlineId
The underlying number.
std::uint32_t rod() const
Return the rod/rob Id.
SCT_OnlineId & operator++()
Implement pre-increment and post-increment for iterating over fibres in a rod.
static bool rodIdInRange(std::uint32_t r)
Is the rod in range?
static bool fibreInRange(std::uint32_t f)
Simple range check.
unsigned int index() const
Return an index in the range 0-9215, calculated from parts of the onlineId.
SCT_OnlineId()
Default constructor produces an invalid serial number.
std::string number(const double &d, const std::string &s)