BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes | Friends
ACRegistryKey Class Reference

custom key class for pair of <name,rigidity>. More...

#include <BDSAcceleratorComponentRegistry.hh>

Collaboration diagram for ACRegistryKey:
Collaboration graph

Public Member Functions

 ACRegistryKey (const std::string &componentNameIn, G4double rigidityIn)
 
 ACRegistryKey (const ACRegistryKey &other)=default
 
bool operator== (const ACRegistryKey &other) const
 

Data Fields

std::string componentName
 Has to be std::string for hashing as G4String doesn't provide one.
 
G4double rigidity
 

Static Public Attributes

static G4double tolerance = 1e-7
 

Friends

std::ostream & operator<< (std::ostream &out, ACRegistryKey const &k)
 

Detailed Description

custom key class for pair of <name,rigidity>.

We want to store a map of (name,rigidity) but compare rigidity with a numerical tolerance as it's a double. std::map requires the less than operator so we'll use unordered_map that uses ==.

This class is a pair but with == specialised. Also, we provide a hash function (specialisation for the template).

Author
Laurie Nevay

Definition at line 45 of file BDSAcceleratorComponentRegistry.hh.

Constructor & Destructor Documentation

◆ ACRegistryKey() [1/2]

ACRegistryKey::ACRegistryKey ( )

Definition at line 40 of file BDSAcceleratorComponentRegistry.cc.

◆ ACRegistryKey() [2/2]

ACRegistryKey::ACRegistryKey ( const std::string &  componentNameIn,
G4double  rigidityIn 
)

Definition at line 45 of file BDSAcceleratorComponentRegistry.cc.

Member Function Documentation

◆ operator==()

bool ACRegistryKey::operator== ( const ACRegistryKey other) const

Definition at line 51 of file BDSAcceleratorComponentRegistry.cc.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
ACRegistryKey const &  k 
)
friend

Definition at line 58 of file BDSAcceleratorComponentRegistry.cc.

Field Documentation

◆ componentName

std::string ACRegistryKey::componentName

Has to be std::string for hashing as G4String doesn't provide one.

Definition at line 55 of file BDSAcceleratorComponentRegistry.hh.

Referenced by std::hash< ACRegistryKey >::operator()().

◆ rigidity

G4double ACRegistryKey::rigidity

Definition at line 56 of file BDSAcceleratorComponentRegistry.hh.

◆ tolerance

G4double ACRegistryKey::tolerance = 1e-7
static

Definition at line 57 of file BDSAcceleratorComponentRegistry.hh.


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