GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PDGCodeList.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::PDGCodeList
5 
6 \brief A list of PDG codes
7 
8 \author Costas Andreopoulos <c.andreopoulos \at cern.ch>
9  University of Liverpool
10 
11 \created May 13, 2005
12 
13 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 */
16 //____________________________________________________________________________
17 
18 #ifndef _PDG_CODE_LIST_H_
19 #define _PDG_CODE_LIST_H_
20 
21 #include <vector>
22 #include <ostream>
23 
24 using std::vector;
25 using std::ostream;
26 
27 namespace genie {
28 
29 class PDGCodeList;
30 ostream & operator << (ostream & stream, const PDGCodeList & list);
31 
32 class PDGCodeList : public vector<int> {
33 
34 public :
35 
36  PDGCodeList(bool allowdup=false);
37  PDGCodeList(size_type n, bool allowdup=false);
38  PDGCodeList(const PDGCodeList & list);
39  ~PDGCodeList();
40 
41  //! override the vector<int> insertion methods to explicitly check for
42  //! PDG code validity and that no PDG code is listed more than once
43  void push_back (int pdg_code);
44  void insert (iterator pos, size_type n, const int& x);
45 
46  //! PDG code checks used by PDGCodeList
47  bool CheckPDGCode (int pdg_code) const;
48  bool ExistsInPDGLibrary (int pdg_code) const;
49  bool ExistsInPDGCodeList (int pdg_code) const;
50 
51  //! copy / print
52  void Copy (const PDGCodeList & list);
53  void Print (ostream & stream) const;
54 
55  //! check state
56  bool DuplEntriesAllowed(void) const { return fAllowDuplicateEntries; }
57 
58  //! overloaded operators
59  PDGCodeList & operator = (const PDGCodeList & list);
60  friend ostream & operator << (ostream & stream, const PDGCodeList & list);
61 
62 private:
63 
64  bool fAllowDuplicateEntries; ///< allow duplicate entries in the list?
65 };
66 
67 } // genie namespace
68 
69 #endif // _PDG_CODE_LIST_H_
PDGCodeList & operator=(const PDGCodeList &list)
overloaded operators
bool ExistsInPDGCodeList(int pdg_code) const
PDGCodeList(bool allowdup=false)
Definition: PDGCodeList.cxx:35
A list of PDG codes.
Definition: PDGCodeList.h:32
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:64
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
bool DuplEntriesAllowed(void) const
check state
Definition: PDGCodeList.h:56
friend ostream & operator<<(ostream &stream, const PDGCodeList &list)
Definition: PDGCodeList.cxx:28
bool ExistsInPDGLibrary(int pdg_code) const
Definition: PDGCodeList.cxx:93
bool CheckPDGCode(int pdg_code) const
PDG code checks used by PDGCodeList.
Definition: PDGCodeList.cxx:71
void Print(ostream &stream) const
void insert(iterator pos, size_type n, const int &x)
Definition: PDGCodeList.cxx:63
void Copy(const PDGCodeList &list)
copy / print
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:58