00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_Containers_H
00010 #define ThePEG_Containers_H
00011
00025 #include "ThePEG/Utilities/UnitIO.h"
00026
00027 namespace ThePEG {
00028
00030 ThePEG_DECLARE_SET(PDPtr,ParticleDataSet);
00031
00033 typedef vector<PDPtr> PDVector;
00034
00036 typedef vector<cPDPtr> cPDVector;
00037
00039 typedef vector<tPDPtr> tPDVector;
00040
00042 typedef vector<tcPDPtr> tcPDVector;
00043
00045 ThePEG_DECLARE_SET(PMPtr,MatcherSet);
00046
00048 ThePEG_DECLARE_SET(DMPtr,DecayModeSet);
00049
00051 ThePEG_DECLARE_SET(IBPtr,ObjectSet);
00052
00054 ThePEG_DECLARE_SET(IBPtr,DependencySet);
00055
00057 ThePEG_DECLARE_MAP(long,PDPtr,ParticleMap);
00058
00060 ThePEG_DECLARE_MAP(string,IBPtr,ObjectMap);
00061
00064 ThePEG_DECLARE_MAP(IBPtr,DependencySet,DependencyMap);
00065
00067 typedef vector<IBPtr> IVector;
00068
00070 typedef vector<cIBPtr> CIVector;
00071
00073 typedef vector<PPtr> ParticleVector;
00074
00076 typedef vector<PPtr> PVector;
00077
00079 typedef vector<cPPtr> cPVector;
00080
00082 typedef vector<tPPtr> tPVector;
00083
00085 typedef vector<tcPPtr> tcPVector;
00086
00088 ThePEG_DECLARE_MAP(string,const InterfaceBase *,InterfaceMap);
00089
00091 typedef Rebinder<InterfacedBase> TranslationMap;
00092
00094 ThePEG_DECLARE_MAP(string,EGPtr,GeneratorMap);
00095
00097 typedef vector<AnaPtr> AnalysisVector;
00098
00100 typedef pair<PDPtr, PDPtr> PDPair;
00101
00103 typedef pair<cPDPtr, cPDPtr> cPDPair;
00104
00106 typedef pair<tPDPtr, tPDPtr> tPDPair;
00107
00109 typedef pair<tcPDPtr, tcPDPtr> tcPDPair;
00110
00112 typedef pair<PPtr, PPtr> PPair;
00113
00115 typedef pair<cPPtr, cPPtr> cPPair;
00116
00118 typedef pair<tPPtr, tPPtr> tPPair;
00119
00121 typedef pair<tcPPtr, tcPPtr> tcPPair;
00122
00124 typedef Interval<Energy2> SInterval;
00125
00127 typedef vector<SInterval> SIntervalVector;
00128
00130 typedef vector<tPDPair> tPartonPairVec;
00131
00133 typedef pair<tColinePtr,tColinePtr> tColinePair;
00134
00136 ThePEG_DECLARE_SET(tDMPtr,DecaySet);
00137
00139 ThePEG_DECLARE_SET(string,StringSet);
00140
00142 typedef vector<Energy> EnergyVector;
00143
00145 typedef vector<EIPtr> EIVector;
00146
00148 typedef vector<double> DVector;
00149
00151 typedef pair<double,double> DPair;
00152
00163 template <typename T, typename U>
00164 vector<T> & operator<<(vector<T> & tv, const U & u) {
00165 tv.push_back(u);
00166 return tv;
00167 }
00168
00176 template <typename T, typename U>
00177 vector<T> & operator>>(vector<T> & tv, U & u) {
00178 u = tv.back();
00179 tv.pop_back();
00180 return tv;
00181 }
00182
00190 template <typename T, typename U>
00191 stack<T> & operator<<(stack<T> & ts, const U & u) {
00192 ts.push(u);
00193 return ts;
00194 }
00195
00203 template <typename T, typename U>
00204 stack<T> & operator>>(stack<T> & ts, U & u) {
00205 u = ts.top();
00206 ts.pop();
00207 return ts;
00208 }
00209
00217 template <typename T, typename U>
00218 deque<T> & operator<<(deque<T> & td, const U & u) {
00219 td.push_back(u);
00220 return td;
00221 }
00222
00230 template <typename T, typename U>
00231 deque<T> & operator>>(deque<T> & td, U & u) {
00232 u = td.front();
00233 td.pop_front();
00234 return td;
00235 }
00236
00244 template <typename T, typename U>
00245 set<T> & operator<<(set<T> & ts, const U & u) {
00246 ts.insert(u);
00247 return ts;
00248 }
00250
00259 template <typename OStream, typename T, typename Alloc, typename UT>
00260 void ounitstream(OStream & os, const vector<T,Alloc> & v, UT & u) {
00261 os << v.size();
00262 for ( typename vector<T,Alloc>::const_iterator i = v.begin();
00263 i != v.end(); ++i )
00264 os << ounit(*i, u);
00265 }
00266
00273 template <typename IStream, typename T, typename Alloc, typename UT>
00274 void iunitstream(IStream & is, vector<T,Alloc> & v, UT & u) {
00275 typename vector<T,Alloc>::size_type l;
00276 is >> l;
00277 v.resize(l);
00278 for ( typename vector<T,Alloc>::iterator i = v.begin(); i != v.end(); ++i )
00279 is >> iunit(*i, u);
00280 }
00281
00288 template <typename OStream, typename T, typename CMP, typename A, typename UT>
00289 void ounitstream(OStream & os, const set<T,CMP,A> & s, UT & u) {
00290 os << s.size();
00291 for ( typename set<T,CMP,A>::const_iterator i = s.begin(); i != s.end(); ++i )
00292 os << ounit(*i, u);
00293 }
00294
00301 template <typename IStream, typename T, typename CMP, typename A, typename UT>
00302 void iunitstream(IStream & is, set<T,CMP,A> & s, UT & u) {
00303 s.clear();
00304 typename set<T,CMP,A>::size_type l;
00305 is >> l;
00306 T t;
00307 while ( l-- ) {
00308 is >> iunit(t, u);
00309 s.insert(t);
00310 }
00311 }
00312
00320 template <typename OStream, typename K, typename T,
00321 typename CMP, typename A, typename UT>
00322 void ounitstream(OStream & os, const map<K,T,CMP,A> & m, UT & u) {
00323 os << m.size();
00324 for ( typename map<K,T,CMP,A>::const_iterator i = m.begin();
00325 i != m.end(); ++i )
00326 os << i->first << ounit(i->second, u);
00327 }
00328
00336 template <typename IStream, typename K, typename T,
00337 typename CMP, typename A, typename UT>
00338 void iunitstream(IStream & is, map<K,T,CMP,A> & m, UT & u) {
00339 m.clear();
00340 typename map<K,T,CMP,A>::size_type l;
00341 is >> l;
00342 T t;
00343 K k;
00344 while ( l-- ) {
00345 is >> k >> iunit(t, u);
00346 m[k] = t;
00347 }
00348 }
00350
00351 }
00352
00353 #endif