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 Member Functions

 GElectronic (int c, int s, int ch, int m)
 Constructs a GElectronic with a specific hardware address and comparison mode.
 
 GElectronic ()
 Default constructor.
 
void setHAddress (int c, int s, int ch)
 Sets the hardware address fields (crate/slot/channel).
 
std::vector< int > getHAddress ()
 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:

  • mode == 0: compare crate only
  • mode == 1: compare crate and slot
  • mode == 2: compare crate, slot, and channel

Example (mode == 1):

  • (3, 3, 1) is considered the same as (3, 3, 4) because the channel is ignored. In mode == 2, 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 32 of file gelectronic.h.

Constructor & Destructor Documentation

◆ GElectronic() [1/2]

GElectronic::GElectronic ( int c,
int s,
int ch,
int m )
Parameters
cCrate number.
sSlot number.
chChannel number.
mComparison mode:
  • 0: crate only
  • 1: crate and slot
  • 2: crate, slot, and channel

Definition at line 10 of file gelectronic.cc.

◆ GElectronic() [2/2]

GElectronic::GElectronic ( )

Initializes the address and mode to the "uninitialized" sentinel used by the framework. This constructor exists because some containers (e.g. maps used by translation tables) require default-constructible value types.

Definition at line 14 of file gelectronic.cc.

Member Function Documentation

◆ getHAddress()

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

Definition at line 27 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 20 of file gelectronic.cc.

Friends And Related Symbol Documentation

◆ operator<<

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

Prints the address fields in a human-readable form.

Definition at line 46 of file gelectronic.cc.


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