ThePEG  1.8.0
ColourBase.h
1 // -*- C++ -*-
2 //
3 // ColourBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_ColourBase_H
10 #define ThePEG_ColourBase_H
11 // This is the declaration of the ColourBase class.
12 
13 #include "ThePEG/EventRecord/EventInfoBase.h"
14 #include "ThePEG/EventRecord/ColourLine.h"
15 
16 namespace ThePEG {
17 
32 class ColourBase: public EventInfoBase {
33 
34 public:
35 
37  friend class ColourLine;
38 
39 public:
40 
44  virtual ~ColourBase();
45 
46 public:
47 
52 
56  tColinePtr colourLine() const { return theColourLine; }
57 
62  virtual vector<tcColinePtr> antiColourLines() const;
63 
68  virtual vector<tcColinePtr> colourLines() const;
69 
74  virtual bool hasColourLine(tcColinePtr line, bool anti = false) const;
75 
80  bool hasAntiColourLine(tcColinePtr line) const {
81  return hasColourLine(line, true);
82  }
83 
84 protected:
85 
89  virtual void antiColourLine(tColinePtr line) {
90  theAntiColourLine = line;
91  }
92 
96  virtual void colourLine(tColinePtr l, bool anti = false) {
97  if ( anti ) antiColourLine(l);
98  else theColourLine = l;
99  }
100 
104  virtual void removeAntiColourLine(tcColinePtr line) {
105  if ( antiColourLine() == line ) theAntiColourLine = tColinePtr();
106  }
107 
111  virtual void removeColourLine(tcColinePtr line, bool anti = false) {
112  if ( anti ) removeAntiColourLine(line);
113  else if ( colourLine() == line ) theColourLine = tColinePtr();
114  }
115 
116 public:
117 
125  virtual void rebind(const EventTranslationMap & trans);
126 
130  void persistentOutput(PersistentOStream &) const;
131 
135  void persistentInput(PersistentIStream &, int);
136 
140  static void Init();
141 
145  virtual EIPtr clone() const;
146 
147 private:
148 
153 
158 
159 private:
160 
165 
169  ColourBase & operator=(const ColourBase &);
170 
171 };
172 
173 
175 ThePEG_DECLARE_CLASS_TRAITS(ColourBase,EventInfoBase);
178 }
179 
180 #endif /* ThePEG_ColourBase_H */