Geant4  10.00.p03
G4MoleculeID.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
28 //
29 // WARNING : This class is released as a prototype.
30 // It might strongly evolve or even disapear in the next releases.
31 //
32 // History:
33 // -----------
34 // 10 Oct 2011 M.Karamitros created
35 //
36 // -------------------------------------------------------------------
37 
38 #ifndef G4MoleculeID_h
39 #define G4MoleculeID_h 1
40 
41 #include "G4Types.hh"
42 
44 {
45 private :
46  friend G4MoleculeID operator +(const G4MoleculeID& left,const int& right);
47  friend G4MoleculeID operator -(const G4MoleculeID& left,const int& right);
48  int fValue;
49 
51 
52 public :
53 
54  static int Last()
55  {
56  return fLastValue ;
57  }
58 
60  {
61  fLastValue ++;
62  return G4MoleculeID(fLastValue);
63  }
64 
65  static G4MoleculeID Initialize(int i)
66  {
67  fLastValue = i;
68  return G4MoleculeID(i);
69  }
70 
71  G4MoleculeID(const int d_) : fValue(d_){;}
72 
73  G4MoleculeID(){fValue=0;}
74  G4MoleculeID(const G4MoleculeID & d_) : fValue(d_.fValue){;}
75  inline G4MoleculeID & operator=(const G4MoleculeID & rhs) { this->fValue = rhs.fValue; return *this;}
76  G4MoleculeID & operator=(const int & rhs) { this->fValue = rhs; return *this;}
77  inline operator int & () { return fValue; }
78  inline operator const int & () const { return fValue; }
79  inline bool operator==(const G4MoleculeID & rhs) const { return fValue == rhs.fValue; }
80  inline bool operator==(const int & rhs) const { return fValue == rhs; }
81  inline bool operator<(const G4MoleculeID & rhs) const { return fValue < rhs.fValue; }
82 };
83 
85 
86 #endif
bool operator<(const G4MoleculeID &rhs) const
Definition: G4MoleculeID.hh:81
bool operator==(const int &rhs) const
Definition: G4MoleculeID.hh:80
static int Last()
Definition: G4MoleculeID.hh:54
static G4MoleculeID Initialize(int i)
Definition: G4MoleculeID.hh:65
G4MoleculeID & operator=(const G4MoleculeID &rhs)
Definition: G4MoleculeID.hh:75
#define G4ThreadLocal
Definition: tls.hh:52
friend G4MoleculeID operator+(const G4MoleculeID &left, const int &right)
G4MoleculeID(const G4MoleculeID &d_)
Definition: G4MoleculeID.hh:74
G4MoleculeID(const int d_)
Definition: G4MoleculeID.hh:71
G4MoleculeID gStartCounter
static G4ThreadLocal int fLastValue
Definition: G4MoleculeID.hh:50
G4MoleculeID & operator=(const int &rhs)
Definition: G4MoleculeID.hh:76
bool operator==(const G4MoleculeID &rhs) const
Definition: G4MoleculeID.hh:79
friend G4MoleculeID operator-(const G4MoleculeID &left, const int &right)
static G4MoleculeID Create()
Definition: G4MoleculeID.hh:59