gtouchable
Loading...
Searching...
No Matches
GElectronic Struct Reference

Represents an electronic module address (crate/slot/channel) with configurable comparison granularity. More...

#include <gelectronic.h>

Public Types

enum class  ComparisonMode { crate , crate_slot , crate_slot_channel }
 Selects which hardware-address fields participate in comparison. More...

Public Member Functions

 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.

Friends

std::ostream & operator<< (std::ostream &stream, const GElectronic &ge)
 Stream output helper for diagnostics and logging.

Detailed Description

A GElectronic instance encapsulates:

  • crate number
  • slot number
  • channel number
  • comparison mode (granularity)

The comparison mode defines which parts of the address are considered significant when comparing two addresses:

  • crate: compare crate only
  • crate_slot: compare crate and slot
  • crate_slot_channel: compare crate, slot, and channel

Example (mode == crate_slot):

  • (3, 3, 1) is considered the same as (3, 3, 4) because the channel is ignored. In mode == crate_slot_channel, those two would be different.

Typical usage:

  • Translation tables and lookup maps can choose the comparison granularity they need (crate-only vs full address).

Definition at line 35 of file gelectronic.h.

Member Enumeration Documentation

◆ ComparisonMode

enum class GElectronic::ComparisonMode
strong
Enumerator
crate 
crate_slot 
crate_slot_channel 

Definition at line 39 of file gelectronic.h.

Constructor & Destructor Documentation

◆ GElectronic()

GElectronic::GElectronic ( int c,
int s,
int ch,
ComparisonMode comparison_mode )
Parameters
cCrate number.
sSlot number.
chChannel number.
comparison_modeHardware-address comparison granularity.

Definition at line 7 of file gelectronic.cc.

Member Function Documentation

◆ getHAddress()

std::vector< int > GElectronic::getHAddress ( ) const
nodiscard
Returns
A vector containing {crate, slot, channel} in that order.

Definition at line 29 of file gelectronic.cc.

◆ setHAddress()

void GElectronic::setHAddress ( int c,
int s,
int ch )

The comparison mode is not changed by this call.

Parameters
cCrate number.
sSlot number.
chChannel number.

Definition at line 21 of file gelectronic.cc.

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const GElectronic & ge )
friend

Prints the address fields in a human-readable form.

Definition at line 45 of file gelectronic.cc.


The documentation for this struct was generated from the following files: