thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
InputDescription.h
1// -*- C++ -*-
2//
3// InputDescription.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_InputDescription_H
10#define ThePEG_InputDescription_H
11// This is the declaration of the InputDescription class.
12
14#include "ThePEG/Utilities/ClassDescription.h"
15
16namespace ThePEG {
17
31class InputDescription: public Named {
32
33public:
34
36 typedef vector<const InputDescription *> DescriptionVector;
37
39
40public:
41
47 InputDescription(string newName, int newVersion)
48 : Named(newName), theDescription(0), theVersion(newVersion) {}
49
54 theDescription = cd;
55 }
56
60 void addBaseClass(const InputDescription * newBase) {
61 theBaseClasses.push_back(newBase);
62 }
63
68 return theBaseClasses;
69 }
70
74 BPtr create() const {
75 if ( theDescription ) return theDescription->create();
76 DescriptionVector::const_iterator dit = theBaseClasses.begin();
77 while ( dit != theBaseClasses.end() ) {
78 BPtr obj = (*dit++)->create();
79 if ( obj ) return obj;
80 }
81 return BPtr();
82 }
83
89 void input(tBPtr b, PersistentIStream & is) const {
91 }
92
93private:
94
99
105
110
111};
112
113}
114
115#endif /* ThePEG_InputDescription_H */
#define ThePEG_DECLARE_POINTERS(full, abbrev)
This macro helps us to declare pointers and stuff to standard classes.
Definition: Pointers.h:47
This is the main config header file for ThePEG.
ClassDescriptionBase is the base class for all class description classes.
virtual void input(tBPtr b, PersistentIStream &is, int oldVersion) const =0
Read the members of an object of the described class from a persistent stream.
virtual BPtr create() const =0
Create an object of the described class.
InputDescription objects are used by the PersistentIStream class to keep track of all classes it has ...
void addBaseClass(const InputDescription *newBase)
Add a base class description.
InputDescription(string newName, int newVersion)
The standard constructor.
const DescriptionVector & descriptions() const
Return the list of base class descriptions.
void input(tBPtr b, PersistentIStream &is) const
Read an object part of the corresponding class from a stream.
const ClassDescriptionBase * theDescription
The description of the corresponding class in the current program.
ThePEG::Ptr< PersistentBase >::pointer BPtr
Alias for a reference counted pointer to PersistentBase .
int theVersion
The version of the class to be read.
vector< const InputDescription * > DescriptionVector
A vector of pointers to InputDescription objects.
void setDescription(const ClassDescriptionBase *cd)
Set the ClassDescriptionBase object of the class being read.
DescriptionVector theBaseClasses
The list of base class descriptions.
BPtr create() const
Create an object of the corresponding class.
The Named class is a simple concrete base class to used by classes of objects with a name.
Definition: Named.h:24
PersistentIStream is used to read persistent objects from a stream where they were previously written...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
Define the base class from which all (polymorphic) classes in ThePEG are derived.
Definition: ThePEG.h:54