ThePEG
1.8.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Repository
BaseRepository.h
1
// -*- C++ -*-
2
//
3
// BaseRepository.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_BaseRepository_H
10
#define ThePEG_BaseRepository_H
11
// This is the declaration of the BaseRepository class.
12
13
#include "ThePEG/Config/ThePEG.h"
14
#include "BaseRepository.xh"
15
#include "ThePEG/Interface/InterfaceBase.fh"
16
#include "ThePEG/Interface/ClassDocumentation.fh"
17
#include "ThePEG/Interface/InterfacedBase.h"
18
#include "ThePEG/Utilities/ClassDescription.fh"
19
20
namespace
ThePEG {
21
45
class
BaseRepository
{
46
47
public
:
48
50
typedef
StringSet
DirectorySet
;
51
53
typedef
vector<string>
StringVector
;
54
56
typedef
set<const InterfaceBase *>
InterfaceSet
;
57
60
typedef
map<const ClassDescriptionBase *, InterfaceSet>
TypeInterfaceMap
;
61
64
typedef
map<const ClassDescriptionBase *, const ClassDocumentationBase *>
65
TypeDocumentationMap
;
66
67
public
:
68
75
static
string
exec
(
string
cmd, ostream &);
76
83
static
void
Register
(
const
InterfaceBase
&,
const
type_info &);
84
90
static
void
Register
(
const
ClassDocumentationBase
&,
const
type_info &);
91
98
static
void
Register
(
IBPtr
);
99
106
static
void
Register
(
IBPtr
,
string
name);
107
112
static
void
remove
(
tIBPtr
);
113
120
static
string
remove
(
const
ObjectSet & rmset);
121
126
static
void
rename
(
tIBPtr
object
,
string
newName);
128
137
static
void
CreateDirectory
(
string
);
138
151
static
void
CheckObjectDirectory
(
string
);
152
163
static
void
CheckDirectory
(
string
);
164
171
static
void
DirectoryAppend
(
string
&);
172
180
static
void
ChangeDirectory
(
string
name);
181
189
static
void
PushDirectory
(
string
name);
190
195
static
void
PopDirectory
();
196
200
static
vector<string> &
globalLibraries
();
201
203
206
protected
:
207
211
static
stack<string> &
currentReadDirStack
();
212
216
static
vector<string> &
readDirs
();
217
218
public
:
219
223
static
void
prependReadDir
(
string
);
224
228
static
void
appendReadDir
(
string
);
229
231
239
template
<
typename
T>
240
static
typename
Ptr<T>::pointer
GetPtr
(
const
T &);
241
247
template
<
typename
PtrType>
248
static
PtrType
GetPtr
(
string
);
249
258
template
<
typename
PtrType>
259
static
PtrType
GetObject
(
string
);
260
265
static
IBPtr
GetPointer
(
string
);
266
271
static
IVector
SearchDirectory
(
string
name,
string
className =
""
);
272
282
static
IBPtr
TraceObject
(
string
name);
283
288
static
string
GetInterfacedBaseClasses
(
const
ClassDescriptionBase
* cdb);
289
296
static
IBPtr
getObjectFromNoun
(
string
noun);
298
305
static
IVector
GetObjectsReferringTo
(
IBPtr
);
306
311
static
IVector
DirectReferences
(
IBPtr
);
312
319
static
void
addReferences
(
tIBPtr
obj, ObjectSet & refs);
321
332
static
InterfaceMap
getInterfaces
(
const
type_info & ti,
bool
all =
true
);
333
337
static
const
InterfaceBase
*
FindInterface
(
IBPtr
object
,
string
name);
338
345
static
string
getInterfaceFromNoun
(
string
noun);
346
353
static
string
getPosArgFromNoun
(
string
noun);
354
359
template
<
typename
Cont>
360
static
vector< pair<IBPtr, const InterfaceBase *> >
361
getNonDefaultInterfaces
(
const
Cont &);
362
364
370
static
void
update
();
371
376
template
<
typename
Cont>
377
static
void
clearAll
(
const
Cont & c)
378
{
379
for_each
(c, mem_fun(&
InterfacedBase::clear
));
380
}
381
386
template
<
typename
Cont>
387
static
void
resetAll
(
const
Cont & c)
388
{
389
for_each
(c, mem_fun(&
InterfacedBase::reset
));
390
}
391
396
static
void
readSetup
(
tIBPtr
ip, istream & is);
397
402
static
void
lock
(
tIBPtr
ip) { ip->lock(); }
403
408
static
void
unlock
(
tIBPtr
ip) { ip->unlock(); }
410
416
static
const
ClassDocumentationBase
*
getDocumentation
(
tcIBPtr
ip);
417
422
static
string
getModelDescription
(
tcIBPtr
ip);
423
428
static
string
getModelReferences
(
tcIBPtr
ip);
430
436
static
void
cout
(ostream & os) {
coutp
() = &os; }
437
441
static
ostream &
cout
() {
return
*
coutp
(); }
442
446
static
void
cerr
(ostream & os) {
cerrp
() = &os; }
447
451
static
ostream &
cerr
() {
return
*
cerrp
(); }
452
456
static
void
clog
(ostream & os) {
clogp
() = &os; }
457
461
static
ostream &
clog
() {
return
*
clogp
(); }
463
464
protected
:
465
473
template
<
typename
T>
474
static
typename
Ptr<T>::pointer
clone
(
const
T & t);
475
481
template
<
typename
T>
482
static
typename
Ptr<T>::pointer
fullclone
(
const
T & t);
483
492
static
void
rebind
(
InterfacedBase
& obj,
const
TranslationMap
& trans,
493
const
IVector
& defaults);
495
496
501
static
void
addInterfaces
(
const
ClassDescriptionBase
&,
502
InterfaceMap &,
bool
all =
true
);
503
510
static
ObjectMap &
objects
();
511
515
static
ObjectSet &
allObjects
();
516
521
static
TypeInterfaceMap
&
interfaces
();
522
527
static
TypeDocumentationMap
&
documentations
();
528
532
static
DirectorySet
&
directories
();
533
537
static
StringVector
&
directoryStack
();
538
542
static
bool
&
updating
();
543
547
static
ostream *&
coutp
();
548
552
static
ostream *&
cerrp
();
556
static
ostream *&
clogp
();
558
559
};
560
561
562
}
563
564
#ifndef ThePEG_TEMPLATES_IN_CC_FILE
565
#include "BaseRepository.tcc"
566
#endif
567
568
#endif
/* ThePEG_BaseRepository_H */
Generated on Mon Jul 2 2012 16:06:46 for ThePEG by
1.8.1.1