00001 // -*- C++ -*- 00002 // 00003 // ColourBase.h is a part of ThePEG - Toolkit for HEP Event Generation 00004 // Copyright (C) 1999-2007 Leif Lonnblad 00005 // 00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details. 00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 00008 // 00009 #ifndef ThePEG_ColourBase_H 00010 #define ThePEG_ColourBase_H 00011 // This is the declaration of the ColourBase class. 00012 00013 #include "ThePEG/EventRecord/EventInfoBase.h" 00014 #include "ThePEG/EventRecord/ColourLine.h" 00015 00016 namespace ThePEG { 00017 00032 class ColourBase: public EventInfoBase { 00033 00034 public: 00035 00037 friend class ColourLine; 00038 00039 public: 00040 00044 virtual ~ColourBase(); 00045 00046 public: 00047 00051 tColinePtr antiColourLine() const { return theAntiColourLine; } 00052 00056 tColinePtr colourLine() const { return theColourLine; } 00057 00062 virtual vector<tcColinePtr> antiColourLines() const; 00063 00068 virtual vector<tcColinePtr> colourLines() const; 00069 00074 virtual bool hasColourLine(tcColinePtr line, bool anti = false) const; 00075 00080 bool hasAntiColourLine(tcColinePtr line) const { 00081 return hasColourLine(line, true); 00082 } 00083 00084 protected: 00085 00089 virtual void antiColourLine(tColinePtr line) { 00090 theAntiColourLine = line; 00091 } 00092 00096 virtual void colourLine(tColinePtr l, bool anti = false) { 00097 if ( anti ) antiColourLine(l); 00098 else theColourLine = l; 00099 } 00100 00104 virtual void removeAntiColourLine(tcColinePtr line) { 00105 if ( antiColourLine() == line ) theAntiColourLine = tColinePtr(); 00106 } 00107 00111 virtual void removeColourLine(tcColinePtr line, bool anti = false) { 00112 if ( anti ) removeAntiColourLine(line); 00113 else if ( colourLine() == line ) theColourLine = tColinePtr(); 00114 } 00115 00116 public: 00117 00125 virtual void rebind(const EventTranslationMap & trans); 00126 00130 void persistentOutput(PersistentOStream &) const; 00131 00135 void persistentInput(PersistentIStream &, int); 00136 00140 static void Init(); 00141 00145 virtual EIPtr clone() const; 00146 00147 private: 00148 00152 ColinePtr theAntiColourLine; 00153 00157 ColinePtr theColourLine; 00158 00159 private: 00160 00164 static ClassDescription<ColourBase> initColourBase; 00165 00169 ColourBase & operator=(const ColourBase &); 00170 00171 }; 00172 00173 00175 ThePEG_DECLARE_CLASS_TRAITS(ColourBase,EventInfoBase); 00178 } 00179 00180 #endif /* ThePEG_ColourBase_H */