thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Interface
Interfaced.h
1
// -*- C++ -*-
2
//
3
// Interfaced.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_Interfaced_H
10
#define ThePEG_Interfaced_H
11
// This is the declaration of the Interfaced class.
12
13
#include "
ThePEG/Config/ThePEG.h
"
14
#include "InterfacedBase.h"
15
#include "ThePEG/PDT/PID.h"
16
17
namespace
ThePEG
{
18
38
class
Interfaced
:
public
InterfacedBase
{
39
41
friend
class
Repository
;
42
44
friend
class
EventGenerator
;
45
46
public
:
47
51
virtual
~Interfaced
();
52
57
public
:
58
68
virtual
bool
defaultInit
();
69
76
PPtr
getParticle
(
PID
)
const
;
77
82
PDPtr
getParticleData
(
PID
)
const
;
83
87
bool
used
()
const
{
return
theUseFlag
; }
88
93
void
useMe
()
const
{
if
( !
used
() )
setUsed
(); }
94
99
tEGPtr
generator
()
const
{
return
theGenerator
; }
101
102
public
:
103
110
void
persistentOutput
(
PersistentOStream
& os)
const
;
111
117
void
persistentInput
(
PersistentIStream
& is,
int
version);
119
123
static
void
Init
();
124
125
protected
:
126
130
static
void
registerRepository
(
IBPtr
);
131
136
static
void
registerRepository
(
IBPtr
,
string
newName);
137
145
void
reporeg
(
IBPtr
object
,
string
name
)
const
;
146
153
template
<
typename
PtrT>
154
bool
setDefaultReference
(PtrT & ptr,
string
classname,
string
objectname) {
155
if
( ptr )
return
true
;
156
const
ClassDescriptionBase
* db =
DescriptionList::find
(classname);
157
if
( !db )
return
false
;
158
ptr = dynamic_ptr_cast<PtrT>(db->
create
());
159
if
( !ptr )
return
false
;
160
reporeg
(ptr, objectname);
161
if
( !ptr->defaultInit() )
return
false
;
162
return
true
;
163
}
164
168
Interfaced
() :
theUseFlag
(false) {}
169
173
Interfaced
(
const
string
& newName)
174
:
InterfacedBase
(newName),
theUseFlag
(false) {}
175
179
Interfaced
(
const
Interfaced
& i)
180
:
InterfacedBase
(i),
theGenerator
(i.
theGenerator
),
theUseFlag
(false) {}
181
182
protected
:
183
188
void
setGenerator
(
tEGPtr
generator
) {
theGenerator
=
generator
; }
189
190
private
:
191
195
void
setUsed
()
const
;
196
200
tEGPtr
theGenerator
;
201
205
mutable
bool
theUseFlag
;
206
210
string
doDefaultInit
(
string
);
211
212
private
:
213
217
static
AbstractClassDescription<Interfaced>
initInterfaced
;
218
222
Interfaced
&
operator=
(
const
Interfaced
&) =
delete
;
223
224
};
225
232
template
<>
233
struct
BaseClassTrait
<
Interfaced
,1>:
public
ClassTraitsType
{
235
typedef
InterfacedBase
NthBase
;
236
};
237
242
template
<>
243
struct
ClassTraits<Interfaced>:
public
ClassTraitsBase<Interfaced> {
245
static
string
className
() {
return
"ThePEG::Interfaced"
; }
246
};
247
250
}
251
252
#endif
/* ThePEG_Interfaced_H */
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::AbstractClassDescription
A concreate implementation of ClassDescriptionBase describing an abstract class with persistent data.
Definition:
ClassDescription.h:282
ThePEG::ClassDescriptionBase
ClassDescriptionBase is the base class for all class description classes.
Definition:
ClassDescription.h:63
ThePEG::ClassDescriptionBase::create
virtual BPtr create() const =0
Create an object of the described class.
ThePEG::DescriptionList::find
static const ClassDescriptionBase * find(const type_info &ti)
Get the description of a class giving its type_info object.
Definition:
DescriptionList.h:48
ThePEG::EventGenerator
The EventGenerator class manages a whole event generator run.
Definition:
EventGenerator.h:68
ThePEG::InterfacedBase
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class.
Definition:
InterfacedBase.h:45
ThePEG::InterfacedBase::name
string name() const
Returns the name of this object, without the path.
Definition:
InterfacedBase.h:88
ThePEG::Interfaced
The Interfaced class is derived from the InterfacedBase class adding a couple of things particular to...
Definition:
Interfaced.h:38
ThePEG::Interfaced::useMe
void useMe() const
Should be called to indicate that this object has actually been used.
Definition:
Interfaced.h:93
ThePEG::Interfaced::initInterfaced
static AbstractClassDescription< Interfaced > initInterfaced
Standard Initialization object.
Definition:
Interfaced.h:217
ThePEG::Interfaced::used
bool used() const
Returns true if this object has actally been used.
Definition:
Interfaced.h:87
ThePEG::Interfaced::persistentOutput
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
ThePEG::Interfaced::reporeg
void reporeg(IBPtr object, string name) const
Register the given object in the Repository with the given name in a subdirectory with the same name ...
ThePEG::Interfaced::Interfaced
Interfaced(const Interfaced &i)
Protected copy-constructor.
Definition:
Interfaced.h:179
ThePEG::Interfaced::getParticleData
PDPtr getParticleData(PID) const
Return a pointer to the ParticleData object corresponding to the given id number.
ThePEG::Interfaced::persistentInput
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
ThePEG::Interfaced::Interfaced
Interfaced(const string &newName)
Protected constructor taking a name as argument.
Definition:
Interfaced.h:173
ThePEG::Interfaced::Interfaced
Interfaced()
Protected default constructor.
Definition:
Interfaced.h:168
ThePEG::Interfaced::theUseFlag
bool theUseFlag
Flag to tell whether this object has been used or not.
Definition:
Interfaced.h:205
ThePEG::Interfaced::registerRepository
static void registerRepository(IBPtr, string newName)
Register an Interfaced object with the Repository, giving it a name.
ThePEG::Interfaced::~Interfaced
virtual ~Interfaced()
Empty virtual destructor.
ThePEG::Interfaced::Init
static void Init()
Standard Init function.
ThePEG::Interfaced::theGenerator
tEGPtr theGenerator
A pointer to the EventGenerator controlling the run.
Definition:
Interfaced.h:200
ThePEG::Interfaced::getParticle
PPtr getParticle(PID) const
Create a new Particle instance given a id number.
ThePEG::Interfaced::setUsed
void setUsed() const
Used internally by 'useMe'.
ThePEG::Interfaced::registerRepository
static void registerRepository(IBPtr)
Register an Interfaced object with the Repository.
ThePEG::Interfaced::doDefaultInit
string doDefaultInit(string)
Command interface function which calls defaultInit().
ThePEG::Interfaced::defaultInit
virtual bool defaultInit()
Functions which are to be used during the actual event generation, after the setup is complete.
ThePEG::Interfaced::setDefaultReference
bool setDefaultReference(PtrT &ptr, string classname, string objectname)
If the pointer, ptr, to an object is not set, create an object of class classname and register it wit...
Definition:
Interfaced.h:154
ThePEG::Interfaced::setGenerator
void setGenerator(tEGPtr generator)
Protected function to reset the generator pointer, required for automatic decayer generation in Herwi...
Definition:
Interfaced.h:188
ThePEG::Interfaced::operator=
Interfaced & operator=(const Interfaced &)=delete
Private and non-existent assignment operator.
ThePEG::Interfaced::generator
tEGPtr generator() const
Return a pointer to the EventGenerator controlling the run.
Definition:
Interfaced.h:99
ThePEG::PID
PID is a helper class implementing the type of PDG particle ids.
Definition:
PID.h:23
ThePEG::PersistentIStream
PersistentIStream is used to read persistent objects from a stream where they were previously written...
Definition:
PersistentIStream.h:48
ThePEG::PersistentOStream
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
Definition:
PersistentOStream.h:51
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::Repository
Repository inherits from the BaseRepository class.
Definition:
Repository.h:45
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::BaseClassTrait
BaseClassTraits describes the base classes of the templated class.
Definition:
ClassTraits.h:156
ThePEG::BaseClassTrait::NthBase
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition:
ClassTraits.h:161
ThePEG::ClassTraitsBase::className
static string className()
Return the name of class T.
Definition:
ClassTraits.h:66
ThePEG::ClassTraitsType
ClassTraitsType is an empty, non-polymorphic, base class.
Definition:
ClassTraits.h:30
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6