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 <costas.andreopoulos \at stfc.ac.uk>
9  University of Liverpool & STFC Rutherford Appleton Lab
10 
11 \created May 13, 2005
12 
13 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15  or see $GENIE/LICENSE
16 */
17 //____________________________________________________________________________
18 
19 #ifndef _PDG_CODE_LIST_H_
20 #define _PDG_CODE_LIST_H_
21 
22 #include <vector>
23 #include <ostream>
24 
25 using std::vector;
26 using std::ostream;
27 
28 namespace genie {
29 
30 class PDGCodeList;
31 ostream & operator << (ostream & stream, const PDGCodeList & list);
32 
33 class PDGCodeList : public vector<int> {
34 
35 public :
36 
37  PDGCodeList(bool allowdup=false);
38  PDGCodeList(size_type n, bool allowdup=false);
39  PDGCodeList(const PDGCodeList & list);
40  ~PDGCodeList();
41 
42  //! override the vector<int> insertion methods to explicitly check for
43  //! PDG code validity and that no PDG code is listed more than once
44  void push_back (int pdg_code);
45  void insert (iterator pos, size_type n, const int& x);
46 
47  //! PDG code checks used by PDGCodeList
48  bool CheckPDGCode (int pdg_code) const;
49  bool ExistsInPDGLibrary (int pdg_code) const;
50  bool ExistsInPDGCodeList (int pdg_code) const;
51 
52  //! copy / print
53  void Copy (const PDGCodeList & list);
54  void Print (ostream & stream) const;
55 
56  //! check state
57  bool DuplEntriesAllowed(void) const { return fAllowDuplicateEntries; }
58 
59  //! overloaded operators
60  PDGCodeList & operator = (const PDGCodeList & list);
61  friend ostream & operator << (ostream & stream, const PDGCodeList & list);
62 
63 private:
64 
65  bool fAllowDuplicateEntries; ///< allow duplicate entries in the list?
66 };
67 
68 } // genie namespace
69 
70 #endif // _PDG_CODE_LIST_H_
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
PDGCodeList & operator=(const PDGCodeList &list)
overloaded operators
bool ExistsInPDGCodeList(int pdg_code) const
PDGCodeList(bool allowdup=false)
Definition: PDGCodeList.cxx:44
A list of PDG codes.
Definition: PDGCodeList.h:33
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Definition: typedefs.hpp:11
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:65
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
bool DuplEntriesAllowed(void) const
check state
Definition: PDGCodeList.h:57
friend ostream & operator<<(ostream &stream, const PDGCodeList &list)
Definition: PDGCodeList.cxx:37
bool ExistsInPDGLibrary(int pdg_code) const
bool CheckPDGCode(int pdg_code) const
PDG code checks used by PDGCodeList.
Definition: PDGCodeList.cxx:80
void Print(ostream &stream) const
void insert(iterator pos, size_type n, const int &x)
Definition: PDGCodeList.cxx:72
void Copy(const PDGCodeList &list)
copy / print
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67