thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Persistency
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
38
ThePEG_DECLARE_POINTERS
(
PersistentBase
,
BPtr
);
39
40
public
:
41
47
InputDescription
(
string
newName,
int
newVersion)
48
:
Named
(newName),
theDescription
(0),
theVersion
(newVersion) {}
49
53
void
setDescription
(
const
ClassDescriptionBase
* cd) {
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
{
90
if
(
theDescription
)
theDescription
->
input
(b, is,
theVersion
);
91
}
92
93
private
:
94
98
DescriptionVector
theBaseClasses
;
99
104
const
ClassDescriptionBase
*
theDescription
;
105
109
int
theVersion
;
110
111
};
112
113
}
114
115
#endif
/* ThePEG_InputDescription_H */
ThePEG_DECLARE_POINTERS
#define ThePEG_DECLARE_POINTERS(full, abbrev)
This macro helps us to declare pointers and stuff to standard classes.
Definition:
Pointers.h:47
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::ClassDescriptionBase
ClassDescriptionBase is the base class for all class description classes.
Definition:
ClassDescription.h:63
ThePEG::ClassDescriptionBase::input
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.
ThePEG::ClassDescriptionBase::create
virtual BPtr create() const =0
Create an object of the described class.
ThePEG::InputDescription
InputDescription objects are used by the PersistentIStream class to keep track of all classes it has ...
Definition:
InputDescription.h:31
ThePEG::InputDescription::addBaseClass
void addBaseClass(const InputDescription *newBase)
Add a base class description.
Definition:
InputDescription.h:60
ThePEG::InputDescription::InputDescription
InputDescription(string newName, int newVersion)
The standard constructor.
Definition:
InputDescription.h:47
ThePEG::InputDescription::descriptions
const DescriptionVector & descriptions() const
Return the list of base class descriptions.
Definition:
InputDescription.h:67
ThePEG::InputDescription::input
void input(tBPtr b, PersistentIStream &is) const
Read an object part of the corresponding class from a stream.
Definition:
InputDescription.h:89
ThePEG::InputDescription::theDescription
const ClassDescriptionBase * theDescription
The description of the corresponding class in the current program.
Definition:
InputDescription.h:104
ThePEG::InputDescription::BPtr
ThePEG::Ptr< PersistentBase >::pointer BPtr
Alias for a reference counted pointer to PersistentBase .
Definition:
InputDescription.h:38
ThePEG::InputDescription::theVersion
int theVersion
The version of the class to be read.
Definition:
InputDescription.h:109
ThePEG::InputDescription::DescriptionVector
vector< const InputDescription * > DescriptionVector
A vector of pointers to InputDescription objects.
Definition:
InputDescription.h:36
ThePEG::InputDescription::setDescription
void setDescription(const ClassDescriptionBase *cd)
Set the ClassDescriptionBase object of the class being read.
Definition:
InputDescription.h:53
ThePEG::InputDescription::theBaseClasses
DescriptionVector theBaseClasses
The list of base class descriptions.
Definition:
InputDescription.h:98
ThePEG::InputDescription::create
BPtr create() const
Create an object of the corresponding class.
Definition:
InputDescription.h:74
ThePEG::Named
The Named class is a simple concrete base class to used by classes of objects with a name.
Definition:
Named.h:24
ThePEG::PersistentIStream
PersistentIStream is used to read persistent objects from a stream where they were previously written...
Definition:
PersistentIStream.h:48
ThePEG::Pointer::RCPtr
RCPtr is a reference counted (smart) pointer.
Definition:
RCPtr.h:60
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
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::Base
Define the base class from which all (polymorphic) classes in ThePEG are derived.
Definition:
ThePEG.h:54
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6