thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Repository
BaseRepository.h
1
// -*- C++ -*-
2
//
3
// BaseRepository.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2019 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 3 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
const
vector<string> &
listReadDirs
();
224
228
static
void
prependReadDir
(
string
);
229
233
static
void
prependReadDir
(
const
std::vector<std::string>& dirs);
234
238
static
void
appendReadDir
(
string
);
239
243
static
void
appendReadDir
(
const
std::vector<std::string>& dirs);
244
246
254
template
<
typename
T>
255
static
typename
Ptr<T>::pointer
GetPtr
(
const
T &);
256
262
template
<
typename
PtrType>
263
static
PtrType
GetPtr
(
string
);
264
273
template
<
typename
PtrType>
274
static
PtrType
GetObject
(
string
);
275
280
static
IBPtr
GetPointer
(
string
);
281
286
static
IVector
SearchDirectory
(
string
name,
string
className =
""
);
287
297
static
IBPtr
TraceObject
(
string
name);
298
303
static
string
GetInterfacedBaseClasses
(
const
ClassDescriptionBase
* cdb);
304
311
static
IBPtr
getObjectFromNoun
(
string
noun);
313
320
static
IVector
GetObjectsReferringTo
(
IBPtr
);
321
326
static
IVector
DirectReferences
(
IBPtr
);
327
334
static
void
addReferences
(
tIBPtr
obj, ObjectSet & refs);
336
347
static
InterfaceMap
getInterfaces
(
const
type_info & ti,
bool
all =
true
);
348
352
static
const
InterfaceBase
*
FindInterface
(
IBPtr
object
,
string
name);
353
360
static
string
getInterfaceFromNoun
(
string
noun);
361
368
static
string
getPosArgFromNoun
(
string
noun);
369
374
template
<
typename
Cont>
375
static
vector< pair<IBPtr, const InterfaceBase *> >
376
getNonDefaultInterfaces
(
const
Cont &);
377
379
385
static
void
update
();
386
391
template
<
typename
Cont>
392
static
void
clearAll
(
const
Cont & c)
393
{
394
for_each
(c, mem_fn(&
InterfacedBase::clear
));
395
}
396
401
template
<
typename
Cont>
402
static
void
resetAll
(
const
Cont & c)
403
{
404
for_each
(c, mem_fn(&
InterfacedBase::reset
));
405
}
406
411
static
void
readSetup
(
tIBPtr
ip, istream & is);
412
417
static
void
lock
(
tIBPtr
ip) { ip->lock(); }
418
423
static
void
unlock
(
tIBPtr
ip) { ip->unlock(); }
425
431
static
const
ClassDocumentationBase
*
getDocumentation
(
tcIBPtr
ip);
432
437
static
string
getModelDescription
(
tcIBPtr
ip);
438
443
static
string
getModelReferences
(
tcIBPtr
ip);
445
451
static
void
cout
(ostream & os) {
coutp
() = &os; }
452
456
static
ostream &
cout
() {
return
*
coutp
(); }
457
461
static
void
cerr
(ostream & os) {
cerrp
() = &os; }
462
466
static
ostream &
cerr
() {
return
*
cerrp
(); }
467
471
static
void
clog
(ostream & os) {
clogp
() = &os; }
472
476
static
ostream &
clog
() {
return
*
clogp
(); }
478
479
protected
:
480
488
template
<
typename
T>
489
static
typename
Ptr<T>::pointer
clone
(
const
T & t);
490
496
template
<
typename
T>
497
static
typename
Ptr<T>::pointer
fullclone
(
const
T & t);
498
507
static
void
rebind
(
InterfacedBase
& obj,
const
TranslationMap
& trans,
508
const
IVector
& defaults);
510
511
516
static
void
addInterfaces
(
const
ClassDescriptionBase
&,
517
InterfaceMap &,
bool
all =
true
);
518
525
static
ObjectMap &
objects
();
526
530
static
ObjectSet &
allObjects
();
531
536
static
TypeInterfaceMap
&
interfaces
();
537
542
static
TypeDocumentationMap
&
documentations
();
543
547
static
DirectorySet
&
directories
();
548
552
static
StringVector
&
directoryStack
();
553
557
static
bool
&
updating
();
558
562
static
ostream *&
coutp
();
563
567
static
ostream *&
cerrp
();
571
static
ostream *&
clogp
();
573
574
};
575
576
577
}
578
579
#ifndef ThePEG_TEMPLATES_IN_CC_FILE
580
#include "BaseRepository.tcc"
581
#endif
582
583
#endif
/* ThePEG_BaseRepository_H */
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::BaseRepository
BaseRepository is a purely static class which keeps a set of InterfacedBase objects indexed by their ...
Definition:
BaseRepository.h:45
ThePEG::BaseRepository::cout
static ostream & cout()
Get the standard output stream.
Definition:
BaseRepository.h:456
ThePEG::BaseRepository::remove
static string remove(const ObjectSet &rmset)
Remove objects.
ThePEG::BaseRepository::remove
static void remove(tIBPtr)
Remove the given object from the repository.
ThePEG::BaseRepository::getDocumentation
static const ClassDocumentationBase * getDocumentation(tcIBPtr ip)
Return the class documentation of a given object.
ThePEG::BaseRepository::directoryStack
static StringVector & directoryStack()
The current directory stack.
ThePEG::BaseRepository::readDirs
static vector< string > & readDirs()
List of directories to search for files for the "read" command.
ThePEG::BaseRepository::CheckDirectory
static void CheckDirectory(string)
Check if directory exixts.
ThePEG::BaseRepository::fullclone
static Ptr< T >::pointer fullclone(const T &t)
Return a clone of the given object.
ThePEG::BaseRepository::Register
static void Register(IBPtr, string name)
Register a new object giving it a new name.
ThePEG::BaseRepository::cout
static void cout(ostream &os)
Set the standard output stream.
Definition:
BaseRepository.h:451
ThePEG::BaseRepository::clone
static Ptr< T >::pointer clone(const T &t)
Return a clone of the given object.
ThePEG::BaseRepository::directories
static DirectorySet & directories()
All defined directories.
ThePEG::BaseRepository::exec
static string exec(string cmd, ostream &)
Interpret the command in cmd and return possible messages.
ThePEG::BaseRepository::update
static void update()
Call the InterfacedBase::update() function of all objects.
ThePEG::BaseRepository::clogp
static ostream *& clogp()
The current current standard log stream.
ThePEG::BaseRepository::documentations
static TypeDocumentationMap & documentations()
Sets of ClassDocumentationBase objects mapped to the class description of the class for which they ar...
ThePEG::BaseRepository::clog
static ostream & clog()
Get the standard log stream.
Definition:
BaseRepository.h:476
ThePEG::BaseRepository::getInterfaces
static InterfaceMap getInterfaces(const type_info &ti, bool all=true)
Get interfaces.
ThePEG::BaseRepository::DirectReferences
static IVector DirectReferences(IBPtr)
Get direct references.
ThePEG::BaseRepository::GetObjectsReferringTo
static IVector GetObjectsReferringTo(IBPtr)
Get referring objects.
ThePEG::BaseRepository::coutp
static ostream *& coutp()
The current current standard output stream.
ThePEG::BaseRepository::interfaces
static TypeInterfaceMap & interfaces()
Sets of InterfaceBase objects mapped to the class description of the class for which they are defined...
ThePEG::BaseRepository::getInterfaceFromNoun
static string getInterfaceFromNoun(string noun)
Get an interface name.
ThePEG::BaseRepository::GetInterfacedBaseClasses
static string GetInterfacedBaseClasses(const ClassDescriptionBase *cdb)
Return a string containing the name of the given class description and its base classes,...
ThePEG::BaseRepository::cerrp
static ostream *& cerrp()
The current current standard error stream.
ThePEG::BaseRepository::rebind
static void rebind(InterfacedBase &obj, const TranslationMap &trans, const IVector &defaults)
Rebind references.
ThePEG::BaseRepository::prependReadDir
static void prependReadDir(const std::vector< std::string > &dirs)
Add a string vector with directories to readDirs().
ThePEG::BaseRepository::lock
static void lock(tIBPtr ip)
Lock the given object.
Definition:
BaseRepository.h:417
ThePEG::BaseRepository::DirectorySet
StringSet DirectorySet
A set of strings.
Definition:
BaseRepository.h:50
ThePEG::BaseRepository::allObjects
static ObjectSet & allObjects()
All InterfacedBase objects.
ThePEG::BaseRepository::clearAll
static void clearAll(const Cont &c)
Clear the InterfacedBase::touched() flag in all objects in the given container.
Definition:
BaseRepository.h:392
ThePEG::BaseRepository::appendReadDir
static void appendReadDir(const std::vector< std::string > &dirs)
Add a string vector with directories to readDirs().
ThePEG::BaseRepository::Register
static void Register(IBPtr)
Register a new object using the its current name.
ThePEG::BaseRepository::PopDirectory
static void PopDirectory()
Pop the directory stack.
ThePEG::BaseRepository::GetPtr
static Ptr< T >::pointer GetPtr(const T &)
Return a reference counted pointer to the given object.
ThePEG::BaseRepository::getModelDescription
static string getModelDescription(tcIBPtr ip)
Get the description for the model implemented in the class of the given object.
ThePEG::BaseRepository::CheckObjectDirectory
static void CheckObjectDirectory(string)
Check if directory exixts.
ThePEG::BaseRepository::DirectoryAppend
static void DirectoryAppend(string &)
Return the absolute path.
ThePEG::BaseRepository::clog
static void clog(ostream &os)
Set the standard log stream.
Definition:
BaseRepository.h:471
ThePEG::BaseRepository::appendReadDir
static void appendReadDir(string)
Add a directory to readDirs().
ThePEG::BaseRepository::PushDirectory
static void PushDirectory(string name)
Set the current directory to name.
ThePEG::BaseRepository::addReferences
static void addReferences(tIBPtr obj, ObjectSet &refs)
Get all references.
ThePEG::BaseRepository::getPosArgFromNoun
static string getPosArgFromNoun(string noun)
Get interface index.
ThePEG::BaseRepository::CreateDirectory
static void CreateDirectory(string)
Create a new directory with the given name.
ThePEG::BaseRepository::TypeInterfaceMap
map< const ClassDescriptionBase *, InterfaceSet > TypeInterfaceMap
A map of sets of IterfaceBase objects indexed by pointers to ClassDescriptionBase objects.
Definition:
BaseRepository.h:60
ThePEG::BaseRepository::StringVector
vector< string > StringVector
A vector of character strings.
Definition:
BaseRepository.h:53
ThePEG::BaseRepository::readSetup
static void readSetup(tIBPtr ip, istream &is)
Setup an object.
ThePEG::BaseRepository::GetPtr
static PtrType GetPtr(string)
Return a pointer of the specified type to an object with the given name.
ThePEG::BaseRepository::ChangeDirectory
static void ChangeDirectory(string name)
Set the current directory to name.
ThePEG::BaseRepository::globalLibraries
static vector< string > & globalLibraries()
A list of all globally loaded libraries.
ThePEG::BaseRepository::Register
static void Register(const ClassDocumentationBase &, const type_info &)
Register a class documentation.
ThePEG::BaseRepository::TraceObject
static IBPtr TraceObject(string name)
Find an object.
ThePEG::BaseRepository::SearchDirectory
static IVector SearchDirectory(string name, string className="")
Return all objects in the directory name.
ThePEG::BaseRepository::prependReadDir
static void prependReadDir(string)
Add a directory to readDirs().
ThePEG::BaseRepository::updating
static bool & updating()
Flag to say if we are in the middle of an update procedure.
ThePEG::BaseRepository::unlock
static void unlock(tIBPtr ip)
Unlock the given object.
Definition:
BaseRepository.h:423
ThePEG::BaseRepository::cerr
static void cerr(ostream &os)
Set the standard error stream.
Definition:
BaseRepository.h:461
ThePEG::BaseRepository::InterfaceSet
set< const InterfaceBase * > InterfaceSet
A set of pointers to InterfaceBase objects.
Definition:
BaseRepository.h:56
ThePEG::BaseRepository::getNonDefaultInterfaces
static vector< pair< IBPtr, const InterfaceBase * > > getNonDefaultInterfaces(const Cont &)
Return a list of the interfaces which do not have their default values for the given objects.
ThePEG::BaseRepository::cerr
static ostream & cerr()
Get the standard error stream.
Definition:
BaseRepository.h:466
ThePEG::BaseRepository::FindInterface
static const InterfaceBase * FindInterface(IBPtr object, string name)
Return an interface with the given name to the given object.
ThePEG::BaseRepository::getObjectFromNoun
static IBPtr getObjectFromNoun(string noun)
Get an object.
ThePEG::BaseRepository::GetPointer
static IBPtr GetPointer(string)
Return a pointer to an object with the given name or null if no such object exists.
ThePEG::BaseRepository::addInterfaces
static void addInterfaces(const ClassDescriptionBase &, InterfaceMap &, bool all=true)
Add interfaces to the given map for the class with the given class description.
ThePEG::BaseRepository::currentReadDirStack
static stack< string > & currentReadDirStack()
The stack of directories used by the "read" command.
ThePEG::BaseRepository::objects
static ObjectMap & objects()
All InterfacedBase objects mapped to their name.
ThePEG::BaseRepository::listReadDirs
static const vector< string > & listReadDirs()
Access to list of directories to search for files for the "read" command.
ThePEG::BaseRepository::GetObject
static PtrType GetObject(string)
Return a pointer of the specified type to an object with the given name.
ThePEG::BaseRepository::rename
static void rename(tIBPtr object, string newName)
Rename a given object.
ThePEG::BaseRepository::TypeDocumentationMap
map< const ClassDescriptionBase *, const ClassDocumentationBase * > TypeDocumentationMap
A map of ClassDocumentationBase objects indexed by pointers to ClassDescriptionBase objects.
Definition:
BaseRepository.h:65
ThePEG::BaseRepository::Register
static void Register(const InterfaceBase &, const type_info &)
Register an interface.
ThePEG::BaseRepository::resetAll
static void resetAll(const Cont &c)
Set the status of all objects in the given container to InterfacedBase::uninitialized.
Definition:
BaseRepository.h:402
ThePEG::BaseRepository::getModelReferences
static string getModelReferences(tcIBPtr ip)
Get the references for the model implemented in the class of the given object.
ThePEG::ClassDescriptionBase
ClassDescriptionBase is the base class for all class description classes.
Definition:
ClassDescription.h:63
ThePEG::ClassDocumentationBase
The ClassDocumentationBase class is used to communicate documetation about an Interfaced class to the...
Definition:
ClassDocumentation.h:48
ThePEG::InterfaceBase
The InterfaceBase class defines a generic interface to any class derived from the InterfacedBase clas...
Definition:
InterfaceBase.h:59
ThePEG::InterfacedBase
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class.
Definition:
InterfacedBase.h:45
ThePEG::InterfacedBase::clear
void clear()
Calls reset() and unTouch().
Definition:
InterfacedBase.h:290
ThePEG::InterfacedBase::reset
void reset()
Set the state of this object to uninitialized.
Definition:
InterfacedBase.h:285
ThePEG::Pointer::RCPtr
RCPtr is a reference counted (smart) pointer.
Definition:
RCPtr.h:60
ThePEG::Pointer::TransientConstRCPtr
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition:
RCPtr.h:696
ThePEG::Pointer::TransientRCPtr
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition:
RCPtr.h:519
ThePEG::Rebinder
Rebinder is a class associating pairs of pointers to objects.
Definition:
Rebinder.h:27
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::IVector
vector< IBPtr > IVector
A vector of pointers to InterfacedBase objects.
Definition:
Containers.h:67
ThePEG::for_each
FNC for_each(IteratorRange< Iterator > r, FNC f)
The std::for_each function taking an IteratorRange as argument.
Definition:
algorithm.h:79
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6