ThePEG  1.8.0
Repository.h
1 // -*- C++ -*-
2 //
3 // Repository.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_Repository_H
10 #define ThePEG_Repository_H
11 // This is the declaration of the Repository class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "BaseRepository.h"
15 #include "EventGenerator.h"
16 #include "ThePEG/PDT/ParticleData.h"
17 #include "ThePEG/PDT/MatcherBase.h"
18 
19 namespace ThePEG {
20 
45 class Repository: public BaseRepository {
46 
47 public:
48 
50  typedef map<string,EGPtr> GeneratorMap;
51 
52 public:
53 
59  Repository();
60 
65  ~Repository();
66 
67 public:
68 
76  static void Register(IBPtr);
77 
83  static void Register(IBPtr, string newName);
85 
94  static void defaultParticle(tPDPtr);
95 
100  static PDPtr defaultParticle(PID id);
101 
109  static tPDPtr findParticle(string name);
110 
114  static const ParticleDataSet & allParticles() { return particles(); }
115 
119  static const MatcherSet & allMatchers() { return matchers(); }
120 
124  static tPMPtr findMatcher(string name);
125 
131  static string copyParticle(tPDPtr, string);
133 
140  static EGPtr makeRun(tEGPtr eg, string name);
141 
146  static void saveRun(string EGname, string name, string filename);
148 
156  static string load(string filename);
157 
161  static void save(string filename);
162 
166  static void save() { save(currentFileName()); }
167 
171  static void stats(ostream &);
173 
179  static void help(string command, ostream & os);
180 
185  static void remove(tIBPtr);
186 
193  static string remove(const ObjectSet & rmset);
194 
203  static void read(istream & is, ostream & os, string prompt = "");
204 
216  static string read(string filename, ostream & os);
217 
224  static string exec(string cmd, ostream &);
226 
230  static string version();
231 
235  static string banner();
236 
237 private:
238 
242  static void registerParticle(tPDPtr);
243 
247  static void registerMatcher(tPMPtr);
248 
252  static void execAndCheckReply(string, ostream &);
253 
254 protected:
255 
262  static ParticleMap & defaultParticles();
263 
267  static ParticleDataSet & particles();
268 
272  static MatcherSet & matchers();
273 
277  static GeneratorMap & generators();
278 
282  static string & currentFileName();
283 
284 public:
285 
290  static int & exitOnError();
291 
298  static void cleanup();
300 
301 private:
302 
307  Repository(const Repository &);
308 
313  Repository & operator=(const Repository &);
314 
318  static int ninstances;
319 
320 
321 };
322 
323 }
324 
325 #endif /* ThePEG_Repository_H */