thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
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 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "ThePEG/Utilities/ClassDescription.h"
15 
16 namespace ThePEG {
17 
31 class InputDescription: public Named {
32 
33 public:
34 
36  typedef vector<const InputDescription *> DescriptionVector;
37 
39 
40 public:
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 
67  const DescriptionVector & descriptions() const {
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 
93 private:
94 
98  DescriptionVector theBaseClasses;
99 
105 
110 
111 };
112 
113 }
114 
115 #endif /* ThePEG_InputDescription_H */
PersistentIStream is used to read persistent objects from a stream where they were previously written...
virtual BPtr create() const =0
Create an object of the described class.
ClassDescriptionBase is the base class for all class description classes.
Define the base class from which all (polymorphic) classes in ThePEG are derived. ...
Definition: ThePEG.h:54
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
InputDescription(string newName, int newVersion)
The standard constructor.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
The Named class is a simple concrete base class to used by classes of objects with a name...
Definition: Named.h:24
This is the main config header file for ThePEG.
void setDescription(const ClassDescriptionBase *cd)
Set the ClassDescriptionBase object of the class being read.
const ClassDescriptionBase * theDescription
The description of the corresponding class in the current program.
int theVersion
The version of the class to be read.
ThePEG::Ptr< PersistentBase >::pointer BPtr
Alias for a reference counted pointer to PersistentBase .
vector< const InputDescription * > DescriptionVector
A vector of pointers to InputDescription objects.
void input(tBPtr b, PersistentIStream &is) const
Read an object part of the corresponding class from a stream.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
InputDescription objects are used by the PersistentIStream class to keep track of all classes it has ...
#define ThePEG_DECLARE_POINTERS(full, abbrev)
This macro helps us to declare pointers and stuff to standard classes.
Definition: Pointers.h:47
DescriptionVector theBaseClasses
The list of base class descriptions.
const DescriptionVector & descriptions() const
Return the list of base class descriptions.
BPtr create() const
Create an object of the corresponding class.
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.
void addBaseClass(const InputDescription *newBase)
Add a base class description.