thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
DescriptionList.h
1// -*- C++ -*-
2//
3// DescriptionList.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_DescriptionList_H
10#define ThePEG_DescriptionList_H
11// This is the declaration of the DescriptionList class.
12
14#include "ClassDescription.fh"
15
16namespace ThePEG {
17
23
24public:
25
26#ifndef THEPEG_DYNAMIC_TYPE_INFO_BUG
28 typedef map<const type_info *, ClassDescriptionBase *> DescriptionMap;
29#else
31 typedef map<string, ClassDescriptionBase *> DescriptionMap;
32#endif
33
36 typedef map<string, ClassDescriptionBase *> StringMap;
37
38public:
39
44
48 static inline const ClassDescriptionBase * find(const type_info & ti) {
49#ifndef THEPEG_DYNAMIC_TYPE_INFO_BUG
50 DescriptionMap::const_iterator it = descriptionMap().find(&ti);
51#else
52 DescriptionMap::const_iterator it = descriptionMap().find(ti.name());
53#endif
54 if ( it == descriptionMap().end() ) return 0;
55 return (*it).second;
56 }
57
61 static string className(const type_info & ti);
62
66 static int version(const type_info & ti);
67
72 static string library(const type_info & ti);
73
77 static inline const ClassDescriptionBase * find(const string & name) {
78 StringMap::const_iterator it = stringMap().find(name);
79 if ( it == stringMap().end() ) return 0;
80 return it->second;
81 }
82
87 static inline const DescriptionMap & all() { return descriptionMap(); }
88
93 static void printHierarchies(ostream & os);
94
95protected:
96
100 static void hookup();
101
105 static void insert(ClassDescriptionBase & pb);
106
113
120
121};
122
123}
124
125#endif /* ThePEG_DescriptionList_H */
This is the main config header file for ThePEG.
ClassDescriptionBase is the base class for all class description classes.
The DescriptionList keeps a static list of descriptions of classes included in the current run.
static void insert(ClassDescriptionBase &pb)
Insert a class description.
static string library(const type_info &ti)
Return the dynamic library of the class corresponding to the given type_info object.
static void hookup()
Hookup the base class descriptions in the list.
static const ClassDescriptionBase * find(const type_info &ti)
Get the description of a class giving its type_info object.
map< string, ClassDescriptionBase * > StringMap
Map of class descriptions indexed by platform-independent class names.
static StringMap & stringMap()
Return the static set of descriptions mapped to the corresponding class names.
static int version(const type_info &ti)
Return the version of the class corresponding to the given type_info object.
static string className(const type_info &ti)
Return the name of the class corresponding to the given type_info object.
map< const type_info *, ClassDescriptionBase * > DescriptionMap
Map of class descriptions indexed by type_info objects.
static const ClassDescriptionBase * find(const string &name)
Get the description of a class giving its name.
static void printHierarchies(ostream &os)
Print the classes in the list and their base classes to a stream.
static void Register(ClassDescriptionBase &)
Insert a description in the list.
static const DescriptionMap & all()
Return the static set of descriptions mapped to the relevant type_info objects.
static DescriptionMap & descriptionMap()
Return the static set of descriptions mapped to the relevant type_info objects.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28