8 crate(c), slot(s), channel(ch), mode(comparison_mode) {
9 validateHAddress(c, s, ch);
13void GElectronic::validateHAddress(
int c,
int s,
int ch) {
14 if (c < 0 || s < 0 || ch < 0) {
15 throw std::invalid_argument(
"GElectronic hardware address components must be non-negative");
22 validateHAddress(c, s, ch);
30 return {crate, slot, channel};
34bool GElectronic::operator==(
const GElectronic& ge)
const {
36 return this->crate == ge.crate;
39 return this->crate == ge.crate && this->slot == ge.slot;
41 return this->crate == ge.crate && this->slot == ge.slot && this->channel == ge.channel;
46 stream <<
" Crate: " << ge.crate;
47 stream <<
" Slot: " << ge.slot;
48 stream <<
" Channel: " << ge.channel;
std::ostream & operator<<(std::ostream &stream, const GElectronic &ge)
Defines GElectronic, a compact hardware address used by digitization and translation tables.
Represents an electronic module address (crate/slot/channel) with configurable comparison granularity...
GElectronic(int c, int s, int ch, ComparisonMode comparison_mode)
Constructs a GElectronic with a specific hardware address and comparison mode.
void setHAddress(int c, int s, int ch)
Sets the hardware address fields (crate/slot/channel).
std::vector< int > getHAddress() const
Returns the hardware address as a vector of three integers.
ComparisonMode
Selects which hardware-address fields participate in comparison.